diff options
Diffstat (limited to 'tools/codegen/core/gen_legal_metadata_characters.c')
-rw-r--r-- | tools/codegen/core/gen_legal_metadata_characters.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/codegen/core/gen_legal_metadata_characters.c b/tools/codegen/core/gen_legal_metadata_characters.c index 2ffda54a21..677fa5c155 100644 --- a/tools/codegen/core/gen_legal_metadata_characters.c +++ b/tools/codegen/core/gen_legal_metadata_characters.c @@ -41,7 +41,12 @@ static unsigned char legal_bits[256 / 8]; static void legal(int x) { int byte = x / 8; int bit = x % 8; - legal_bits[byte] |= (unsigned char)(1 << bit); + /* NB: the following integer arithmetic operation needs to be in its + * expanded form due to the "integral promotion" performed (see section + * 3.2.1.1 of the C89 draft standard). A cast to the smaller container type + * is then required to avoid the compiler warning */ + legal_bits[byte] = + (unsigned char)((legal_bits[byte] | (unsigned char)(1 << bit))); } static void dump(void) { |