summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-10 09:08:33 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-10 09:08:33 -0800
commitb67c058e2ccc27472b238a6b5dc5e4cd20f6d2bd (patch)
tree8eb225f654ff9fab0a0434be84f72dc3fe7066d4
parent634f60a9b25b5d03c78e90574adce3e38f378333 (diff)
Eliminate 20 -Wimplicit-fallthrough warnings
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--expr.c85
-rw-r--r--geometry.c17
2 files changed, 54 insertions, 48 deletions
diff --git a/expr.c b/expr.c
index 3555d64..12cff10 100644
--- a/expr.c
+++ b/expr.c
@@ -443,23 +443,24 @@ ExprResolveBoolean(ExprDef * expr,
val_rtrn->uval = !val_rtrn->uval;
return ok;
case OpAdd:
- if (bogus == NULL)
- bogus = "Addition";
+ bogus = "Addition";
+ goto boolean;
case OpSubtract:
- if (bogus == NULL)
- bogus = "Subtraction";
+ bogus = "Subtraction";
+ goto boolean;
case OpMultiply:
- if (bogus == NULL)
- bogus = "Multiplication";
+ bogus = "Multiplication";
+ goto boolean;
case OpDivide:
- if (bogus == NULL)
- bogus = "Division";
+ bogus = "Division";
+ goto boolean;
case OpAssign:
- if (bogus == NULL)
- bogus = "Assignment";
+ bogus = "Assignment";
+ goto boolean;
case OpNegate:
- if (bogus == NULL)
- bogus = "Negation";
+ bogus = "Negation";
+ goto boolean;
+ boolean:
ERROR("%s of boolean values not permitted\n", bogus);
break;
case OpUnaryPlus:
@@ -774,23 +775,24 @@ ExprResolveString(ExprDef * expr,
}
return False;
case OpSubtract:
- if (bogus == NULL)
- bogus = "Subtraction";
+ bogus = "Subtraction";
+ goto string;
case OpMultiply:
- if (bogus == NULL)
- bogus = "Multiplication";
+ bogus = "Multiplication";
+ goto string;
case OpDivide:
- if (bogus == NULL)
- bogus = "Division";
+ bogus = "Division";
+ goto string;
case OpAssign:
- if (bogus == NULL)
- bogus = "Assignment";
+ bogus = "Assignment";
+ goto string;
case OpNegate:
- if (bogus == NULL)
- bogus = "Negation";
+ bogus = "Negation";
+ goto string;
case OpInvert:
- if (bogus == NULL)
- bogus = "Bitwise complement";
+ bogus = "Bitwise complement";
+ goto string;
+ string:
ERROR("%s of string values not permitted\n", bogus);
return False;
case OpNot:
@@ -858,26 +860,27 @@ ExprResolveKeyName(ExprDef * expr,
XkbAtomText(NULL, expr->value.field.field, XkbMessage));
return ok;
case OpAdd:
- if (bogus == NULL)
- bogus = "Addition";
+ bogus = "Addition";
+ goto keyname;
case OpSubtract:
- if (bogus == NULL)
- bogus = "Subtraction";
+ bogus = "Subtraction";
+ goto keyname;
case OpMultiply:
- if (bogus == NULL)
- bogus = "Multiplication";
+ bogus = "Multiplication";
+ goto keyname;
case OpDivide:
- if (bogus == NULL)
- bogus = "Division";
+ bogus = "Division";
+ goto keyname;
case OpAssign:
- if (bogus == NULL)
- bogus = "Assignment";
+ bogus = "Assignment";
+ goto keyname;
case OpNegate:
- if (bogus == NULL)
- bogus = "Negation";
+ bogus = "Negation";
+ goto keyname;
case OpInvert:
- if (bogus == NULL)
- bogus = "Bitwise complement";
+ bogus = "Bitwise complement";
+ goto keyname;
+ keyname:
ERROR("%s of key name values not permitted\n", bogus);
return False;
case OpNot:
@@ -979,9 +982,11 @@ ExprResolveMask(ExprDef * expr,
return ok;
case ExprArrayRef:
bogus = "array reference";
+ goto unexpected_mask;
case ExprActionDecl:
- if (bogus == NULL)
- bogus = "function use";
+ bogus = "function use";
+ goto unexpected_mask;
+ unexpected_mask:
ERROR("Unexpected %s in mask expression\n", bogus);
ACTION("Expression ignored\n");
return False;
diff --git a/geometry.c b/geometry.c
index 91ab244..a5bf70c 100644
--- a/geometry.c
+++ b/geometry.c
@@ -2884,17 +2884,18 @@ HandleGeometryFile(XkbFile * file,
info->errorCount++;
break;
case StmtVModDef:
- if (!failWhat)
- failWhat = "virtual modifier";
+ failWhat = "virtual modifier";
+ goto fail;
case StmtInterpDef:
- if (!failWhat)
- failWhat = "symbol interpretation";
+ failWhat = "symbol interpretation";
+ goto fail;
case StmtGroupCompatDef:
- if (!failWhat)
- failWhat = "group compatibility map";
+ failWhat = "group compatibility map";
+ goto fail;
case StmtKeycodeDef:
- if (!failWhat)
- failWhat = "key name";
+ failWhat = "key name";
+ goto fail;
+ fail:
ERROR("Interpretation files may not include other types\n");
ACTION("Ignoring %s definition.\n", failWhat);
info->errorCount++;