diff options
author | Gary Funck <gary@intrepid.com> | 2012-01-09 08:48:43 +0000 |
---|---|---|
committer | Gary Funck <gfunck@gcc.gnu.org> | 2012-01-09 08:48:43 +0000 |
commit | b492b6862ef38c3a8c7a67f4c410dcf69434507d (patch) | |
tree | 2b2f237168b3048e8f7a77942d33aaf369c7cae0 /gcc | |
parent | fdff9f3d33732e60f9c1a22e4a3c40a3aeea7447 (diff) | |
download | gcc-b492b6862ef38c3a8c7a67f4c410dcf69434507d.zip gcc-b492b6862ef38c3a8c7a67f4c410dcf69434507d.tar.gz gcc-b492b6862ef38c3a8c7a67f4c410dcf69434507d.tar.bz2 |
re PR preprocessor/33919 (__BASE_FILE__ does not expand correctly when included from the command line)
libcpp/
PR preprocessor/33919
* files.c (_cpp_get_file_name): New. Implement file name
access function.
* internal.h (_cpp_get_file_name): New prototype.
* macro.c (_cpp_builtin_macro_text): Call _cpp_get_file_name()
to use pfile->main_file in lieu of traversing INCLUDED_FROM chain.
gcc/testsuite/
PR preprocessor/33919
* gcc.dg/pr33919.c: New test.
* gcc.dg/pr33919-0.h: New test header file.
* gcc.dg/pr33919-1.h: Ditto.
* gcc.dg/pr33919-2.h: Ditto.
From-SVN: r183003
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr33919-0.h | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr33919-1.h | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr33919-2.h | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr33919.c | 26 |
5 files changed, 38 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b8b9b94..06ad7c6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2012-01-09 Gary Funck <gary@intrepid.com> + + PR preprocessor/33919 + * gcc.dg/pr33919.c: New test. + * gcc.dg/pr33919-0.h: New test header file. + * gcc.dg/pr33919-1.h: Ditto. + * gcc.dg/pr33919-2.h: Ditto. + 2012-01-07 Jan Hubicka <jh@suse.cz> PR tree-optimize/51694 diff --git a/gcc/testsuite/gcc.dg/pr33919-0.h b/gcc/testsuite/gcc.dg/pr33919-0.h new file mode 100644 index 0000000..21966c6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr33919-0.h @@ -0,0 +1 @@ +char *pre_inc_base_file = __BASE_FILE__; diff --git a/gcc/testsuite/gcc.dg/pr33919-1.h b/gcc/testsuite/gcc.dg/pr33919-1.h new file mode 100644 index 0000000..c7345aa --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr33919-1.h @@ -0,0 +1,2 @@ +#include "pr33919-2.h" +char *inc_base_file = __BASE_FILE__; diff --git a/gcc/testsuite/gcc.dg/pr33919-2.h b/gcc/testsuite/gcc.dg/pr33919-2.h new file mode 100644 index 0000000..3c22257 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr33919-2.h @@ -0,0 +1 @@ +char *nested_inc_base_file = __BASE_FILE__; diff --git a/gcc/testsuite/gcc.dg/pr33919.c b/gcc/testsuite/gcc.dg/pr33919.c new file mode 100644 index 0000000..14ea374 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr33919.c @@ -0,0 +1,26 @@ +/* PR preprocessor/pr33919 */ +/* { dg-do run } */ +/* { dg-options "-I . -include ${srcdir}/gcc.dg/pr33919-0.h" } */ + +#include "pr33919-1.h" + +const char *base_file = __BASE_FILE__; + +extern int strcmp (const char *, const char *); +extern void abort (void); + +int +main () +{ + if (!strcmp (pre_inc_base_file, "<command line>")) + abort (); + if (strcmp (pre_inc_base_file, __FILE__)) + abort (); + if (strcmp (base_file, __FILE__)) + abort (); + if (strcmp (inc_base_file, __FILE__)) + abort (); + if (strcmp (nested_inc_base_file, __FILE__)) + abort (); + return 0; +} |