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, char **argv){
    int x; //correctly triggers 'unused variable' warning
    return 0;
}
Remember, I do want unused function warnings. This is not a "how do I get rid of warnings" question.
 
     
     
    