From 786f43cb4e1e3520c1479e9c816c1ea49df9bcdc Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 28 Oct 2022 20:15:05 +0300 Subject: [PATCH 26/26] Specenum: Fix clang++ -Wtautological-constant-out-of-range-compare warning See osdn #45941 Signed-off-by: Marko Lindqvist --- utility/generate_specenum.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utility/generate_specenum.py b/utility/generate_specenum.py index 6dab8bb4f9..0742bf14d0 100755 --- a/utility/generate_specenum.py +++ b/utility/generate_specenum.py @@ -339,7 +339,7 @@ static inline bool SPECENUM_FOO(_is_valid)(enum SPECENUM_NAME enumerator) FC_STATIC_ASSERT(ARRAY_SIZE(valid) == SPECENUM_SIZE, valid_array_size_check); - return (enumerator < ARRAY_SIZE(valid) + return ((unsigned)enumerator < ARRAY_SIZE(valid) && valid[enumerator]); #endif /* SPECENUM_BITWISE */ } @@ -484,7 +484,7 @@ static inline const char *SPECENUM_FOO(_name)(enum SPECENUM_NAME enumerator) } } #else - if (enumerator < ARRAY_SIZE(names)) { + if ((unsigned)enumerator < ARRAY_SIZE(names)) { return names[enumerator]; } #endif /* SPECENUM_BITWISE */ @@ -596,7 +596,7 @@ SPECENUM_FOO(_translated_name)(enum SPECENUM_NAME enumerator) } } #else - if (enumerator < ARRAY_SIZE(names)) { + if ((unsigned)enumerator < ARRAY_SIZE(names)) { return names[enumerator]; } #endif /* SPECENUM_BITWISE */ -- 2.35.1