commit a3b5f660162332d204a73fdd2d5c40f95f1770cd
parent 89d7c924ded8f936c9e2e48ac467f1f14869620a
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Mon, 28 Oct 2013 20:03:04 +0100
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.
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/decl.c b/decl.c
@@ -327,7 +327,8 @@ repeat: if (!(base = specifier())) {
} 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 @@ repeat: if (!(base = specifier())) {
warn(options.useless,
"unnamed struct/union that defines no instances");
}
- } else {
+ default:
warn(options.useless,
"useless type name in empty declaration");
}