struct SDCCERRG _SDCCERRG;
-extern char *filename ;
-extern int lineno ;
-extern int fatalError ;
+extern char *filename;
+extern int lineno;
+extern int fatalError;
/* Currently the errIndex field must match the position of the
* entry in the array. It is only included in order to make
{ E_UNARY_OP, ERROR_LEVEL_ERROR,
"'unary %c': illegal operand" },
{ E_CONV_ERR, ERROR_LEVEL_ERROR,
- "convertion error: integral promotion failed" },
+ "conversion error: integral promotion failed" },
{ E_INT_REQD, ERROR_LEVEL_ERROR,
"type must be INT for bit field definition" },
{ E_BITFLD_SIZE, ERROR_LEVEL_ERROR,
"storage class CANNOT be specified for bit variable '%s'" },
{ E_EXTERN_MISMATCH, ERROR_LEVEL_ERROR,
"extern definition for '%s' mismatches with declaration." },
-{ W_NONRENT_ARGS, ERROR_LEVEL_WARNING,
- "Functions called via pointers must be 'reentrant' to take arguments" },
+{ E_NONRENT_ARGS, ERROR_LEVEL_ERROR,
+ "Functions called via pointers must be 'reentrant' to take this many arguments" },
{ W_DOUBLE_UNSUPPORTED, ERROR_LEVEL_WARNING,
"type 'double' not supported assuming 'float'" },
{ W_COMP_RANGE, ERROR_LEVEL_WARNING,
/*
-------------------------------------------------------------------------------
-vwerror - Output a standard eror message with variable number of arguements
+vwerror - Output a standard error message with variable number of arguments
-------------------------------------------------------------------------------
*/
}
if ((ErrTab[errNum].errType >= _SDCCERRG.logLevel) && (!_SDCCERRG.disabled[errNum])) {
- if ( ErrTab[errNum].errType == ERROR_LEVEL_ERROR )
+ if ( ErrTab[errNum].errType == ERROR_LEVEL_ERROR || _SDCCERRG.werror )
fatalError++ ;
if ( filename && lineno ) {
break;
case ERROR_LEVEL_WARNING:
case ERROR_LEVEL_PEDANTIC:
- fprintf(_SDCCERRG.out, "warning %d: ", errNum);
+ if (_SDCCERRG.werror)
+ fprintf(_SDCCERRG.out, "error %d: ", errNum);
+ else
+ fprintf(_SDCCERRG.out, "warning %d: ", errNum);
break;
case ERROR_LEVEL_INFO:
fprintf(_SDCCERRG.out, "info %d: ", errNum);
}
/*
-------------------------------------------------------------------------------
-werror - Output a standard eror message with variable number of arguements
+werror - Output a standard error message with variable number of arguments
-------------------------------------------------------------------------------
*/
/*
-------------------------------------------------------------------------------
-werrorfl - Output a standard eror message with variable number of arguements.
+werrorfl - Output a standard error message with variable number of arguments.
Use a specified filename and line number instead of the default.
-------------------------------------------------------------------------------
/*
-------------------------------------------------------------------------------
-fatal - Output a standard eror message with variable number of arguements and
+fatal - Output a standard error message with variable number of arguments and
call exit()
-------------------------------------------------------------------------------
*/
if ((errNum < MAX_ERROR_WARNING) && (ErrTab[errNum].errType <= ERROR_LEVEL_WARNING))
_SDCCERRG.disabled[errNum] = 1;
}
+
+/*
+-------------------------------------------------------------------------------
+Set the flag to treat warnings as errors
+-------------------------------------------------------------------------------
+*/
+
+void setWError (int flag)
+{
+ _SDCCERRG.werror = flag;
+}