ref: a3b5f660162332d204a73fdd2d5c40f95f1770cd
parent: 89d7c924ded8f936c9e2e48ac467f1f14869620a
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon Oct 28 16:03:04 EDT 2013
Change a complex if sequence for a switch We were testing the value of a variable against different cases and switch does a better work in these kind of cases, so changeit.
--- a/decl.c
+++ b/decl.c
@@ -327,7 +327,8 @@
} else if (accept(';')) {
register unsigned char type = base->type;
- if (type == STRUCT || type == UNION || type == ENUM) {
+ switch (type) {
+ case STRUCT: case UNION: case ENUM:
if (HAS_STORAGE(base) || HAS_QUALIF(base)) {
warn(options.useless,
"useless storage class specifier in empty declaration");
@@ -336,7 +337,7 @@
warn(options.useless,
"unnamed struct/union that defines no instances");
}
- } else {
+ default:
warn(options.useless,
"useless type name in empty declaration");
}