public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/31757]  New: Name arguments in warnings when their names are know
@ 2007-04-29 13:58 jg at jguk dot org
  2007-04-29 23:02 ` [Bug c++/31757] Name arguments in warnings when their names are known bangerth at dealii dot org
  2010-02-20 19:00 ` manu at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: jg at jguk dot org @ 2007-04-29 13:58 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1473 bytes --]

Could argument names be included in warning messages when they are available?

This is the present output:
$ g++ -Wall -o t main.cpp
main.cpp: In function ‘int main()’:
main.cpp:12: warning: passing NULL to non-pointer argument 2 of ‘void f(int,
bool, bool, int, unsigned int)’
main.cpp:12: warning: passing NULL to non-pointer argument 3 of ‘void f(int,
bool, bool, int, unsigned int)’

The 3rd argument is called "rangetype", so that could be included, to give more
context to the user.

If the name is available, it could be included, for example as this output:

$ g++ -Wall -o t main.cpp
main.cpp: In function ‘int main()’:
main.cpp:12: warning: passing NULL to non-pointer argument 2 of ‘void f(int,
bool, bool, int, unsigned int)’
main.cpp:12: warning: passing NULL to non-pointer argument 3 'rangetype' of
‘void f(int, bool, bool, int, unsigned int)’

Example program:
// g++ -Wall -o t main.cpp
#include <string.h>

void f(int, bool, bool rangetype, int, unsigned int)
{
        int i = 1;
        if(rangetype) i =2;
}

int main()
{
        f(0,NULL,NULL, 1, 1);
}


-- 
           Summary: Name arguments in warnings when their names are know
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jg at jguk dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31757


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/31757] Name arguments in warnings when their names are known
  2007-04-29 13:58 [Bug c++/31757] New: Name arguments in warnings when their names are know jg at jguk dot org
@ 2007-04-29 23:02 ` bangerth at dealii dot org
  2010-02-20 19:00 ` manu at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: bangerth at dealii dot org @ 2007-04-29 23:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from bangerth at dealii dot org  2007-04-30 00:01 -------
I believe the current approach is pretty much the only thing that
can be implemented reliably, because you could write code like this:
---------------
int f(int i, int j);
int f(int j, int i);

int g = f(1,2);
---------------
Note how the name of an argument is not unique. What do you suggest to do
in this case?

W.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bangerth at dealii dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31757


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/31757] Name arguments in warnings when their names are known
  2007-04-29 13:58 [Bug c++/31757] New: Name arguments in warnings when their names are know jg at jguk dot org
  2007-04-29 23:02 ` [Bug c++/31757] Name arguments in warnings when their names are known bangerth at dealii dot org
@ 2010-02-20 19:00 ` manu at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-20 19:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2010-02-20 18:59 -------
Unfortunately, I have to agree with Wolfgang. We could do better with caret
diagnostics but that is still far away. Sorry, closing as WONTFIX.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WONTFIX


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31757


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-20 19:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-29 13:58 [Bug c++/31757] New: Name arguments in warnings when their names are know jg at jguk dot org
2007-04-29 23:02 ` [Bug c++/31757] Name arguments in warnings when their names are known bangerth at dealii dot org
2010-02-20 19:00 ` manu at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).