From: Marek Polacek Date: Thu, 24 Jul 2014 09:00:13 +0000 (+0000) Subject: re PR c/57653 (filename information discarded when using -imacros) X-Git-Tag: releases/gcc-5.1.0~6126 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cdc94aca13aa1bf9531ed11d798e346c99a6c83f;p=thirdparty%2Fgcc.git re PR c/57653 (filename information discarded when using -imacros) PR c/57653 * c-opts.c (c_finish_options): If -imacros is in effect, return. * c-c++-common/pr57653.c: New test. * c-c++-common/pr57653.h: New file. * c-c++-common/pr57653-2.c: New test. * c-c++-common/pr57653-2.h: New file. From-SVN: r212972 --- diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 186c04128495..81ec2568af24 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2014-07-24 Marek Polacek + + PR c/57653 + * c-opts.c (c_finish_options): If -imacros is in effect, return. + 2014-07-16 Dodji Seketeli PR preprocessor/60723 - missing system-ness marks for macro tokens diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 968b703328b5..3f8e6e6f6772 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -1438,6 +1438,12 @@ c_finish_options (void) static void push_command_line_include (void) { + /* This can happen if disabled by -imacros for example. + Punt so that we don't set "" as the filename for + the header. */ + if (include_cursor > deferred_count) + return; + if (!done_preinclude) { done_preinclude = true; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c3e9c5c343ca..09ff1dca7d79 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2014-07-24 Marek Polacek + + PR c/57653 + * c-c++-common/pr57653.c: New test. + * c-c++-common/pr57653.h: New file. + * c-c++-common/pr57653-2.c: New test. + * c-c++-common/pr57653-2.h: New file. + 2014-07-23 Jiong Wang * gcc.target/aarch64/test_frame_common.h: New file. diff --git a/gcc/testsuite/c-c++-common/pr57653-2.c b/gcc/testsuite/c-c++-common/pr57653-2.c new file mode 100644 index 000000000000..086f6be5ce15 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr57653-2.c @@ -0,0 +1,4 @@ +/* { dg-do preprocess } */ +/* { dg-options "-imacros ${srcdir}/c-c++-common/pr57653-2.h" } */ + +/* Empty. */ diff --git a/gcc/testsuite/c-c++-common/pr57653-2.h b/gcc/testsuite/c-c++-common/pr57653-2.h new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr57653-2.h @@ -0,0 +1 @@ + diff --git a/gcc/testsuite/c-c++-common/pr57653.c b/gcc/testsuite/c-c++-common/pr57653.c new file mode 100644 index 000000000000..620471e24194 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr57653.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-imacros ${srcdir}/c-c++-common/pr57653.h" } */ + +__attribute__((used)) static const char s[] = F; + +/* { dg-final { scan-assembler-not "command-line" } } */ diff --git a/gcc/testsuite/c-c++-common/pr57653.h b/gcc/testsuite/c-c++-common/pr57653.h new file mode 100644 index 000000000000..5a93388e9fd5 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr57653.h @@ -0,0 +1 @@ +#define F __FILE__