]> 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:54 +0000 (12:14 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 11 Feb 2015 12:14:54 +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: r220615

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 5ee7024efa9f853fbdb3ef82b0757a13404cb273..30de1e113bee9ce686482a13cf62a8a7a6f15524 100644 (file)
@@ -1347,6 +1347,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 a3d4b249ddd6b52f2c556de57ed35594c3bb9ddf..f20e49897b5a89d47d5d59b118e77ac13ad26426 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-04  Uros Bizjak  <ubizjak@gmail.com>
 
        Backport from mainline
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__