Bugzilla – Bug 120457
gcc prints warning twice
Last modified: 2007-09-27 15:49:55 UTC
GCC prints the warning twice even though it should only be once, testcase attached.
Created attachment 51534 [details] Testcase
i guess it is better to open a upstream gcc bugzilla entry. ;)
The problem is the glibc header /usr/include/stdio.h: extern int snprintf (char *__restrict __s, size_t __maxlen, __const char *__restrict __format, ...) __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))); I.e. the glibc header explicitely defines a __format__ attribute for snprintf. But GCC has already an internal format attribute for this function (like for printf itself for instance, where the header doesn't add such attribute). GCC simply goes over the list of all attributes and checks for each of them. In the snprintf case both attributes have the same arguments, but that is nothing GCC checks, so it checks and warns about the same thing twice. Needs to be changed in glibc, hence reassigning.
If somebody don't like that, he is free to discuss that with Uli. I will not change that.