Consider this code: extern char *optarg; extern char *optarg; $ gcc testcase-min.i -c -Werror -Wredundant-decls -Wno-error=redundant-decls -fdiagnostics-show-option testcase-min.i:2: warning: redundant redeclaration of optarg [-Wredundant-decls] cc1: warnings being treated as errors testcase-min.i:1: error: previous declaration of optarg was here
It does work if I don't use -Wredundant-decls at all, but I want to see the warning: $ gcc testcase-min.i -c -Wall -Werror $ gcc -v Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.1-9' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-cld --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.3.1 (Debian 4.3.1-9) -- Summary: -Wredundant-decls -Wno-error=redundant-decls not working as expected Product: gcc Version: 4.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: edwintorok at gmail dot com GCC build triplet: x86_64-linux-gnu GCC host triplet: x86_64-linux-gnu GCC target triplet: x86_64-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37190