[hackers] [scc] Allow empty declarations in structures || Roberto E. Vargas Caballero
commit f6df05343dbc81b5f3f8f1fa129007b3dd4a47fc
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Mon Aug 10 23:28:30 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Mon Aug 10 23:28:30 2015 +0200
Allow empty declarations in structures
Declarations, of any type, without identifier means nothing,
so they must be ignored, even in field declarations.
diff --git a/cc1/decl.c b/cc1/decl.c
index 35814ac..f072110 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
_AT_@ -450,11 +450,13 @@ field(Symbol *sym, Type *tp, unsigned ns, int sclass, Type *data)
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)
Received on Mon Aug 10 2015 - 23:29:58 CEST
This archive was generated by hypermail 2.3.0
: Mon Aug 10 2015 - 23:36:11 CEST