6 ms·
Did you try with -Weverything on Clang? That will enable more warnings than -Wall and -Wextra.
by saghul 11y ago
Did you try with -Weverything on Clang? That will enable more warnings than -Wall and -Wextra.
- 3JPLW 11y ago$ clang -Wall -Weverything -pedantic -c -o spectral_contrast.o spectral_contrast.c spectral_contrast.c:16:8: warning: no previous prototype for function 'spectral_contrast' [-Wmissing-prototypes] double spectral_contrast(float_t *a, float_t *b, int length) { ^ 1 warning generated.
- nkurz 11y agoThanks for mentioning that option. I hadn't known about it. Clang does give a warning with -Weverything, but I don't understand what it means: http://goo.gl/M9qjmx http://goo.gl/M9qjmx 13 : warning: no previous prototype for function spectral_contrast' [-Wmissing-prototypes] double spectral_contrast(float_t *a, float_t *b, int length) { It gives the same warning if I change all the float_t's to float, or if I change all the float_t's to double, so I think it's not actually useful or relevant.
- 3JPLW 11y agoIt's effectively catching the fact that `spectral_contrast.c` does not `#include "match.h"` — this is indeed directly a part of the underhandedness. The warning occurs because the function is not static — and therefore callable by other modules. Since it's missing a forward definition (a previous prototype), those modules must blindly declare the prototypes themselves… and their prototypes can get out of sync with the actual definition. That's what's happening here. `match.h` has the forward prototype, but it's very subtly different from the definition. Were match.h included, there'd be a much more glaring warning (or maybe even error).