Bug 18322 - [3.3 Regression] __func__ diagnostic in bad location
Summary: [3.3 Regression] __func__ diagnostic in bad location
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 3.4.3
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2004-11-06 21:29 UTC by Joseph S. Myers
Modified: 2005-04-30 16:31 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 3.2.3 4.0.0 3.4.4
Known to fail: 3.3.3 3.4.0
Last reconfirmed: 2005-02-10 01:08:14


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph S. Myers 2004-11-06 21:29:23 UTC
The diagnostic for use of __func__ outside a function, as tested in
gcc.dg/func-outside-*.c, wrongly has line number 0 instead of the
line number of the bad use of __func__.

func-outside-1.c:0: warning: '__func__' is not defined outside of function scope

This is a regression from 3.2.x.

When fixed, the " { target *-*-* } 0" should be removed from those
testcases so they test the diagnostic in its proper location.
Comment 1 Andrew Pinski 2004-11-06 21:32:43 UTC
Confirmed.
Comment 2 GCC Commits 2004-11-09 21:22:38 UTC
Subject: Bug 18322

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jsm28@gcc.gnu.org	2004-11-09 21:22:27

Modified files:
	gcc            : ChangeLog c-common.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/gcc.dg: func-outside-1.c func-outside-2.c 

Log message:
	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.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6257&r2=2.6258
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-common.c.diff?cvsroot=gcc&r1=1.583&r2=1.584
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4566&r2=1.4567
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/func-outside-1.c.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/func-outside-2.c.diff?cvsroot=gcc&r1=1.1&r2=1.2

Comment 4 Gabriel Dos Reis 2005-04-30 16:31:13 UTC
Fixed in 3.4.x.  Thr formating machinery is different in 3.3.6 and
this is not critical for 3.3.6. So closing.