I’m building a software with arm-none-eabi-gcc 10.2 (-01, -Wall)
I have the following files (obviously not the actual files that i’m not allowed to publish):
header1.h
// variable definition
bool b_myBool;
Type bool
is redeclared in my software to unsigned char
header2.h
// variable declaration, const is to be sure the variable is not modified in this translation unit
extern const bool b_myBool;
file2.c
#include <header2.h>
void myFunction(void)
{
bool l_localBool;
...
if (l_localBool != b_myBool)
{
do something;
}
}
Now I accidently modified header2.h to:
extern const float b_myBool;
And I didn’t get any warning (despite the -Wall
compilation option), neither because declaration and definition type do not match, nor because the comparison operands have different types (I know comparing a float and an int is defined by the standard since the int will be converted to a float, it’s just strange there is not a warning for this).