[Bug 6044] New: -Wconversion is not enabled by default
bugzilla at busybox.net
bugzilla at busybox.net
Sat Mar 2 23:20:00 UTC 2013
https://bugs.busybox.net/show_bug.cgi?id=6044
Summary: -Wconversion is not enabled by default
Product: uClibc
Version: 0.9.33.3
Platform: PC
OS/Version: Linux
Status: NEW
Severity: minor
Priority: P5
Component: Other
AssignedTo: unassigned at uclibc.org
ReportedBy: noloader at gmail.com
CC: uclibc-cvs at uclibc.org
Estimated Hours: 0.0
-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 :)
--
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the uClibc-cvs
mailing list