X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCerr.c;h=01a54d36d8d8f60d9bff849662b7ecfd84b23a19;hb=c9e40278469aa9b26090f1c3f03422d19161b669;hp=a3e4c31efc9de0ccdb286c89bdc688d79e971933;hpb=d60029bd3764d818d500e056a7b3e17ed0067731;p=fw%2Fsdcc diff --git a/src/SDCCerr.c b/src/SDCCerr.c index a3e4c31e..01a54d36 100644 --- a/src/SDCCerr.c +++ b/src/SDCCerr.c @@ -2,6 +2,14 @@ #include "common.h" +#define USE_STDOUT_FOR_ERRORS 0 + +#if USE_STDOUT_FOR_ERRORS +#define ERRSINK stdout +#else +#define ERRSINK stderr +#endif + #define ERROR 0 #define WARNING 1 extern FILE *lstFile; @@ -91,7 +99,7 @@ struct { { ERROR ,"error *** 'extern' variable '%s' cannot be initialised \n" }, { ERROR ,"error *** Pre-Processor %s\n" }, { ERROR ,"error *** _dup call failed\n" }, -{ ERROR ,"error *** pointer being cast to incompatible type \n" }, +{ WARNING,"warning *** pointer being cast to incompatible type \n" }, { WARNING,"warning *** 'while' loop with 'zero' constant.loop eliminated\n" }, { WARNING,"warning *** %s expression has NO side effects.expr eliminated\n" }, { WARNING,"warning *** constant value '%s', out of range.\n" }, @@ -144,24 +152,32 @@ struct { { WARNING,"warning *** possible code generation error at line %d,\n send source to sandeep.dutta@usa.net\n"}, { WARNING,"warning *** pointer types incompatible \n" }, { WARNING,"warning *** unknown memory model at %s : %d\n" }, +{ ERROR ,"error *** cannot generate code for target '%s'\n"}, +{ WARNING,"warning *** Indirect call to a banked function not implemented.\n"}, +{ WARNING,"warning *** Model '%s' not supported for %s, ignored.\n"}, +{ WARNING,"warning *** Both banked and nonbanked attributes used. nonbanked wins.\n"}, +{ WARNING,"warning *** Both banked and static used. static wins.\n"} }; +void vwerror (int errNum, va_list marker) +{ + if ( ErrTab[errNum].errType== ERROR ) + fatalError++ ; + + if ( filename && lineno ) { + fprintf(ERRSINK, "%s(%d):",filename,lineno); + } + vfprintf(ERRSINK, ErrTab[errNum].errText,marker); +} + /****************************************************************************/ /* werror - writes an error to the listing file & to standarderr */ /****************************************************************************/ void werror (int errNum, ... ) { - va_list marker; - - - if ( ErrTab[errNum].errType== ERROR ) - fatalError++ ; - - if ( filename && lineno ) { - fprintf(stderr,"%s(%d):",filename,lineno); - } - va_start(marker,errNum); - vfprintf(stderr,ErrTab[errNum].errText,marker); - va_end( marker ); + va_list marker; + va_start(marker,errNum); + vwerror(errNum, marker); + va_end( marker ); }