Bug 43126 - "at this point in file" warnings are upside down
Summary: "at this point in file" warnings are upside down
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.4.1
: P3 normal
Target Milestone: ---
Assignee: Manuel López-Ibáñez
URL:
Keywords: diagnostic
: 38468 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-02-20 05:22 UTC by Glenn Maynard
Modified: 2010-06-02 06:53 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-02-20 15:56:39


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Glenn Maynard 2010-02-20 05:22:00 UTC
These warnings have driven me insane for years:

blah.cc:1: error: too many arguments to function ‘void a(int)’
blah.cc:7: error: at this point in file

I always end up jumping to line 1 in the file.  I glance at the message and line number in the first line, and I'm jumping to that line number before my brain has really processed which error message it is.  This is inherently something I can't learn to work around without deliberately slowing down my workflow (a mental pipeline stall?).

The line number next to the error should be the one causing the error; any additional, related lines should come *after*.  This is much better:

blah.cc:7: error: too many arguments to function ‘void a(int)’
blah.cc:1: error: declared here

This also makes it consistent with the C version of this error.
Comment 1 Andrew Pinski 2010-02-20 06:25:29 UTC
Confirmed.
The C front-end just emits:
t.c: In function ‘g’:
t.c:4:3: error: too many arguments to function ‘f’

While the C++ front-end emits:
t.c:1:5: error: too many arguments to function ‘int f(int)’
t.c:4:16: error: at this point in file
Comment 2 Andrew Pinski 2010-02-20 06:27:30 UTC
I should say the simple example was:
int f(int);
int g(int a, int b)
{
  return f(a, b);
}
Comment 3 Glenn Maynard 2010-02-20 06:51:40 UTC
("4:16"?  I havn't seen that before.  I hope gcc isn't going to start outputting character offsets by default; that's a lot of noise.)
Comment 4 pinskia@gmail.com 2010-02-20 09:00:51 UTC
Subject: Re:  "at this point in file" warnings are upside down



Sent from my iPhone

On Feb 19, 2010, at 10:51 PM, "glenn at zewt dot org" <gcc-bugzilla@gcc.gnu.org 
 > wrote:

>
>
> ------- Comment #3 from glenn at zewt dot org  2010-02-20 06:51  
> -------
> ("4:16"?  I havn't seen that before.  I hope gcc isn't going to start
> outputting character offsets by default; that's a lot of noise.)

Yes gcc is now printing out column information. And no it is not a lot  
of noise.

>
>
> -- 
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43126
>
Comment 5 Manuel López-Ibáñez 2010-02-20 15:31:13 UTC
(In reply to comment #3)
> ("4:16"?  I havn't seen that before.  I hope gcc isn't going to start
> outputting character offsets by default; that's a lot of noise.)
> 

From GCC 4.5, you can disable it with -fno-show-column.
Comment 6 Manuel López-Ibáñez 2010-02-20 15:56:39 UTC
I have a patch.
Comment 7 Manuel López-Ibáñez 2010-02-22 22:31:01 UTC
Subject: Bug 43126

Author: manu
Date: Mon Feb 22 22:30:45 2010
New Revision: 156979

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156979
Log:
2010-02-22  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c++/43126
	* c-typeck.c (convert_arguments): Print declaration location.
	* c-common.c (validate_nargs): Rename as
	builtin_function_validate_nargs.
	(check_builtin_function_arguments): Update.
cp/
	* typeck.c (convert_arguments): Update error message.
	
testsuite/
	* gcc.dg/cleanup-1.c: Update.
	* gcc.dg/func-args-1.c: Update.
	* gcc.dg/format/sentinel-1.c: Update.
	* g++.old-deja/g++.jason/scoping10.C: Update.
	* g++.old-deja/g++.ns/lookup5.C: Update.
	* g++.dg/ext/cleanup-1.C: Update.
	* g++.dg/parse/varmod1.C: Update.
	* g++.dg/parse/error33.C: Update.
	* g++.dg/expr/call3.C: Update.
	* g++.dg/func-args-1.C: New.
	

Added:
    trunk/gcc/testsuite/g++.dg/func-args-1.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-common.c
    trunk/gcc/c-typeck.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/expr/call3.C
    trunk/gcc/testsuite/g++.dg/ext/cleanup-1.C
    trunk/gcc/testsuite/g++.dg/parse/error33.C
    trunk/gcc/testsuite/g++.dg/parse/varmod1.C
    trunk/gcc/testsuite/g++.old-deja/g++.jason/scoping10.C
    trunk/gcc/testsuite/g++.old-deja/g++.ns/lookup5.C
    trunk/gcc/testsuite/gcc.dg/cleanup-1.c
    trunk/gcc/testsuite/gcc.dg/format/sentinel-1.c
    trunk/gcc/testsuite/gcc.dg/func-args-1.c

Comment 8 Manuel López-Ibáñez 2010-02-22 22:32:37 UTC
FIXED in GCC 4.5
Comment 9 Shujing Zhao 2010-06-02 06:53:53 UTC
*** Bug 38468 has been marked as a duplicate of this bug. ***