re PR preprocessor/35458 (Dependency generation (-M) does not quote '#' in filenames)

libcpp
2008-03-06  Markus Milleder  <markus.milleder@generali.at>
	PR preprocessor/35458
	* mkdeps.c (munge): Quote '#' with a '\'.
gcc/testsuite
2008-03-06  Markus Milleder  <markus.milleder@generali.at>
	PR preprocessor/35458
	* gcc.dg/cpp/cmdlne-M-2.c: New file.
	* gcc.dg/cpp/cmdlne-M-2#.h: New file.
	* gcc.dg/cpp/#cmdlne-M-2.h: New file.

From-SVN: r132982
This commit is contained in:
Markus Milleder 2008-03-06 19:08:40 +01:00 committed by Tom Tromey
parent 48081aae38
commit 830465c6ea
6 changed files with 37 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2008-03-06 Markus Milleder <markus.milleder@generali.at>
PR preprocessor/35458
* gcc.dg/cpp/cmdlne-M-2.c: New file.
* gcc.dg/cpp/cmdlne-M-2#.h: New file.
* gcc.dg/cpp/#cmdlne-M-2.h: New file.
2008-03-06 Tom Tromey <tromey@redhat.com>
* lib/treelang-dg.exp, lib/treelang.exp: Delete.

View File

@ -0,0 +1 @@
/* empty */

View File

@ -0,0 +1 @@
/* empty */

View File

@ -0,0 +1,14 @@
/* Copyright (C) 2008 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options "-M" } */
/* Test that dependency output suppresses warnings by implying -w. */
#include "#cmdlne-M-2.h"
#include "cmdlne-M-2#.h"
/* { dg-final { scan-file cmdlne-M-2.i "(^|\\n)cmdlne-M-2.o:" } }
{ dg-final { scan-file cmdlne-M-2.i "cmdlne-M-2.c" } }
{ dg-final { scan-file cmdlne-M-2.i "\\\\#cmdlne-M-2.h" } }
{ dg-final { scan-file cmdlne-M-2.i "cmdlne-M-2\\\\#.h" } } */

View File

@ -1,3 +1,8 @@
2008-03-06 Markus Milleder <markus.milleder@generali.at>
PR preprocessor/35458
* mkdeps.c (munge): Quote '#' with a '\'.
2008-02-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
PR preprocessor/35379

View File

@ -79,6 +79,11 @@ munge (const char *filename)
/* '$' is quoted by doubling it. */
len++;
break;
case '#':
/* '#' is quoted with a backslash. */
len++;
break;
}
}
@ -100,6 +105,10 @@ munge (const char *filename)
*dst++ = '$';
break;
case '#':
*dst++ = '\\';
break;
default:
/* nothing */;
}