This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch for bug 18322


This patch fixes bug 18322, a regression in the location of the
diagnostic for __func__ outside a function found while improving C
front end test coverage so the new parser is adequately regression
tested.

Bootstrapped with no regressions on i686-pc-linux-gnu.  Applied to
mainline.  Will apply a similar patch to 3.4 branch (adjusted for the
message there using '%D' rather than %qD, and adding the updated
testcases to the branch as the testcases aren't currently on the
branch) after testing there.

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)

2004-11-09  Joseph S. Myers  <joseph@codesourcery.com>

	PR c/18322
	* c-common.c (fname_decl): Don't use line number of decl in
	diagnostic.

testsuite:
2004-11-09  Joseph S. Myers  <joseph@codesourcery.com>

	PR c/18322
	* gcc.dg/func-outside-1.c, gcc.dg/func-outside-2.c: Correct
	expected diagnostic location.

diff -rupN GCC.orig/gcc/c-common.c GCC/gcc/c-common.c
--- GCC.orig/gcc/c-common.c	2004-11-09 10:17:21.000000000 +0000
+++ GCC/gcc/c-common.c	2004-11-09 14:55:44.000000000 +0000
@@ -828,7 +828,7 @@ fname_decl (unsigned int rid, tree id)
       input_location = saved_location;
     }
   if (!ix && !current_function_decl)
-    pedwarn ("%J%qD is not defined outside of function scope", decl, decl);
+    pedwarn ("%qD is not defined outside of function scope", decl);
 
   return decl;
 }
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/func-outside-1.c GCC/gcc/testsuite/gcc.dg/func-outside-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/func-outside-1.c	2004-11-06 16:21:45.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/func-outside-1.c	2004-11-09 14:56:04.000000000 +0000
@@ -4,6 +4,6 @@
 /* { dg-do compile } */
 /* { dg-options "" } */
 
-const char *a = __func__; /* { dg-warning "warning: '__func__' is not defined outside of function scope" "undef" { target *-*-* } 0 } */
+const char *a = __func__; /* { dg-warning "warning: '__func__' is not defined outside of function scope" "undef" } */
 const char *b = __FUNCTION__;
 const char *c = __PRETTY_FUNCTION__;
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/func-outside-2.c GCC/gcc/testsuite/gcc.dg/func-outside-2.c
--- GCC.orig/gcc/testsuite/gcc.dg/func-outside-2.c	2004-11-06 16:21:45.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/func-outside-2.c	2004-11-09 14:56:12.000000000 +0000
@@ -4,6 +4,6 @@
 /* { dg-do compile } */
 /* { dg-options "-pedantic-errors" } */
 
-const char *a = __func__; /* { dg-error "error: '__func__' is not defined outside of function scope" "undef" { target *-*-* } 0 } */
+const char *a = __func__; /* { dg-error "error: '__func__' is not defined outside of function scope" "undef" } */
 const char *b = __FUNCTION__;
 const char *c = __PRETTY_FUNCTION__;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]