X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=support%2FUtil%2FSDCCerr.c;h=a20917f0b6c73e28e20e813274afdd582cf56a82;hb=85cb1c7d9f34e31311e7a2d7fa1d47aeb3a11c4e;hp=6542a7ead5085cf3e3b59903c93da0aab02b3a72;hpb=f98f0bb012d04593bdeb00a0c18dc281bae1e9bb;p=fw%2Fsdcc diff --git a/support/Util/SDCCerr.c b/support/Util/SDCCerr.c index 6542a7ea..a20917f0 100644 --- a/support/Util/SDCCerr.c +++ b/support/Util/SDCCerr.c @@ -21,20 +21,15 @@ #include "SDCCerr.h" -#define USE_STDOUT_FOR_ERRORS 0 +#define USE_STDOUT_FOR_ERRORS 0 #if USE_STDOUT_FOR_ERRORS -#define DEFAULT_ERROR_OUT stdout +#define DEFAULT_ERROR_OUT stdout #else -#define DEFAULT_ERROR_OUT stderr +#define DEFAULT_ERROR_OUT stderr #endif -static struct { - ERROR_LOG_LEVEL logLevel; - FILE *out; - int style; /* 1=MSVC */ - char disabled[MAX_ERROR_WARNING]; /* 1=warning disabled*/ -} _SDCCERRG; +struct SDCCERRG _SDCCERRG; extern char *filename ; extern int lineno ; @@ -44,11 +39,11 @@ extern int fatalError ; * entry in the array. It is only included in order to make * human error lookup easier. */ -struct +struct { - int errIndex; - ERROR_LOG_LEVEL errType; - const char *errText; + int errIndex; + ERROR_LOG_LEVEL errType; + const char *errText; } ErrTab [] = { { E_DUPLICATE, ERROR_LEVEL_ERROR, @@ -192,7 +187,7 @@ struct { E_INIT_COUNT, ERROR_LEVEL_ERROR, "too many initializers" }, { E_INIT_STRUCT, ERROR_LEVEL_ERROR, - "struct/union/array '%s' :initialization needs curly braces" }, + "struct/union/array '%s': initialization needs curly braces" }, { E_INIT_NON_ADDR, ERROR_LEVEL_ERROR, "non-address initialization expression" }, { E_INT_DEFINED, ERROR_LEVEL_ERROR, @@ -200,11 +195,11 @@ struct { E_INT_ARGS, ERROR_LEVEL_ERROR, "interrupt routine cannot have arguments, arguments ingored" }, { E_INCLUDE_MISSING, ERROR_LEVEL_ERROR, - "critical compiler #include file missing. " }, + "critical compiler #include file missing. " }, { E_NO_MAIN, ERROR_LEVEL_ERROR, "function 'main' undefined" }, { E_EXTERN_INIT, ERROR_LEVEL_ERROR, - "'extern' variable '%s' cannot be initialised " }, + "'extern' variable '%s' cannot be initialised " }, { E_PRE_PROC_FAILED, ERROR_LEVEL_ERROR, "Pre-Processor %s" }, { E_DUP_FAILED, ERROR_LEVEL_ERROR, @@ -242,8 +237,8 @@ struct "Functions called via pointers must be 'reentrant' to take arguments" }, { W_DOUBLE_UNSUPPORTED, ERROR_LEVEL_WARNING, "type 'double' not supported assuming 'float'" }, -{ W_IF_NEVER_TRUE, ERROR_LEVEL_WARNING, - "if-statement condition always false, if-statement not generated" }, +{ W_COMP_RANGE, ERROR_LEVEL_WARNING, + "comparison is always %s due to limited range of data type" }, { W_FUNC_NO_RETURN, ERROR_LEVEL_WARNING, "no 'return' statement found for function '%s'" }, { W_PRE_PROC_WARNING, ERROR_LEVEL_WARNING, @@ -371,9 +366,9 @@ struct { W_SYMBOL_NAME_TOO_LONG, ERROR_LEVEL_WARNING, "symbol name too long, truncated to %d chars" }, { W_CAST_STRUCT_PTR,ERROR_LEVEL_WARNING, - "cast of struct %s * to struct %s * " }, -{ W_IF_ALWAYS_TRUE, ERROR_LEVEL_WARNING, - "if-statement condition always true, if-statement not generated" }, + "cast of struct %s * to struct %s * " }, +{ W_LIT_OVERFLOW, ERROR_LEVEL_WARNING, + "overflow in implicit constant conversion" }, { E_PARAM_NAME_OMITTED, ERROR_LEVEL_ERROR, "in function %s: name omitted for parameter %d" }, { W_NO_FILE_ARG_IN_C1, ERROR_LEVEL_WARNING, @@ -420,7 +415,35 @@ struct { W_COMPLEMENT, ERROR_LEVEL_WARNING, "using ~ on bit/bool/unsigned char variables can give unexpected results due to promotion to int" }, { E_SHADOWREGS_NO_ISR, ERROR_LEVEL_ERROR, - "ISR function attribute 'shadowregs' following non-ISR function `%s'" }, + "ISR function attribute 'shadowregs' following non-ISR function '%s'" }, +{ W_SFR_ABSRANGE, ERROR_LEVEL_WARNING, + "absolute address for sfr '%s' probably out of range." }, +{ E_BANKED_WITH_CALLEESAVES, ERROR_LEVEL_ERROR, + "Both banked and callee-saves cannot be used together." }, +{ W_INVALID_INT_CONST, ERROR_LEVEL_WARNING, + "integer constant '%s' out of range, truncated to %.0lf." }, +{ W_CMP_SU_CHAR, ERROR_LEVEL_PEDANTIC, + "comparison of 'signed char' with 'unsigned char' requires promotion to int" }, +{ W_INVALID_FLEXARRAY, ERROR_LEVEL_WARNING, + "invalid use of structure with flexible array member" }, +{ W_C89_NO_FLEXARRAY, ERROR_LEVEL_PEDANTIC, + "ISO C90 does not support flexible array members" }, +{ E_FLEXARRAY_NOTATEND, ERROR_LEVEL_ERROR, + "flexible array member not at end of struct" }, +{ E_FLEXARRAY_INEMPTYSTRCT, ERROR_LEVEL_ERROR, + "flexible array in otherwise empty struct" }, +{ W_EMPTY_SOURCE_FILE, ERROR_LEVEL_WARNING, + "ISO C forbids an empty source file" }, +{ W_BAD_PRAGMA_ARGUMENTS, ERROR_LEVEL_WARNING, + "#pragma %s: bad argument(s); pragma ignored" }, +{ E_BAD_RESTRICT, ERROR_LEVEL_ERROR, + "Only pointers may be qualified with 'restrict'" }, +{ E_BAD_INLINE, ERROR_LEVEL_ERROR, + "Only functions may be qualified with 'inline'" }, +{ E_BAD_INT_ARGUMENT, ERROR_LEVEL_ERROR, + "Bad integer argument for option %s" }, +{ E_NEGATIVE_ARRAY_SIZE, ERROR_LEVEL_ERROR, + "Size of array '%s' is negative" }, }; /* @@ -478,17 +501,17 @@ void vwerror (int errNum, va_list marker) switch(ErrTab[errNum].errType) { case ERROR_LEVEL_ERROR: - fprintf(_SDCCERRG.out, "error %d: ", errNum); - break; + fprintf(_SDCCERRG.out, "error %d: ", errNum); + break; case ERROR_LEVEL_WARNING: case ERROR_LEVEL_PEDANTIC: fprintf(_SDCCERRG.out, "warning %d: ", errNum); - break; + break; case ERROR_LEVEL_INFO: - fprintf(_SDCCERRG.out, "info %d: ", errNum); - break; - default: - break; + fprintf(_SDCCERRG.out, "info %d: ", errNum); + break; + default: + break; } vfprintf(_SDCCERRG.out, ErrTab[errNum].errText,marker);