]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/57653 (filename information discarded when using -imacros)
authorMarek Polacek <polacek@redhat.com>
Thu, 24 Jul 2014 09:00:13 +0000 (09:00 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Thu, 24 Jul 2014 09:00:13 +0000 (09:00 +0000)
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

gcc/c-family/ChangeLog
gcc/c-family/c-opts.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/pr57653-2.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/pr57653-2.h [new file with mode: 0644]
gcc/testsuite/c-c++-common/pr57653.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/pr57653.h [new file with mode: 0644]

index 186c04128495d39380bbf23a27c40757c067ea9e..81ec2568af24ce3577231cabe3c3092107cfa8a0 100644 (file)
@@ -1,3 +1,8 @@
+2014-07-24  Marek Polacek  <polacek@redhat.com>
+
+       PR c/57653
+       * c-opts.c (c_finish_options): If -imacros is in effect, return.
+
 2014-07-16  Dodji Seketeli  <dodji@redhat.com>
 
        PR preprocessor/60723 - missing system-ness marks for macro tokens
index 968b703328b50cd950f4afd5deac825086733f0d..3f8e6e6f6772be9a71aae240ff8875805244581d 100644 (file)
@@ -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 "<command-line>" as the filename for
+     the header.  */
+  if (include_cursor > deferred_count)
+    return;
+
   if (!done_preinclude)
     {
       done_preinclude = true;
index c3e9c5c343ca628dfcc09d27a084956ad2418fda..09ff1dca7d79f7bda4d5c12100ece264c54eeb65 100644 (file)
@@ -1,3 +1,11 @@
+2014-07-24  Marek Polacek  <polacek@redhat.com>
+
+       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  <jiong.wang@arm.com>
 
        * 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 (file)
index 0000000..086f6be
--- /dev/null
@@ -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 (file)
index 0000000..8b13789
--- /dev/null
@@ -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 (file)
index 0000000..620471e
--- /dev/null
@@ -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 (file)
index 0000000..5a93388
--- /dev/null
@@ -0,0 +1 @@
+#define F __FILE__