NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/51955: incorrect varargs warning



>Number:         51955
>Category:       toolchain
>Synopsis:       incorrect varargs warning
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 06 14:55:00 +0000 2017
>Originator:     Thomas Klausner
>Release:        NetBSD 7.99.59
>Organization:
Curiosity is the very basis of education and if you tell me that 
curiosity killed the cat, I say only that the cat died nobly.
- Arnold Edinborough
>Environment:
	
	
Architecture: x86_64
Machine: amd64
>Description:
When compiling varargs code, gcc sometimes reports incorrect varargs warnings.
It seems to be connected to -std=gnu++14.
>How-To-Repeat:
$ cat >> example.cc

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>

char* myprintf (const char *fmt, ...) {
    va_list ap;

    va_start (ap, fmt);
    va_end (ap);
    return NULL;
}
CTRL-D
$ g++   -std=gnu++14  -c -o example.o example.cc
example.cc: In function â??char* myprintf(const char*, ...)â??:
example.cc:8:23: warning: second parameter of â??va_startâ?? not last named argument [-Wvarargs]
     va_start (ap, fmt);
                       ^


$ g++   -std=gnu++11  -c -o example.o example.cc
$
>Fix:
Please.

>Unformatted:
 	
 	



Home | Main Index | Thread Index | Old Index