]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c/57653 (filename information discarded when using -imacros)
authorRichard Biener <rguenther@suse.de>
Wed, 11 Feb 2015 12:14:07 +0000 (12:14 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 11 Feb 2015 12:14:07 +0000 (12:14 +0000)
2015-02-11  Richard Biener  <rguenther@suse.de>

Backport from mainline
2014-07-24  Marek Polacek  <polacek@redhat.com>

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: r220614

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 701d1cef771c67e2bbd9073ebeebc6d8b9575ad9..b1dc340691335d89fca7a3ad9bfa0657dd36b9ec 100644 (file)
@@ -1,3 +1,11 @@
+2015-02-11  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2014-07-24  Marek Polacek  <polacek@redhat.com>
+
+       PR c/57653
+       * c-opts.c (c_finish_options): If -imacros is in effect, return.
+
 2015-01-20  Marek Polacek  <polacek@redhat.com>
 
        Backport from mainline
index 29e9a355beed7a36f56de8c9c7c055139e13d1c2..dd5fd2307825f319dff336ccfd3b73af3a0d113a 100644 (file)
@@ -1363,6 +1363,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 9e225c7dc3b053535bd24e1bcd06d176e8a4acd1..621b1408d5650663f78ccb9e88638f7de79688ed 100644 (file)
@@ -1,3 +1,14 @@
+2015-02-11  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       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.
+
 2015-02-09  Dominik Vogt  <vogt@linux.vnet.ibm.com>
 
        * gcc/testsuite/gcc.target/s390/hotpatch-13.c: New testcase.
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__