GCC -Wunused-function not working (but other warnings are working)
问题 I'm trying to find unused functions in my codebase by using GCC's -Wunused-function flag. As I would expect, compiling the below code with gcc -Wall -Wunused-function main.cpp prints an unused variable warning: warning: unused variable ‘x’ [-Wunused-variable] However, the compiler doesn't give an unused-function warning. What do I have to do to make GCC notice the unused function foo() ? // main.cpp void foo(){ } //should (but doesn't) trigger 'unused function' warning int main (int argc,