public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jg at jguk dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/31757]  New: Name arguments in warnings when their names are know
Date: Sun, 29 Apr 2007 13:58:00 -0000	[thread overview]
Message-ID: <bug-31757-13581@http.gcc.gnu.org/bugzilla/> (raw)

[-- 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


             reply	other threads:[~2007-04-29 13:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-29 13:58 jg at jguk dot org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-31757-13581@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).