various small layout corrections

This commit is contained in:
erikb 1986-04-28 09:56:33 +00:00
parent 4173e3c487
commit dd5b8dfabf
4 changed files with 28 additions and 22 deletions

View file

@ -99,6 +99,11 @@ array_subscript(expr)
expr->VL_VALUE = (arith)1; expr->VL_VALUE = (arith)1;
} }
else else
if (size == 0) {
warning("empty array declaration");
expr->VL_VALUE = (arith)-1;
}
else
if (size & ~max_unsigned) { /* absolute ridiculous */ if (size & ~max_unsigned) { /* absolute ridiculous */
expr_error(expr, "overflow in array size"); expr_error(expr, "overflow in array size");
expr->VL_VALUE = (arith)1; expr->VL_VALUE = (arith)1;

View file

@ -28,7 +28,7 @@
#define CRASH 5 #define CRASH 5
#define FATAL 6 #define FATAL 6
int err_occurred; int err_occurred = 0;
extern char *symbol2str(); extern char *symbol2str();
extern char options[]; extern char options[];

View file

@ -89,10 +89,11 @@ main(argc, argv)
not defined! not defined!
*/ */
#ifdef READ_IN_ONE #ifdef READ_IN_ONE
while (argc > 1 && *argv[1] == '-') { while (argc > 1 && *argv[1] == '-')
#else READ_IN_ONE #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 #endif READ_IN_ONE
{
char *par = &argv[1][1]; char *par = &argv[1][1];
if (*par == '-') if (*par == '-')

View file

@ -194,7 +194,7 @@ unstack_world()
have already been encoded while the uninitialised ones have already been encoded while the uninitialised ones
are not and have to be encoded at this moment. 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(); open_name_list();
@ -223,11 +223,12 @@ unstack_world()
def->df_used ? "used" : "not used"); def->df_used ? "used" : "not used");
} }
#endif DEBUG #endif DEBUG
/* find final storage class */ /*
if (def->df_sc == GLOBAL || def->df_sc == IMPLICIT) { /_* find final storage class *_/
/* even now we still don't know */ if (def->df_sc == GLOBAL || def->df_sc == IMPLICIT)
/_* even now we still don't know *_/
def->df_sc = EXTERN; def->df_sc = EXTERN;
} */
if ( def->df_sc == STATIC if ( def->df_sc == STATIC
&& def->df_type->tp_fund == FUNCTION && def->df_type->tp_fund == FUNCTION
@ -242,28 +243,27 @@ unstack_world()
def->df_sc = EXTERN; def->df_sc = EXTERN;
} }
if ( def->df_alloc == ALLOC_SEEN && if (
def->df_alloc == ALLOC_SEEN &&
!def->df_initialized !def->df_initialized
) { ) {
/* space must be allocated */ /* space must be allocated */
bss(idf); bss(idf);
namelist(idf->id_text); /* may be common */ namelist(idf->id_text); /* may be common */
def->df_alloc = ALLOC_DONE; 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.
*/
} }
se = se->next; 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 /* A list of potential common names is kept, to be fed to