]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR debug/60603 (.debug_macinfo/.debug_macro has wrong line numbers for...
authorJakub Jelinek <jakub@redhat.com>
Thu, 10 Apr 2014 07:51:52 +0000 (09:51 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 10 Apr 2014 07:51:52 +0000 (09:51 +0200)
Backport from mainline
2014-03-22  Jakub Jelinek  <jakub@redhat.com>

PR debug/60603
* c-opts.c (c_finish_options): Restore cb_file_change call to
<built-in>.

* cpp.c (gfc_cpp_init): Restore cb_change_file call to
<built-in>.

* gcc.dg/debug/dwarf2/dwarf2-macro2.c: New test.

From-SVN: r209265

gcc/c-family/ChangeLog
gcc/c-family/c-opts.c
gcc/fortran/ChangeLog
gcc/fortran/cpp.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro2.c [new file with mode: 0644]

index 966060c14ab7575e6f567951db98003a9125be32..81c7e43e994d9a84632f0c07a6e622ae6f70862a 100644 (file)
@@ -1,6 +1,12 @@
 2014-04-10  Jakub Jelinek  <jakub@redhat.com>
 
        Backport from mainline
+       2014-03-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/60603
+       * c-opts.c (c_finish_options): Restore cb_file_change call to
+       <built-in>.
+
        2014-03-13  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/36282
index 4b6990a60c19b727c7b377423d81a0cae2b2cdbd..8077b788018c71948ebdd72c25cefa2e22358ac7 100644 (file)
@@ -1258,17 +1258,18 @@ c_finish_options (void)
     {
       size_t i;
 
-      {
-       /* Make sure all of the builtins about to be declared have
-         BUILTINS_LOCATION has their source_location.  */
-       source_location builtins_loc = BUILTINS_LOCATION;
-       cpp_force_token_locations (parse_in, &builtins_loc);
+      cb_file_change (parse_in,
+                     linemap_add (line_table, LC_RENAME, 0,
+                                  _("<built-in>"), 0));
+      /* Make sure all of the builtins about to be declared have
+        BUILTINS_LOCATION has their source_location.  */
+      source_location builtins_loc = BUILTINS_LOCATION;
+      cpp_force_token_locations (parse_in, &builtins_loc);
 
-       cpp_init_builtins (parse_in, flag_hosted);
-       c_cpp_builtins (parse_in);
+      cpp_init_builtins (parse_in, flag_hosted);
+      c_cpp_builtins (parse_in);
 
-       cpp_stop_forcing_token_locations (parse_in);
-      }
+      cpp_stop_forcing_token_locations (parse_in);
 
       /* We're about to send user input to cpplib, so make it warn for
         things that we previously (when we sent it internal definitions)
index 3c37c6b7a9a04723ca2542eeb30fcde0bec50c2b..6673d027377e03c559747707b852022d7c9115db 100644 (file)
@@ -1,3 +1,12 @@
+2014-04-10  Jakub Jelinek  <jakub@redhat.com>
+
+       Backport from mainline
+       2014-03-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/60603
+       * cpp.c (gfc_cpp_init): Restore cb_change_file call to
+       <built-in>.
+
 2014-03-29  Mikael Morin  <mikael@gcc.gnu.org>
 
        PR fortran/60677
index 0a176b2ad27ffbc17a1c85cc4122fcb102607797..36e96ea5ccc1e3e973a2af1e8144742d7c17d0ce 100644 (file)
@@ -569,6 +569,7 @@ gfc_cpp_init (void)
   if (gfc_option.flag_preprocessed)
     return;
 
+  cpp_change_file (cpp_in, LC_RENAME, _("<built-in>"));
   if (!gfc_cpp_option.no_predefined)
     {
       /* Make sure all of the builtins about to be declared have
index a7a984d1cf43aa6136ddddba70d04efe179c8100..7cafc5406a61e0711650b0e1732d739255463db2 100644 (file)
@@ -1,6 +1,11 @@
 2014-04-10  Jakub Jelinek  <jakub@redhat.com>
 
        Backport from mainline
+       2014-03-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/60603
+       * gcc.dg/debug/dwarf2/dwarf2-macro2.c: New test.
+
        2014-03-17  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/60516
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro2.c
new file mode 100644 (file)
index 0000000..7b33166
--- /dev/null
@@ -0,0 +1,7 @@
+/* Test to make sure the macro info includes the predefined macros with line number 0.  */
+/* { dg-do compile } */
+/* { dg-options "-g3 -gdwarf-2 -dA -fverbose-asm" } */
+/* { dg-final { scan-assembler "At line number 0" } } */
+
+#define FOO 1
+int i;