From 299c9762b1dbe53f3297c54e5526aeae767d1a10 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 11 Dec 2022 10:24:13 -0800 Subject: Use unsigned ints when shifting to create bitmasks symbols.c:1057:28: portability: Shifting signed 32-bit value by 31 bits is implementation-defined behaviour. See condition at line 1049. [shiftTooManyBitsSigned] radio_groups |= (1 << (tmp.uval - 1)); ^ symbols.c:1049:41: note: Assuming that condition 'tmp.uval>32' is not redundant if ((tmp.uval < 1) || (tmp.uval > XkbMaxRadioGroups)) ^ symbols.c:1057:28: note: Shift radio_groups |= (1 << (tmp.uval - 1)); ^ symbols.c:1057:28: warning: Either the condition 'tmp.uval>32' is redundant or there is signed integer overflow for expression '1<<(tmp.uval-1)'. [integerOverflowCond] radio_groups |= (1 << (tmp.uval - 1)); ^ symbols.c:1049:41: note: Assuming that condition 'tmp.uval>32' is not redundant if ((tmp.uval < 1) || (tmp.uval > XkbMaxRadioGroups)) ^ symbols.c:1057:28: note: Integer overflow radio_groups |= (1 << (tmp.uval - 1)); ^ Signed-off-by: Alan Coopersmith --- vmod.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'vmod.c') diff --git a/vmod.c b/vmod.c index 17aa7a7..4e591cd 100644 --- a/vmod.c +++ b/vmod.c @@ -137,9 +137,9 @@ HandleVModDef(VModDef * stmt, unsigned mergeMode, VModInfo * info) ACTION("Exiting\n"); return False; } - info->defined |= (1 << nextFree); - info->newlyDefined |= (1 << nextFree); - info->available |= (1 << nextFree); + info->defined |= (1U << nextFree); + info->newlyDefined |= (1U << nextFree); + info->available |= (1U << nextFree); names->vmods[nextFree] = stmtName; if (stmt->value == NULL) return True; @@ -217,7 +217,7 @@ LookupVModMask(XPointer priv, if (LookupVModIndex(priv, elem, field, type, val_rtrn)) { unsigned ndx = val_rtrn->uval; - val_rtrn->uval = (1 << (XkbNumModifiers + ndx)); + val_rtrn->uval = (1U << (XkbNumModifiers + ndx)); return True; } return False; -- cgit v1.2.3