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 via email to