+ /* check the return value type */
+ if (compareType (csym->type, sym->type) <= 0)
+ {
+ werror (E_PREV_DEF_CONFLICT, csym->name, "type");
+ printFromToType(csym->type, sym->type);
+ return 0;
+ }
+
+ if (FUNC_ISISR (csym->type) != FUNC_ISISR (sym->type))
+ {
+ werror (E_PREV_DEF_CONFLICT, csym->name, "interrupt");
+ }
+
+ if (FUNC_REGBANK (csym->type) != FUNC_REGBANK (sym->type))
+ {
+ werror (E_PREV_DEF_CONFLICT, csym->name, "using");
+ }
+
+ if (IFFUNC_ISNAKED (csym->type) != IFFUNC_ISNAKED (sym->type))
+ {
+ werror (E_PREV_DEF_CONFLICT, csym->name, "_naked");
+ }
+
+ /* Really, reentrant should match regardless of argCnt, but */
+ /* this breaks some existing code (the fp lib functions). If */
+ /* the first argument is always passed the same way, this */
+ /* lax checking is ok (but may not be true for in future ports) */
+ if (IFFUNC_ISREENT (csym->type) != IFFUNC_ISREENT (sym->type)
+ && argCnt>1)
+ {
+ //printf("argCnt = %d\n",argCnt);
+ werror (E_PREV_DEF_CONFLICT, csym->name, "reentrant");
+ }
+
+ /* compare expected args with actual args */
+ exargs = FUNC_ARGS(csym->type);
+ acargs = FUNC_ARGS(sym->type);
+
+ /* for all the expected args do */
+ for (argCnt = 1;
+ exargs && acargs;
+ exargs = exargs->next, acargs = acargs->next, argCnt++)
+ {
+ if (getenv("DEBUG_SANITY")) {
+ fprintf (stderr, "checkFunction: %s ", exargs->name);
+ }
+ /* make sure the type is complete and sane */
+ checkTypeSanity(exargs->etype, exargs->name);
+
+ /* If the actual argument is an array, any prototype
+ * will have modified it to a pointer. Duplicate that
+ * change here.
+ */
+ if (IS_AGGREGATE (acargs->type))
+ {
+ checkValue = copyValue (acargs);
+ aggregateToPointer (checkValue);
+ }
+ else
+ {
+ checkValue = acargs;
+ }
+
+ if (compareType (exargs->type, checkValue->type) <= 0)
+ {
+ werror (E_ARG_TYPE, argCnt);
+ printFromToType(exargs->type, checkValue->type);
+ return 0;
+ }
+ }
+
+ /* if one them ended we have a problem */
+ if ((exargs && !acargs && !IS_VOID (exargs->type)) ||
+ (!exargs && acargs && !IS_VOID (acargs->type)))
+ werror (E_ARG_COUNT);
+
+ /* replace with this defition */
+ sym->cdef = csym->cdef;
+ deleteSym (SymbolTab, csym, csym->name);
+ deleteFromSeg(csym);
+ addSym (SymbolTab, sym, sym->name, sym->level, sym->block, 1);
+ if (IS_EXTERN (csym->etype) && !
+ IS_EXTERN (sym->etype))
+ {
+ addSet (&publics, sym);
+ }
+ return 1;
+}
+
+/*------------------------------------------------------------------*/
+/* cdbStructBlock - calls struct printing for a blcks */
+/*------------------------------------------------------------------*/
+void cdbStructBlock (int block)
+{
+ int i;
+ bucket **table = StructTab;
+ bucket *chain;
+
+ /* go thru the entire table */
+ for (i = 0; i < 256; i++)
+ {
+ for (chain = table[i]; chain; chain = chain->next)
+ {
+ if (chain->block >= block)
+ {
+ if(debugFile)
+ debugFile->writeType((structdef *)chain->sym, chain->block, 0, NULL);
+ }