I did not dig enough on my own, thank you for your time and responses.
In the actual code (proprietary embedded) the header extern
's are #ifdef
'ed and the default was to not create them when the .c
included the .h
. When I set this option it did produce the warnings (errors actually) that I had wanted.
I have a header with:
extern int array[10];
and a source file with:
int array[2] = {0, 0};
Clearly this is incorrect. How can I cause the compiler to warn me? An error would be acceptable as well.
Compilers of interest to me are GCC (old, 3.4.5) and TASKING (not new, 2.3r3). Note that I generally succeed at not making this error but a supplier code generation application apparently does do this. Of course, getting the application fixed is important and I can also write a script to compare the files, but a general compile time solution that would catch this error in all cases would be preferred.