diff options
author | Diederik de Groot <ddegroot@talon.nl> | 2015-04-23 15:00:42 +0200 |
---|---|---|
committer | Matt Jordan <mjordan@digium.com> | 2015-04-23 11:39:13 -0500 |
commit | ca7193167e541a5b6ec092225eb4a60af7abd63f (patch) | |
tree | 44e730f868b9767db6143be4dc9b1c63365eaf2b /res/res_stasis_playback.c | |
parent | 7ccaf8aa46ae98be8289180d6b68c17f177e4f2f (diff) |
Clang: change previous tautological-compare fixes.
clang can warn about a so called tautological-compare, when it finds
comparisons which are logically always true, and are therefor deemed
unnecessary.
Exanple:
unsigned int x = 4;
if (x > 0) // x is always going to be bigger than 0
Enum Case:
Each enumeration is its own type. Enums are an integer type but they
do not have to be *signed*. C leaves it up to the compiler as an
implementation option what to consider the integer type of a particu-
lar enumeration is. Gcc treats an enum without negative values as
an int while clang treats this enum as an unsigned int.
rmudgett & mmichelson: cast the enum to (unsigned int) in assert.
The cast does have an effect. For gcc, which seems to treat all enums
as int, the cast to unsigned int will eliminate the possibility of
negative values being allowed. For clang, which seems to treat enums
without any negative members as unsigned int, the cast will have no
effect. If for some reason in the future a negative value is ever
added to the enum the assert will still catch the negative value.
ASTERISK-24917
Change-Id: I0557ae0154a0b7de68883848a609309cdf0aee6a
Diffstat (limited to 'res/res_stasis_playback.c')
-rw-r--r-- | res/res_stasis_playback.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/res/res_stasis_playback.c b/res/res_stasis_playback.c index 2d40ec0e5..7aac06d66 100644 --- a/res/res_stasis_playback.c +++ b/res/res_stasis_playback.c @@ -629,7 +629,7 @@ enum stasis_playback_oper_results stasis_app_playback_operation( playback_opreation_cb cb; SCOPED_AO2LOCK(lock, playback); - ast_assert(playback->state < STASIS_PLAYBACK_STATE_MAX); + ast_assert((unsigned int)playback->state < STASIS_PLAYBACK_STATE_MAX); if (operation >= STASIS_PLAYBACK_MEDIA_OP_MAX) { ast_log(LOG_ERROR, "Invalid playback operation %u\n", operation); |