3 ms·
That's mostly a cosmetic warning. If you add a prototype for NeverCalled() at the top of the file, it silences the warning, but Clang still emits the same code.
by rossy 9y ago
That's mostly a cosmetic warning. If you add a prototype for NeverCalled() at the top of the file, it silences the warning, but Clang still emits the same code.
- _pmf_ 9y ago> If you add a prototype for NeverCalled() at the top of the file, it silences the warning Or you could write correct C and use (void) instead of () as argument list.
- rossy 9y agoThis example is C++, not C. Clang is complaining because it's good practice to declare a prototype for a non-static function (in a header file) before using or declaring the function itself, so it can't accidentally be used with the wrong parameter list in a different compilation unit. It will produce this warning if you have () or (void) as the parameter list.