13070 – [3.3 regression] -Wformat option ignored in g++ (original) (raw)

Description Debian GCC Maintainers 2003-11-16 12:33:47 UTC

[ forwarded from http://bugs.debian.org/217075 ]

The warning is printed, if gcc is used, but not, if g++ is used.

I'm confused about the -Wformat behaviour in newer g++ 3.3 releases. It works for plain C, but seems to be ignored for C++ (in some cases at least). Look at this:

egon@tuscan:~$ cat testik.cc #include <stdio.h>

int main() { printf("%d\n", 1, 1); } egon@tuscan:$ g++-3.2 -Wformat testik.cc testik.cc: In function `int main()': testik.cc:5: warning: too many arguments for format egon@tuscan:$ g++-3.3 -Wformat testik.cc egon@tuscan:~$

Comment 1 Drea Pinski 2003-11-16 15:19:25 UTC

I can confirm this.

Comment 2 Drea Pinski 2003-11-19 16:12:39 UTC

*** Bug 13123 has been marked as a duplicate of this bug. ***

Comment 3 janis187 2003-12-10 22:56:57 UTC

The regression in PR 13070 was introduced or exposed with this patch to both mainline and the 3.3-branch:

2003-03-17 Roger Sayle <roger@eyesopen.com>

    * decl.c (duplicate_decls): Use the new type when prototyping
    anticipated decls, even when the types match.  This defines the
    exception list for the built-in function.

The regression hunt took place on i686-pc-linux-gnu using the following testcase, modified to not require header files, with -Wformat:

extern "C" int printf (const char *, ...); int main () { printf ("%d\n", 1, 1); }

Comment 4 Drea Pinski 2003-12-21 20:59:41 UTC

Roger this is caused by your patch would you mind fixing it?

Comment 5 Gabriel Dos Reis 2003-12-24 22:02:36 UTC

Roger -- Do you plan to investigate this?

Comment 8 Drea Pinski 2003-12-28 23:05:57 UTC

Only a 3.3 Regression now.

Comment 10 Drea Pinski 2003-12-29 06:25:09 UTC

Fixed for 3.3.3 also.