Mark __func__ with line number 0, to avoid confusing debuggers.
authorDale Johannesen <dalej@apple.com>
Tue, 6 Aug 2002 23:36:22 +0000 (23:36 +0000)
committerDale Johannesen <dalej@gcc.gnu.org>
Tue, 6 Aug 2002 23:36:22 +0000 (23:36 +0000)
From-SVN: r56081

gcc/ChangeLog
gcc/c-common.c

index 3cd7f5596a3c464decffb4bc7d7f81236d80a5f3..2e3a9b8d47b385c4a89edabe9cac80f4e1f26838 100644 (file)
@@ -1,3 +1,7 @@
+2002-08-06  Dale Johannesen  <dalej@apple.com>
+       * c-common.c (fname_decl): Use line number 0 for
+        __func__, to avoid confusing debuggers.
+
 2002-08-06  Nathan Sidwell  <nathan@codesourcery.com>
 
        * gcov.c: Tidy.
index 363e72f949d6943fc71dd7799d4b99bec2f13475..fabc18139043d76372b601e8e727b9638e62ad7b 100644 (file)
@@ -1102,6 +1102,13 @@ fname_decl (rid, id)
   if (!decl)
     {
       tree saved_last_tree = last_tree;
+      /* If a tree is built here, it would normally have the lineno of
+        the current statement.  Later this tree will be moved to the
+        beginning of the function and this line number will be wrong.
+        To avoid this problem set the lineno to 0 here; that prevents
+        it from appearing in the RTL. */
+      int saved_lineno = lineno;
+      lineno = 0;
       
       decl = (*make_fname_decl) (id, fname_vars[ix].pretty);
       if (last_tree != saved_last_tree)
@@ -1117,6 +1124,7 @@ fname_decl (rid, id)
                                                 saved_function_name_decls);
        }
       *fname_vars[ix].decl = decl;
+      lineno = saved_lineno;
     }
   if (!ix && !current_function_decl)
     pedwarn_with_decl (decl, "`%s' is not defined outside of function scope");