examples: silence a couple of clang warnings
authorAntonio Ospite <ospite@studenti.unina.it>
Sat, 27 Jul 2013 18:55:48 +0000 (20:55 +0200)
committerAntonio Ospite <ospite@studenti.unina.it>
Sat, 27 Jul 2013 22:14:47 +0000 (00:14 +0200)
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.


No differences found