-Wconversion is not enabled by default. Closely related is -Wsign-conversion (included in -Wconversion), which is also not present. -Wconversion is enabled by "Enable extra annoying warnings" (EXTRA_WARNINGS).
-Wconversion and -Wsign-conversion are important because -1 > 1 after C/C++ promotion rules. The following will likely produce unexpected results:
int x = GetX(); // assume -1
unsinged int y = GetY(); // assume 1
if(x > y)
printf("%d is greater than %u", x, y);
else
printf("%d is not greater than %u", x, y);
Apparently, one of the uClibc developer was bitten by this or a similar langauge feature. From Rules.mak:
# Why -funsigned-char: I hunted a bug related to incorrect
# sign extension of 'char' type for 10 hours straight. Not fun.
CPU_CFLAGS-y := -funsigned-char -fno-builtin
-Wconversion can produce a lot of output, but the output is usually correct. Its painful to turn the warning on for a mature product because a lot of slop has crept into the project. It only "annoying" because the programmers have not been mindful of details :)
-Wconversion is not enabled by default. Closely related is -Wsign-conversion (included in -Wconversion), which is also not present. -Wconversion is enabled by "Enable extra annoying warnings" (EXTRA_WARNINGS). -Wconversion and -Wsign-conversion are important because -1 > 1 after C/C++ promotion rules. The following will likely produce unexpected results: int x = GetX(); // assume -1 unsinged int y = GetY(); // assume 1 if(x > y) printf("%d is greater than %u", x, y); else printf("%d is not greater than %u", x, y); Apparently, one of the uClibc developer was bitten by this or a similar langauge feature. From Rules.mak: # Why -funsigned-char: I hunted a bug related to incorrect # sign extension of 'char' type for 10 hours straight. Not fun. CPU_CFLAGS-y := -funsigned-char -fno-builtin -Wconversion can produce a lot of output, but the output is usually correct. Its painful to turn the warning on for a mature product because a lot of slop has crept into the project. It only "annoying" because the programmers have not been mindful of details :)