From: Antonio Ospite Date: Sat, 27 Jul 2013 18:55:48 +0000 (+0200) Subject: examples: silence a couple of clang warnings X-Git-Tag: v0.1.4~16 X-Git-Url: https://git.ao2.it/libam7xxx.git/commitdiff_plain/48cd69fbef6ecdac1fe874ff5f2564e88dbc022b?hp=48cd69fbef6ecdac1fe874ff5f2564e88dbc022b examples: silence a couple of clang warnings Silence a couple of warnings given when compiling with clang: ../examples/am7xxx-play.c:764:28: warning: will never be executed [-Wunreachable-code] AM7XXX_ZOOM_ORIGINAL, AM7XXX_ZOOM_TEST); ^~~~~~~~~~~~~~~~ ../examples/am7xxx-play.c:748:24: warning: will never be executed [-Wunreachable-code] AM7XXX_POWER_OFF, AM7XXX_POWER_TURBO); 2 warnings generated. ../examples/picoproj.c:142:28: warning: will never be executed [-Wunreachable-code] AM7XXX_ZOOM_ORIGINAL, AM7XXX_ZOOM_TEST); ^~~~~~~~~~~~~~~~ ../examples/picoproj.c:127:24: warning: will never be executed [-Wunreachable-code] AM7XXX_POWER_OFF, AM7XXX_POWER_TURBO); 2 warnings generated. The warnings refer to the default case of a switch statement over an enum variable, clang fails to understand that the default case can still be reached because any integer value can be assigned to the enum variables via the atoi() function. Work around the warning. The behavior is also documented here: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-September/024174.html In general assigning arbitrary values to enum variables will just be weird; using enums in read mode is always safe tho. ---