shithub: scc

Download patch

ref: f6df05343dbc81b5f3f8f1fa129007b3dd4a47fc
parent: a6cab76f9a90a0dbadf789b1b68aa0c05fc90ff7
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Aug 10 19:28:30 EDT 2015

Allow empty declarations in structures

Declarations, of any type, without identifier means nothing,
so they must be ignored, even in field declarations.

--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -450,11 +450,13 @@
 	size_t n = funtp->n.elem;
 	char *name = sym->name;
 
+	if (!name) {
+		sym->type = tp;
+		warn("empty declaration");
+		return sym;
+	}
 	if (sclass)
 		error("storage class in struct/union field");
-	if (!sym->name)
-		error("missed identifier in field declaration");
-
 	if (tp->op == FTN)
 		error("invalid type in struct/union");
 	if (!tp->defined)