bucket *bp; /* temp bucket * */
if (checkType) {
+ symbol *csym = (symbol *)sym;
+
if (getenv("DEBUG_SANITY")) {
fprintf (stderr, "addSym: %s ", sname);
}
/* make sure the type is complete and sane */
- checkTypeSanity(((symbol *)sym)->etype, ((symbol *)sym)->name);
+ checkTypeSanity(csym->etype, csym->name);
}
/* prevent overflow of the (r)name buffers */
sym_link *tail;
sym_link *t;
+ if (getenv("SDCC_DEBUG_FUNCTION_POINTERS"))
+ fprintf (stderr, "SDCCsymt.c:addDecl(%s,%d,%p)\n", sym->name, type, p);
+
/* if we are passed a link then set head & tail */
if (p)
{
SPEC_VOLATILE (sym->etype) = SPEC_VOLATILE (DCL_TSPEC (p));
DCL_TSPEC (p) = NULL;
}
+
+ // if there is a function in this type chain
+ if (p && funcInChain(sym->type)) {
+ processFuncArgs (sym);
+ }
+
return;
}
sum += getSize (loop->type);
}
+#if 0 // jwk: this is done now in addDecl()
/* if function then do the arguments for it */
if (funcInChain (loop->type)) {
- processFuncArgs (loop, 1);
+ processFuncArgs (loop);
}
+#endif
loop = loop->next;
DCL_TYPE (val->type) = PPOINTER;
break;
case S_FIXED:
- if (SPEC_OCLS(val->etype)) {
DCL_TYPE(val->type)=PTR_TYPE(SPEC_OCLS(val->etype));
- break;
- }
if (TARGET_IS_DS390)
{
DCL_TYPE (val->type) = FPOINTER;
break;
}
- /* fall through! */
+ break;
case S_AUTO:
case S_DATA:
case S_REGISTER:
/* processFuncArgs - does some processing with function args */
/*-----------------------------------------------------------------*/
void
-processFuncArgs (symbol * func, int ignoreName)
+processFuncArgs (symbol * func)
{
value *val;
int pNum = 1;
sym_link *funcType=func->type;
+ if (getenv("SDCC_DEBUG_FUNCTION_POINTERS"))
+ fprintf (stderr, "SDCCsymt.c:processFuncArgs(%s)\n", func->name);
+
// if this is a pointer to a function
- if (DCL_TYPE(funcType)==CPOINTER) {
+ if (IS_PTR(funcType)) {
funcType=funcType->next;
}
{
aggregateToPointer (val);
}
+
val = val->next;
pNum++;
}
}
if (start==NULL) {
- fprintf (of, "**err**");
+ fprintf (of, "void");
return;
}
case GPOINTER:
if (DCL_PTR_CONST (type))
fprintf (of, "const ");
- fprintf (of, "* generic ");
+ fprintf (of, "generic * ");
break;
case CPOINTER:
if (DCL_PTR_CONST (type))
fprintf (of, "const ");
- fprintf (of, "* code ");
+ fprintf (of, "code * ");
break;
case FPOINTER:
if (DCL_PTR_CONST (type))
fprintf (of, "const ");
- fprintf (of, "* xdata ");
+ fprintf (of, "xdata * ");
break;
case EEPPOINTER:
if (DCL_PTR_CONST (type))
fprintf (of, "const ");
- fprintf (of, "* eeprom ");
+ fprintf (of, "eeprom * ");
break;
case POINTER:
if (DCL_PTR_CONST (type))
fprintf (of, "const ");
- fprintf (of, "* near ");
+ fprintf (of, "near *");
break;
case IPOINTER:
if (DCL_PTR_CONST (type))
fprintf (of, "const ");
- fprintf (of, "* idata ");
+ fprintf (of, "idata * ");
break;
case PPOINTER:
if (DCL_PTR_CONST (type))
fprintf (of, "const ");
- fprintf (of, "* pdata ");
+ fprintf (of, "pdata * ");
break;
case UPOINTER:
if (DCL_PTR_CONST (type))
fprintf (of, "const ");
- fprintf (of, "* unkown ");
+ fprintf (of, "unkown * ");
break;
case ARRAY:
fprintf (of, "[] ");