https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80912
Bug ID: 80912 Summary: enhancement: -Wundeclared-selector improvements Product: gcc Version: 7.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: objc 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 1. -fdiagnostics-show-option does not actually cause the '-Wundeclared-selector' option to be shown. macappkit.m: In function ‘-[EmacsController setConflictingKeyBindingsDisabled:]’: macappkit.m:2010:4: warning: undeclared selector ‘sharedKeyBindingManager’ performSelector:@selector(sharedKeyBindingManager)]; ^~~~~~~~~~~~~~~ should be macappkit.m: In function ‘-[EmacsController setConflictingKeyBindingsDisabled:]’: macappkit.m:2010:4: warning: undeclared selector ‘sharedKeyBindingManager’ [-Wundeclared-selector] performSelector:@selector(sharedKeyBindingManager)]; ^~~~~~~~~~~~~~~ 2. Better location info: the caret points to the beginning of the line instead of the actual selector that is undeclared: macappkit.m:2016:7: warning: undeclared selector ‘setQuoteBinding:’ [keyBindingManager performSelector:@selector(setQuoteBinding:) ^ should point to 'setQuoteBinding:' instead. 3. '-Wundeclared-selector' ignores -ftrack-macro-expansion. Take for example: macappkit.m: In function ‘-[EmacsController handleQueuedNSEventsWithHoldingQuitIn:]’: macappkit.m:1869:8: warning: undeclared selector ‘dummy’ MOUSE_TRACKING_RESET(); ^~~~~~~~~~~~~~~~~~~~ MOUSE_TRACKING_RESET is a macro that expands to: #define MOUSE_TRACKING_RESET() \ [self setTrackingObject:nil andResumeSelector:@selector(dummy)] on line 1735 of this file. I would expect the warning to point inside the definition of this macro, instead of pointing where it is used. The file I am compiling, macappkit.m, is from YAMAMOTO Mitsuharu's Mac port of Emacs. Full command line is: $ /usr/local/bin/gcc -c -DMAC_OSX=1 -I/usr/local/include -DXASSERTS=1 -Demacs -I. -I/var/root/emacs/src -I../lib -I/var/root/emacs/src/../lib -DMAC_OSX=1 -isystem /usr/X11/include -isystem /sw/include/libxml2 -isystem /sw/include -isystem /sw/include/dbus-1.0 -isystem /sw/lib/dbus-1.0/include -isystem /sw/include -Wno-deprecated-declarations -fno-common -Wabi -Waddress -Waggressive-loop-optimizations -Wall -Wattributes -Wbool-compare -Wbuiltin-macro-redefined -Wcast-align -Wchar-subscripts -Wchkp -Wclobbered -Wcomment -Wcoverage-mismatch -Wcpp -Wdate-time -Wdeprecated -Wdesignated-init -Wdisabled-optimization -Wdiscarded-array-qualifiers -Wdiscarded-qualifiers -Wdiv-by-zero -Wdouble-promotion -Wduplicated-cond -Wempty-body -Wendif-labels -Wenum-compare -Wextra -Wformat-contains-nul -Wformat-extra-args -Wformat-security -Wformat-signedness -Wformat-y2k -Wformat-zero-length -Wframe-address -Wfree-nonheap-object -Whsa -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wincompatible-pointer-types -Winit-self -Wint-conversion -Wint-to-pointer-cast -Winvalid-memory-model -Winvalid-pch -Wjump-misses-init -Wlogical-not-parentheses -Wmain -Wmaybe-uninitialized -Wmemset-transposed-args -Wmisleading-indentation -Wmissing-braces -Wmissing-declarations -Wmissing-include-dirs -Wmissing-parameter-type -Wmissing-prototypes -Wmultichar -Wnarrowing -Wnonnull -Wnonnull-compare -Wnull-dereference -Wold-style-declaration -Wold-style-definition -Woverflow -Woverlength-strings -Woverride-init -Wpacked -Wpacked-bitfield-compat -Wparentheses -Wpointer-arith -Wpointer-sign -Wpointer-to-int-cast -Wpragmas -Wreturn-local-addr -Wreturn-type -Wscalar-storage-order -Wsequence-point -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value -Wsizeof-array-argument -Wsizeof-pointer-memaccess -Wstrict-aliasing -Wstrict-prototypes -Wsuggest-attribute=const -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wsuggest-final-methods -Wsuggest-final-types -Wswitch-bool -Wswitch-default -Wtautological-compare -Wtrampolines -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations -Wunused -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-function -Wunused-label -Wunused-local-typedefs -Wunused-macros -Wunused-result -Wunused-value -Wunused-variable -Wvarargs -Wvariadic-macros -Wvector-operation-performance -Wvolatile-register-var -Wwrite-strings -Warray-bounds=2 -Wnormalized=nfc -Wshift-overflow=2 -Wunused-const-variable=2 -Wno-missing-field-initializers -Wno-sign-compare -Wno-type-limits -Wno-switch -Wno-unused-parameter -Wno-format-nonliteral -Wno-logical-op -Wnonportable-cfstrings -Wstrict-overflow=1 -Wdeclaration-after-statement -Wmissing-noreturn -Wunreachable-code -Woverride-init-side-effects -Wshift-overflow=2 -Wdangling-else -Wduplicate-decl-specifier -Wmemset-elt-size -Wswitch-unreachable -Wimplicit-fallthrough -Wformat-length=2 -Wstringop-overflow=2 -Wexpansion-to-defined -Wrestrict -Wint-in-bool-context -Wbool-operation -Walloca-larger-than=16384 -Wvla-larger-than=16384 -Walloc-size-larger-than=32840 -Walloc-zero -Wpsabi -Wbuiltin-declaration-mismatch -fno-eliminate-unused-debug-symbols -fno-crossjumping -fno-delete-dead-exceptions -fno-delete-null-pointer-checks -fno-isolate-erroneous-paths-dereference -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-optimize-strlen -fno-sched-spec-load-dangerous -fno-split-wide-types -fbounds-check -fcheck-data-deps -fexceptions -fstack-check -ftrapv -fvar-tracking -fvar-tracking-assignments -gpubnames -gstrict-dwarf -falign-functions=4 -falign-labels=4 -falign-loops=4 -falign-jumps=4 -ggdb3 -Og -gdwarf-2 -gfull -mfix-and-continue -fobjc-exceptions -fno-strict-aliasing -Wassign-intercept -Wcast-align -Wproperty-assign-default -Wprotocol -Wshadow-ivar -Wundeclared-selector -Wno-missing-noreturn -Wno-overlength-strings -fdiagnostics-show-option -ftrack-macro-expansion macappkit.m 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/7.0.0/lto-wrapper Target: i386-apple-darwin9.8.0 Configured with: ../configure --disable-werror --disable-werror-always --enable-languages=c,c++,lto,objc,obj-c++ --enable-stage1-checking=release,rtl -C --with-system-libunwind --enable-secureplt --enable-frame-pointer --enable-debug --with-isl --enable-objc-gc --disable-host-shared --enable-maintainer-mode --disable-default-pie --with-ld64 --without-pic --enable-target-optspace CC=/usr/local/bin/gcc CXX=/usr/local/bin/g++ AUTOCONF=/usr/local/bin/autoconf AUTOHEADER=/usr/local/bin/autoheader AUTORECONF=/usr/local/bin/autoreconf AUTOM4TE=/usr/local/bin/autom4te AUTOSCAN=/usr/local/bin/autoscan AUTOUPDATE=/usr/local/bin/autoupdate IFNAMES=/usr/local/bin/ifnames : (reconfigured) ../configure --disable-werror --disable-werror-always --enable-languages=c,c++,lto,objc,obj-c++ --enable-stage1-checking=release,rtl -C --with-system-libunwind --enable-secureplt --enable-frame-pointer --enable-debug --with-isl --disable-host-shared --enable-maintainer-mode --disable-default-pie --with-ld64 --without-pic --enable-target-optspace CC=/usr/local/bin/gcc CXX=/usr/local/bin/g++ AUTOCONF=/usr/local/bin/autoconf AUTOHEADER=/usr/local/bin/autoheader AUTORECONF=/usr/local/bin/autoreconf AUTOM4TE=/usr/local/bin/autom4te AUTOSCAN=/usr/local/bin/autoscan AUTOUPDATE=/usr/local/bin/autoupdate IFNAMES=/usr/local/bin/ifnames Thread model: posix gcc version 7.0.0 20170103 (experimental) (GCC)