https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70791
Bug ID: 70791 Summary: -Wnested-externs prints inconsistent column number Product: gcc Version: 6.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: egall at gwmail dot gwu.edu Target Milestone: --- Host: i386-apple-darwin9.8.0 Target: i386-apple-darwin9.8.0 Build: i386-apple-darwin9.8.0 Say I have the following file: $ cat undeclared.c char *foo(char *); int bar(void) { char *baz = foo(UNDECLARED_MACRO("")); } When I compile it like this, gcc says: $ /usr/local/bin/gcc -c -Wimplicit -Wnested-externs -Wint-conversion undeclared.c undeclared.c: In function ‘bar’: undeclared.c:4:18: warning: implicit declaration of function ‘UNDECLARED_MACRO’ [-Wimplicit-function-declaration] char *baz = foo(UNDECLARED_MACRO("")); ^ undeclared.c:4:2: warning: nested extern declaration of ‘UNDECLARED_MACRO’ [-Wnested-externs] char *baz = foo(UNDECLARED_MACRO("")); ^ undeclared.c:4:18: warning: passing argument 1 of ‘foo’ makes pointer from integer without a cast [-Wint-conversion] char *baz = foo(UNDECLARED_MACRO("")); ^ undeclared.c:1:7: note: expected ‘char *’ but argument is of type ‘int’ char *foo(char *); ^ I would expect the warning from -Wnested-externs to point to the same column as the other 2 warnings. (Of course, ideally the 3 would be combined into a single warning, but that's a separate issue) My gcc version info: $ /usr/local/bin/gcc -v Using built-in specs. COLLECT_GCC=/usr/local/bin/gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i386-apple-darwin9.8.0/6.0.0/lto-wrapper Target: i386-apple-darwin9.8.0 Configured with: ../configure --disable-werror --enable-languages=c,c++,lto,objc,obj-c++ --enable-stage1-checking=release -C --with-system-libunwind --enable-secureplt --enable-frame-pointer --enable-version-specific-runtime-libs --enable-assert --enable-fat --enable-portable-binary --enable-browser-plugin --enable-gconf-peer --enable-libgcj-debug --enable-gc-debug --enable-interpreter --enable-aot-compile-rpm --enable-java-home --with-x --enable-collections --enable-gstreamer-peer --enable-xmlj --enable-qt-peer --enable-debug --enable-local-sockets --without-isl --enable-objc-gc --enable-maintainer-mode --enable-host-shared CC=/usr/local/bin/gcc CXX=/usr/local/bin/g++ AUTOCONF=/usr/local/bin/autoconf AUTOHEADER=/usr/local/bin/autoheader AUTOM4TE=/usr/local/bin/autom4te AUTORECONF=/usr/local/bin/autoreconf AUTOSCAN=/usr/local/bin/autoscan AUTOUPDATE=/usr/local/bin/autoupdate IFNAMES=/usr/local/bin/ifnames Thread model: posix gcc version 6.0.0 20151007 (experimental) (GCC)