+2003-10-09 Erik Petrich <epetrich@ivorytower.norman.ok.us>
+
+ * src/SDCCmain.c (setParseWithComma): fixed bug #816685
+ * src/z80/gen.c: fixed part of bug #817589
+ * src/SDCCsymt.c (checkFunction): fixed bug #817895
+
2003-10-08 Bernhard Held <bernhard@bernhardheld.de>
Replaced cast (void **) with (void *) to avoid gcc 3 warning:
#if !OPT_DISABLE_DS400
&ds400_port,
#endif
+ &hc08_port,
};
#define NUM_PORTS (sizeof(_ports)/sizeof(_ports[0]))
setParseWithComma (set **dest, char *src)
{
char *p;
+ int length;
/* skip the initial white spaces */
while (isspace(*src))
src++;
+
+ /* skip the trailing white spaces */
+ length = strlen(src);
+ while (length && isspace(src[length-1]))
+ src[--length] = '\0';
for (p = strtok(src, ","); p != NULL; p = strtok(NULL, ","))
addSet(dest, Safe_strdup(p));
/* standard library path */
if (!options.nostdlib)
{
- if (!(TARGET_IS_Z80 || TARGET_IS_GBZ80)) /*Not for the z80, gbz80*/
+ if (!(TARGET_IS_Z80 || TARGET_IS_GBZ80 || TARGET_IS_HC08)) /*Not for the z80, gbz80*/
{
switch (options.model)
{
}
else /*for the z80, gbz80*/
{
- if (TARGET_IS_Z80)
+ if (TARGET_IS_HC08)
+ c = "hc08";
+ else if (TARGET_IS_Z80)
c = "z80";
else
c = "gbz80";
}
#endif
#endif
- if (!(TARGET_IS_Z80 || TARGET_IS_GBZ80)) /*Not for the z80, gbz80*/
+ if (!(TARGET_IS_Z80 || TARGET_IS_GBZ80
+ || TARGET_IS_HC08)) /*Not for the z80, gbz80*/
{ /*Why the z80 port is not using the standard libraries?*/
fprintf (lnkfile, "-l %s\n", STD_LIB);
fprintf (lnkfile, "-l %s\n", STD_INT_LIB);
fprintf (lnkfile, "-l %s\n", STD_LONG_LIB);
fprintf (lnkfile, "-l %s\n", STD_FP_LIB);
}
+ else if (TARGET_IS_HC08)
+ {
+ fprintf (lnkfile, "-l hc08\n");
+ }
else if (TARGET_IS_Z80)
{
fprintf (lnkfile, "-l z80\n");
}
/*------------------------------------------------------------------*/
-/* structElemType - returns the type info of a sturct member */
+/* structElemType - returns the type info of a struct member */
/*------------------------------------------------------------------*/
sym_link *
structElemType (sym_link * stype, value * id)
werror(E_PARAM_NAME_OMITTED, sym->name, argCnt);
}
}
+ argCnt--;
if (!csym && !(csym = findSym (SymbolTab, sym, sym->name)))
return 1; /* not defined nothing more to check */
{
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);
bool in_home;
const char *lastFunctionName;
iCode *current_iCode;
-
+
set *sendSet;
struct
lineNode *head;
lineNode *current;
int isInline;
+ int isDebug;
allocTrace trace;
} lines;
(_G.lines.head = _newLineNode (buffer)));
_G.lines.current->isInline = _G.lines.isInline;
+ _G.lines.current->isDebug = _G.lines.isDebug;
_G.lines.current->ic = _G.current_iCode;
}
}
- /* Both baned and non-banked just ret */
+ if (options.debug && currFunc)
+ {
+ _G.lines.isDebug = 1;
+ sprintf (buffer, "C$%s$%d$%d$%d",
+ FileBaseName (ic->filename), currFunc->lastLine,
+ ic->level, ic->block);
+ emit2 ("!labeldef", buffer);
+ if (IS_STATIC (currFunc->etype))
+ sprintf (buffer, "XF%s$%s$0$0", moduleName, currFunc->name);
+ else
+ sprintf (buffer, "XG$%s$0$0", currFunc->name);
+ emit2 ("!labeldef", buffer);
+ _G.lines.isDebug = 0;
+ }
+
+ /* Both banked and non-banked just ret */
emit2 ("ret");
sprintf (buffer, "%s_end", sym->rname);
}
_G.lines.head = _G.lines.current = NULL;
+
+ /* if debug information required */
+ if (options.debug && currFunc)
+ {
+ debugFile->writeFunction(currFunc);
+ _G.lines.isDebug = 1;
+ if (IS_STATIC (currFunc->etype))
+ sprintf (buffer, "F%s$%s$0$0", moduleName, currFunc->name);
+ else
+ sprintf (buffer, "G$%s$0$0", currFunc->name);
+ emit2 ("!labeldef", buffer);
+ _G.lines.isDebug = 0;
+ }
for (ic = lic; ic; ic = ic->next)
{
_G.current_iCode = ic;
- if (cln != ic->lineno)
+ if (ic->lineno && cln != ic->lineno)
{
+ if (options.debug)
+ {
+ _G.lines.isDebug = 1;
+ sprintf (buffer, "C$%s$%d$%d$%d",
+ FileBaseName (ic->filename), ic->lineno,
+ ic->level, ic->block);
+ emit2 ("%s !equ .", buffer);
+ emit2 ("!global", buffer);
+ _G.lines.isDebug = 0;
+ }
if (!options.noCcodeInAsm) {
emit2 (";%s:%d: %s", ic->filename, ic->lineno,
printCLine(ic->filename, ic->lineno));