summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-10-08 12:45:41 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-10-08 12:45:41 -0700
commit4e7bae89a887b189aa4c5e551ce0fba4a763df1a (patch)
tree03f0ed8d0d527cd71286538b25cace47311988a5
parent8f5e188675d81a8310a1f50f0675a7d421cc53e9 (diff)
DefaultParser: avoid -Wimplicit-fallthrough warnings
Clears up 24 warnings from gcc 12 of the form: xkbconfig.c: In function ‘DefaultParser’: xkbconfig.c:469:36: warning: this statement may fall through [-Wimplicit-fallthrough=] 469 | case _XkbCF_RulesFile: if (!str) str = &rtrn->rules_file; | ^ xkbconfig.c:470:5: note: here 470 | case _XkbCF_Model: if (!str) str = &rtrn->model; | ^~~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/xkbconfig.c66
1 files changed, 34 insertions, 32 deletions
diff --git a/src/xkbconfig.c b/src/xkbconfig.c
index 3bbb837..0e2bd44 100644
--- a/src/xkbconfig.c
+++ b/src/xkbconfig.c
@@ -466,18 +466,20 @@ DefaultParser(FILE * file,
onoff = 0;
pival = NULL;
switch (field->field_id) {
- case _XkbCF_RulesFile: if (!str) str = &rtrn->rules_file;
- case _XkbCF_Model: if (!str) str = &rtrn->model;
- case _XkbCF_Layout: if (!str) str = &rtrn->layout;
- case _XkbCF_Variant: if (!str) str = &rtrn->variant;
- case _XkbCF_Options: if (!str) str = &rtrn->options;
- case _XkbCF_Keymap: if (!str) str = &rtrn->keymap;
- case _XkbCF_Keycodes: if (!str) str = &rtrn->keycodes;
- case _XkbCF_Geometry: if (!str) str = &rtrn->geometry;
- case _XkbCF_PhysSymbols: if (!str) str = &rtrn->phys_symbols;
- case _XkbCF_Symbols: if (!str) str = &rtrn->symbols;
- case _XkbCF_Types: if (!str) str = &rtrn->types;
- case _XkbCF_CompatMap: if (!str) str = &rtrn->compat;
+ case _XkbCF_RulesFile: str = &rtrn->rules_file; goto process_str;
+ case _XkbCF_Model: str = &rtrn->model; goto process_str;
+ case _XkbCF_Layout: str = &rtrn->layout; goto process_str;
+ case _XkbCF_Variant: str = &rtrn->variant; goto process_str;
+ case _XkbCF_Options: str = &rtrn->options; goto process_str;
+ case _XkbCF_Keymap: str = &rtrn->keymap; goto process_str;
+ case _XkbCF_Keycodes: str = &rtrn->keycodes; goto process_str;
+ case _XkbCF_Geometry: str = &rtrn->geometry; goto process_str;
+ case _XkbCF_PhysSymbols: str = &rtrn->phys_symbols; goto process_str;
+ case _XkbCF_Symbols: str = &rtrn->symbols; goto process_str;
+ case _XkbCF_Types: str = &rtrn->types; goto process_str;
+ case _XkbCF_CompatMap: str = &rtrn->compat; goto process_str;
+
+ process_str:
if (tok != XkbCF_Equals) {
rtrn->error = XkbCF_MissingEquals;
goto BAILOUT;
@@ -732,27 +734,27 @@ DefaultParser(FILE * file,
}
break;
case _XkbCF_ClickVolume:
- if (!pival) {
- pival = &rtrn->click_volume;
- onoff = 100;
- }
+ pival = &rtrn->click_volume;
+ onoff = 100;
+ goto pival;
case _XkbCF_BellVolume:
- if (!pival) {
- pival = &rtrn->bell_volume;
- onoff = 100;
- }
- case _XkbCF_BellPitch: if (!pival) pival = &rtrn->bell_pitch;
- case _XkbCF_BellDuration: if (!pival) pival = &rtrn->bell_duration;
- case _XkbCF_RepeatDelay: if (!pival) pival = &rtrn->repeat_delay;
- case _XkbCF_RepeatInterval: if (!pival) pival = &rtrn->repeat_interval;
- case _XkbCF_SlowKeysDelay: if (!pival) pival = &rtrn->slow_keys_delay;
- case _XkbCF_DebounceDelay: if (!pival) pival = &rtrn->debounce_delay;
- case _XkbCF_MouseKeysDelay: if (!pival) pival = &rtrn->mk_delay;
- case _XkbCF_MouseKeysInterval: if (!pival) pival = &rtrn->mk_interval;
- case _XkbCF_MouseKeysTimeToMax: if (!pival) pival = &rtrn->mk_time_to_max;
- case _XkbCF_MouseKeysMaxSpeed: if (!pival) pival = &rtrn->mk_max_speed;
- case _XkbCF_MouseKeysCurve: if (!pival) pival = &rtrn->mk_curve;
- case _XkbCF_AccessXTimeout: if (!pival) pival = &rtrn->ax_timeout;
+ pival = &rtrn->bell_volume;
+ onoff = 100;
+ goto pival;
+ case _XkbCF_BellPitch: pival = &rtrn->bell_pitch; goto pival;
+ case _XkbCF_BellDuration: pival = &rtrn->bell_duration; goto pival;
+ case _XkbCF_RepeatDelay: pival = &rtrn->repeat_delay; goto pival;
+ case _XkbCF_RepeatInterval: pival = &rtrn->repeat_interval; goto pival;
+ case _XkbCF_SlowKeysDelay: pival = &rtrn->slow_keys_delay; goto pival;
+ case _XkbCF_DebounceDelay: pival = &rtrn->debounce_delay; goto pival;
+ case _XkbCF_MouseKeysDelay: pival = &rtrn->mk_delay; goto pival;
+ case _XkbCF_MouseKeysInterval: pival = &rtrn->mk_interval; goto pival;
+ case _XkbCF_MouseKeysTimeToMax: pival = &rtrn->mk_time_to_max; goto pival;
+ case _XkbCF_MouseKeysMaxSpeed: pival = &rtrn->mk_max_speed; goto pival;
+ case _XkbCF_MouseKeysCurve: pival = &rtrn->mk_curve; goto pival;
+ case _XkbCF_AccessXTimeout: pival = &rtrn->ax_timeout; goto pival;
+
+ pival:
if (tok != XkbCF_Equals) {
rtrn->error = XkbCF_MissingEquals;
goto BAILOUT;