*/
#include <stdio.h>
+#include <stdlib.h>
#include "SDCCerr.h"
-
#define USE_STDOUT_FOR_ERRORS 0
#if USE_STDOUT_FOR_ERRORS
static struct {
ERROR_LOG_LEVEL logLevel;
FILE *out;
+ int style; // 1=MSVC
} _SDCCERRG;
extern char *filename ;
{ W_TRUNCATION, ERROR_LEVEL_WARNING,
"high order truncation might occur" },
{ E_CODE_WRITE, ERROR_LEVEL_ERROR,
- "Attempt to assign value to a constant variable %s" },
+ "Attempt to assign value to a constant variable (%s)" },
{ E_LVALUE_CONST, ERROR_LEVEL_ERROR,
"Lvalue specifies constant object" },
{ E_ILLEGAL_ADDR, ERROR_LEVEL_ERROR,
"Label undefined '%s'" },
{ E_FUNC_VOID, ERROR_LEVEL_ERROR,
"void function returning value" },
-{ E_VOID_FUNC, ERROR_LEVEL_ERROR,
+{ W_VOID_FUNC, ERROR_LEVEL_WARNING,
"function '%s' must return value" },
{ W_RETURN_MISMATCH, ERROR_LEVEL_WARNING,
"function return value mismatch" },
"must specify assembler file name with -o in c1 mode" },
{ W_ILLEGAL_OPT_COMBINATION, ERROR_LEVEL_WARNING,
"illegal combination of options (--c1mode, -E, -S -c)" },
+{ E_DUPLICATE_MEMBER, ERROR_LEVEL_ERROR,
+ "duplicate %s member '%s'" },
+{ E_STACK_VIOLATION, ERROR_LEVEL_ERROR,
+ "'%s' internal stack %s" },
};
/*
fatalError++ ;
if ( filename && lineno ) {
- fprintf(_SDCCERRG.out, "%s:%d: ",filename,lineno);
- } else if (lineno) {
+ if(_SDCCERRG.style)
+ fprintf(_SDCCERRG.out, "%s(%d) : ",filename,lineno);
+ else
+ fprintf(_SDCCERRG.out, "%s:%d: ",filename,lineno);
+ } else if (lineno) {
fprintf(_SDCCERRG.out, "at %d: ", lineno);
} else {
fprintf(_SDCCERRG.out, "-:0: ");
va_end( marker );
}
+
+/*
+-------------------------------------------------------------------------------
+fatal - Output a standard eror message with variable number of arguements and
+ call exit()
+-------------------------------------------------------------------------------
+*/
+void fatal (int exitCode, int errNum, ... )
+{
+ va_list marker;
+ va_start(marker,errNum);
+ vwerror(errNum, marker);
+ va_end( marker );
+
+ exit(exitCode);
+}
+
+/*
+-------------------------------------------------------------------------------
+style - Change the output error style to MSVC
+-------------------------------------------------------------------------------
+*/
+
+void MSVC_style (int style)
+{
+ _SDCCERRG.style=style;
+}