{
/* check the declaration */
- checkDecl (lval->sym);
+ checkDecl (lval->sym, 0);
/* if this a register parm then allocate
it as a local variable by adding it
csym = sym;
/* check the declaration */
- checkDecl (csym);
+ checkDecl (csym,0);
/* if this is a function or a pointer to function */
/* then args processing */
}
}
else {
- checkDecl (loop);
+ checkDecl (loop, 1);
sum += getSize (loop->type);
}
/* checkSClass - check the storage class specification */
/*------------------------------------------------------------------*/
static void
-checkSClass (symbol * sym)
+checkSClass (symbol * sym, int isProto)
{
if (getenv("DEBUG_SANITY")) {
fprintf (stderr, "checkSClass: %s \n", sym->name);
SPEC_BSTR (sym->etype) = 0;
}
- /* variables declared in CODE space must have */
- /* initializers if not an extern */
- if (SPEC_SCLS (sym->etype) == S_CODE &&
- sym->ival == NULL &&
- !sym->level &&
- port->mem.code_ro &&
- !IS_EXTERN (sym->etype) &&
- !funcInChain (sym->type))
- werror (E_CODE_NO_INIT, sym->name);
+ if (!isProto) {
+ /* variables declared in CODE space must have */
+ /* initializers if not an extern */
+ if (SPEC_SCLS (sym->etype) == S_CODE &&
+ sym->ival == NULL &&
+ !sym->level &&
+ port->mem.code_ro &&
+ !IS_EXTERN (sym->etype) &&
+ !funcInChain (sym->type))
+ werror (E_CODE_NO_INIT, sym->name);
+ }
/* if parameter or local variable then change */
/* the storage class to reflect where the var will go */
/* checkDecl - does semantic validation of a declaration */
/*------------------------------------------------------------------*/
int
-checkDecl (symbol * sym)
+checkDecl (symbol * sym, int isProto)
{
- checkSClass (sym); /* check the storage class */
+ checkSClass (sym, isProto); /* check the storage class */
changePointer (sym); /* change pointers if required */
/* if this is an array without any dimension
char *genSymName (int);
int compStructSize (int, structdef *);
sym_link *copyLinkChain (sym_link *);
-int checkDecl (symbol *);
+int checkDecl (symbol *, int);
void checkBasic (sym_link *, sym_link *);
value *checkPointerIval (sym_link *, value *);
value *checkStructIval (symbol *, value *);