Commit 8b17a9d6 by Joseph Myers Committed by Joseph Myers

re PR c/18322 (__func__ diagnostic in bad location)

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

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

From-SVN: r90365
parent e221ef54
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.
2004-11-09 Ulrich Weigand <uweigand@de.ibm.com>
* config/s390/s390-protos.h (s390_pool_operand): Remove.
......
......@@ -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;
}
......
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.
2004-11-09 Ulrich Weigand <uweigand@de.ibm.com>
* gcc.dg/20041109-1.c: New test.
......
......@@ -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__;
......@@ -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__;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment