From: erikb Date: Mon, 28 Apr 1986 09:56:33 +0000 (+0000) Subject: various small layout corrections X-Git-Tag: release-5-5~5298 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=dd5b8dfabfc3e8753d91838aaf8867ca2ec020aa;p=ack.git various small layout corrections --- diff --git a/lang/cem/cemcom/declarator.c b/lang/cem/cemcom/declarator.c index 27a9d88c8..4eb1a32fe 100644 --- a/lang/cem/cemcom/declarator.c +++ b/lang/cem/cemcom/declarator.c @@ -99,6 +99,11 @@ array_subscript(expr) expr->VL_VALUE = (arith)1; } else + if (size == 0) { + warning("empty array declaration"); + expr->VL_VALUE = (arith)-1; + } + else if (size & ~max_unsigned) { /* absolute ridiculous */ expr_error(expr, "overflow in array size"); expr->VL_VALUE = (arith)1; diff --git a/lang/cem/cemcom/error.c b/lang/cem/cemcom/error.c index 054ee73b3..6ada030ec 100644 --- a/lang/cem/cemcom/error.c +++ b/lang/cem/cemcom/error.c @@ -28,7 +28,7 @@ #define CRASH 5 #define FATAL 6 -int err_occurred; +int err_occurred = 0; extern char *symbol2str(); extern char options[]; diff --git a/lang/cem/cemcom/main.c b/lang/cem/cemcom/main.c index 0cf9425d0..feb464914 100644 --- a/lang/cem/cemcom/main.c +++ b/lang/cem/cemcom/main.c @@ -89,10 +89,11 @@ main(argc, argv) not defined! */ #ifdef READ_IN_ONE - while (argc > 1 && *argv[1] == '-') { + while (argc > 1 && *argv[1] == '-') #else READ_IN_ONE - while (argc > 1 && *argv[1] == '-' && argv[1][1] != '\0') { + while (argc > 1 && *argv[1] == '-' && argv[1][1] != '\0') #endif READ_IN_ONE + { char *par = &argv[1][1]; if (*par == '-') diff --git a/lang/cem/cemcom/stack.c b/lang/cem/cemcom/stack.c index 26a849e2f..8f939230f 100644 --- a/lang/cem/cemcom/stack.c +++ b/lang/cem/cemcom/stack.c @@ -194,7 +194,7 @@ unstack_world() have already been encoded while the uninitialised ones are not and have to be encoded at this moment. */ - struct stack_entry *se = local_level->sl_entry; + register struct stack_entry *se = local_level->sl_entry; open_name_list(); @@ -223,11 +223,12 @@ unstack_world() def->df_used ? "used" : "not used"); } #endif DEBUG - /* find final storage class */ - if (def->df_sc == GLOBAL || def->df_sc == IMPLICIT) { - /* even now we still don't know */ + /* + /_* find final storage class *_/ + if (def->df_sc == GLOBAL || def->df_sc == IMPLICIT) + /_* even now we still don't know *_/ def->df_sc = EXTERN; - } + */ if ( def->df_sc == STATIC && def->df_type->tp_fund == FUNCTION @@ -242,28 +243,27 @@ unstack_world() def->df_sc = EXTERN; } - if ( def->df_alloc == ALLOC_SEEN && + if ( + def->df_alloc == ALLOC_SEEN && !def->df_initialized ) { /* space must be allocated */ bss(idf); namelist(idf->id_text); /* may be common */ - def->df_alloc = ALLOC_DONE; - /* df_alloc must be set to ALLOC_DONE because - the idf entry may occur several times in - the list. - The reason is that the same name may be used - for different purposes on the same level, e.g - struct s {int s;} s; - is a legal definition and contains 3 defining - occurrences of s. Each definition has been - entered into the idfstack. Although only - one of them concerns a variable, we meet the - s 3 times when scanning the idfstack. - */ + def->df_alloc = ALLOC_DONE; /* *) */ } se = se->next; } + /* *) df_alloc must be set to ALLOC_DONE because the idf entry + may occur several times in the list. + The reason for this is that the same name may be used + for different purposes on the same level, e.g + struct s {int s;} s; + is a legal definition and contains 3 defining occurrences of s. + Each definition has been entered into the idfstack. + Although only one of them concerns a variable, we meet the + s 3 times when scanning the idfstack. + */ } /* A list of potential common names is kept, to be fed to