[hackers] [scc] Simplify arydcl() || Roberto E. Vargas Caballero
commit 2f555ae12510f6214164f4e85f49ea2127d3c935
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Tue Sep 15 12:03:02 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Tue Sep 15 12:03:02 2015 +0200
Simplify arydcl()
diff --git a/cc1/decl.c b/cc1/decl.c
index d213198..4eb1003 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
_AT_@ -96,26 +96,21 @@ static void
arydcl(struct declarators *dp)
{
Node *np = NULL;
- TINT n;
+ TINT n = 0;
expect('[');
if (yytoken != ']') {
- if ((np = iconstexpr()) == NULL)
- error("invalid storage size");
- }
- expect(']');
-
- if (np != NULL) {
- n = np->sym->u.i;
- if (n == 0 || n < 0) {
- errorp("array size is not a positive number");
- n = 1;
+ if ((np = iconstexpr()) == NULL) {
+ errorp("invalid storage size");
+ } else {
+ if ((n = np->sym->u.i) <= 0) {
+ errorp("array size is not a positive number");
+ n = 1;
+ }
+ freetree(np);
}
- } else {
- n = 0;
}
-
- freetree(np);
+ expect(']');
push(dp, ARY, n);
}
Received on Tue Sep 15 2015 - 12:37:11 CEST
This archive was generated by hypermail 2.3.0
: Tue Sep 15 2015 - 12:48:11 CEST