shithub: scc

Download patch

ref: 58149ef559f52ec3e1604513f15c776f59065eca
parent: c9a50478a9b995cf12d91edb32cf9e4dda528a31
author: Roberto E. Vargas Caballero <[email protected]>
date: Sat Nov 2 03:28:27 EDT 2013

Remove wrong warnings in struct/union/enum declaration

These warning were incorrects and they were caused by an incorrect
dealing of empty declarations. This new version deals them correctly.

--- a/decl.c
+++ b/decl.c
@@ -351,7 +351,12 @@
 		register unsigned char type = base.type;
 
 		switch (type) {
-		case STRUCT: case UNION: case ENUM:
+		case STRUCT: case UNION:
+			if (!base.sym) {
+				warn(options.useless,
+				     "unnamed struct/union that defines no instances");
+			}
+		case ENUM:
 			if (store.defined) {
 				warn(options.useless,
 				     "useless storage class specifier in empty declaration");
@@ -360,14 +365,13 @@
 				warn(options.useless,
 				     "useless type qualifier in empty declaration");
 			}
-			if (base.sym && type != ENUM) {
-				warn(options.useless,
-				     "unnamed struct/union that defines no instances");
-			}
+			break;
 		default:
 			warn(options.useless,
 			     "useless type name in empty declaration");
 		}
+		if (yytoken == EOFTOK)
+			return NULL;
 		goto repeat;
 	}
 	np = listdcl(&base, &store, &qlf);