Fixed up z80 port so that it works again
[fw/sdcc] / src / SDCCerr.c
index a3e4c31efc9de0ccdb286c89bdc688d79e971933..01a54d36d8d8f60d9bff849662b7ecfd84b23a19 100644 (file)
@@ -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 );
 }