Announce SDCC 4.5.0 RC3.
[sdcc.git] / sdcc / src / SDCCerr.h
blob8a485aa3a77b1de57cef3780bcc29bea701bf1fd
1 /*
2 * SDCCerr - Standard error handler
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Library General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 #if !defined(__SDCCERR_H)
21 #define __SDCCERR_H
23 #include <stdio.h>
24 #include <stdarg.h>
25 #include "SDCCset.h"
27 /* ERROR Message Definition */
29 enum {
30 E_DUPLICATE = 0, /* Duplicate variable */
31 E_SYNTAX_ERROR = 1, /* Syntax Error */
32 E_CONST_EXPECTED = 2, /* constant expected */
33 E_OUT_OF_MEM = 3, /* malloc failed */
34 E_FILE_OPEN_ERR = 4, /* File open failed */
35 E_INVALID_OCLASS = 5, /* output class invalid */
36 E_CANNOT_ALLOC = 6, /* cannot allocate space*/
37 E_OLD_STYLE = 7, /* old style C ! allowed*/
38 E_STACK_OUT = 8, /* v r out of stack */
39 E_INTERNAL_ERROR = 9, /* unable to alloc tvar */
40 E_LVALUE_REQUIRED = 10, /* lvalue required */
41 E_TMPFILE_FAILED = 11, /* tmpfile creation failed */
42 E_FUNCTION_EXPECTED = 12, /* function expected */
43 E_USING_ERROR = 13, /* using in error */
44 E_SFR_INIT = 14, /* init error for sbit */
45 W_INIT_IGNORED = 15, /* initialiser ignored */
46 E_AUTO_ASSUMED = 16, /* sclass auto assumed */
47 E_AUTO_ABSA = 17, /* abs addr for auto var*/
48 W_INIT_WRONG = 18, /* initializer type != */
49 E_FUNC_REDEF = 19, /* func name redefined */
50 E_ID_UNDEF = 20, /* Undefined identifier '%s' */
51 W_STACK_OVERFLOW = 21, /* stack overflow */
52 E_NEED_ARRAY_PTR = 22, /* array or pointer reqd*/
53 E_IDX_NOT_INT = 23, /* index not an integer */
54 W_IDX_OUT_OF_BOUNDS = 24, /* array index out of bounds */
55 E_STRUCT_UNION = 25, /* struct,union expected*/
56 E_NOT_MEMBER = 26, /* !struct/union member */
57 E_PTR_REQD = 27, /* pointer required */
58 E_UNARY_OP = 28, /* unary operator bad op*/
59 E_CONV_ERR = 29, /* conversion error */
60 E_BITFLD_TYPE = 30, /* invalid type for bit-field */
61 E_BITFLD_SIZE = 31, /* bit-field too wide for type */
62 W_TRUNCATION = 32, /* high order trucation */
63 E_CODE_WRITE = 33, /* trying 2 write to code */
64 E_LVALUE_CONST = 34, /* lvalue is a const */
65 E_ILLEGAL_ADDR = 35, /* address of bit */
66 E_CAST_ILLEGAL = 36, /* cast illegal */
67 E_MULT_INTEGRAL = 37, /* mult opernd must b integral */
68 E_ARG_ERROR = 38, /* argument count error*/
69 E_ARG_COUNT = 39, /* func expecting more */
70 E_FUNC_EXPECTED = 40, /* func name expected */
71 E_PLUS_INVALID = 41, /* plus invalid */
72 E_PTR_PLUS_PTR = 42, /* pointer + pointer */
73 E_SHIFT_OP_INVALID = 43, /* shft op op invalid */
74 E_COMPARE_OP = 44, /* compare operand */
75 E_BITWISE_OP = 45, /* bit op invalid op */
76 E_ANDOR_OP = 46, /* && || op invalid */
77 E_TYPE_MISMATCH = 47, /* type mismatch */
78 E_ARRAY_ASSIGN = 48, /* array assign */
79 E_ARRAY_DIRECT = 49, /* array indexing in */
80 E_BIT_ARRAY = 50, /* bit array not allowed */
81 E_DUPLICATE_TYPEDEF = 51, /* typedef name duplicate */
82 E_ARG_TYPE = 52, /* arg type mismatch */
83 E_RET_VALUE = 53, /* return value mismatch */
84 E_FUNC_AGGR = 54, /* Function cannot return aggregate. Func body ignored */
85 E_FUNC_DEF = 55, /* ANSI Style def neede */
86 E_DUPLICATE_LABEL = 56, /* duplicate label name */
87 E_LABEL_UNDEF = 57, /* undefined label used */
88 E_FUNC_VOID = 58, /* void func ret value */
89 W_VOID_FUNC = 59, /* func must return value */
90 W_RETURN_MISMATCH = 60, /* return value mismatch */
91 E_CASE_CONTEXT = 61, /* case stmnt without switch */
92 E_CASE_CONSTANT = 62, /* case expression ! const */
93 E_BREAK_CONTEXT = 63, /* break statement invalid */
94 E_SWITCH_AGGR = 64, /* non integral for switch */
95 E_FUNC_BODY = 65, /* func has body already */
96 E_UNKNOWN_SIZE = 66, /* variable has unknown size */
97 E_AUTO_AGGR_INIT = 67, /* auto aggregates no init */
98 E_INIT_COUNT = 68, /* too many initializers */
99 E_INIT_STRUCT = 69, /* struct init wrong */
100 E_INIT_NON_ADDR = 70, /* non address xpr for init */
101 E_INT_DEFINED = 71, /* interrupt already over */
102 E_INT_ARGS = 72, /* interrupt rtn cannot have args */
103 E_INCLUDE_MISSING = 73, /* compiler include missing */
104 E_NO_MAIN = 74, /* main function undefined */
105 E_UNUSED_75 = 75, /* - removed error code - */
106 E_PRE_PROC_FAILED = 76, /* preprocessor failed */
107 E_DUP_FAILED = 77, /* file DUP failed */
108 E_INCOMPAT_TYPES = 78, /* incompatible types casting */
109 W_LOOP_ELIMINATE = 79, /* loop eliminated */
110 W_NO_SIDE_EFFECTS = 80, /* expression has no side effects */
111 W_CONST_TOO_LARGE = 81, /* constant out of range */
112 W_BAD_COMPARE = 82, /* bad comparison */
113 E_TERMINATING = 83, /* compiler terminating */
114 W_LOCAL_NOINIT = 84, /* local reference before assignment */
115 W_NO_REFERENCE = 85, /* no reference to local variable */
116 E_OP_UNKNOWN_SIZE = 86, /* unknown size for operand */
117 W_LONG_UNSUPPORTED = 87, /* 'long' not supported yet */
118 W_LITERAL_GENERIC = 88, /* literal being cast to generic pointer */
119 E_SFR_ADDR_RANGE = 89, /* sfr address out of range */
120 E_BITVAR_STORAGE = 90, /* storage given for 'bit' variable */
121 E_EXTERN_MISMATCH = 91, /* extern declaration mismatches */
122 E_NONRENT_ARGS = 92, /* fptr non reentrant has args */
123 W_DOUBLE_UNSUPPORTED = 93, /* 'double' not supported yet */
124 W_COMP_RANGE = 94, /* comparison is always %s due to limited range of data type */
125 W_FUNC_NO_RETURN = 95, /* no return statement found */
126 W_PRE_PROC_WARNING = 96, /* preprocessor generated warning */
127 E_STRUCT_AS_ARG = 97, /* structure passed as argument */
128 E_PREV_DECL_CONFLICT = 98, /* previous declaration conflicts with current */
129 E_CODE_NO_INIT = 99, /* vars in code space must have initializer */
130 E_OPS_INTEGRAL = 100, /* operans must be integral for certain assignments */
131 E_TOO_MANY_PARMS = 101, /* too many parameters */
132 E_TOO_FEW_PARMS = 102, /* too few parameters */
133 E_FUNC_NO_CODE = 103, /* fatalError */
134 E_TYPE_MISMATCH_PARM = 104, /* type mismatch for parameter */
135 E_INVALID_FLOAT_CONST = 105, /* invalid floating point literal string */
136 E_INVALID_OP = 106, /* invalid operand for some operation */
137 E_SWITCH_NON_INTEGER = 107, /* switch value not integer */
138 E_CASE_NON_INTEGER = 108, /* case value not integer */
139 W_FUNC_TOO_LARGE = 109, /* function too large */
140 W_CONTROL_FLOW = 110, /* control flow changed due to optimization */
141 W_PTR_TYPE_INVALID = 111, /* invalid type specifier for pointer */
142 W_IMPLICIT_FUNC = 112, /* function declared implicitly */
143 W_CONTINUE = 113, /* more than one line */
144 I_EXTENDED_STACK_SPILS = 114, /* extended stack by %d bytes for compiler temp(s) :in function '%s': %s */
145 W_UNKNOWN_PRAGMA = 115, /* #pragma directive unsupported */
146 W_SHIFT_CHANGED = 116, /* shift changed to zero */
147 W_UNKNOWN_OPTION = 117, /* don't know the option */
148 W_UNSUPP_OPTION = 118, /* processor reset has been redifned */
149 E_UNKNOWN_FEXT = 119, /* unknown file extension */
150 W_TOO_MANY_SRC = 120, /* can only compile one .c file at a time */
151 I_CYCLOMATIC = 121, /* information message */
152 E_DIVIDE_BY_ZERO = 122, /* / 0 */
153 E_FUNC_BIT = 123, /* function cannot return bit */
154 E_CAST_ZERO = 124, /* casting to from size zero */
155 W_CONST_RANGE = 125, /* constant too large */
156 W_CODE_UNREACH = 126, /* unreachable code */
157 W_NONPTR2_GENPTR = 127, /* non pointer cast to generic pointer */
158 W_POSSBUG = 128, /* possible code generation error */
159 E_INCOMPAT_PTYPES = 129, /* incompatible pointer assignment */
160 W_UNKNOWN_MODEL = 130, /* Unknown memory model */
161 E_UNKNOWN_TARGET = 131, /* target not defined */
162 W_INDIR_BANKED = 132, /* Indirect call to a banked fun */
163 W_UNSUPPORTED_MODEL = 133, /* Unsupported model, ignored */
164 W_BANKED_WITH_NONBANKED = 134, /* banked and nonbanked attributes mixed */
165 W_BANKED_WITH_STATIC = 135, /* banked and static mixed */
166 W_INT_TO_GEN_PTR_CAST = 136, /* Converting integer type to generic pointer. */
167 W_ESC_SEQ_OOR_FOR_CHAR = 137, /* Escape sequence of of range for char */
168 E_INVALID_HEX = 138, /* \x used with no following hex digits */
169 W_FUNCPTR_IN_USING_ISR = 139, /* Call via function pointer in ISR with using attribute. */
170 E_NO_SUCH_BANK = 140, /* called function uses unknown register bank %d. */
171 E_TWO_OR_MORE_DATA_TYPES = 141, /* two or more data types in declaration for '%s' */
172 E_LONG_OR_SHORT_INVALID = 142, /* long or short invalid for .. */
173 E_SIGNED_OR_UNSIGNED_INVALID = 143, /* signed or unsigned invalid for .. */
174 E_LONG_AND_SHORT_INVALID = 144, /* long and short invalid for .. */
175 E_SIGNED_AND_UNSIGNED_INVALID = 145, /* signed and unsigned invalid for .. */
176 E_TWO_OR_MORE_STORAGE_CLASSES = 146, /* two or more storage classes in declaration for '%s' */
177 W_EXCESS_INITIALIZERS = 147, /* too much initializers for array */
178 E_ARGUMENT_MISSING = 148, /* Option requires an argument. */
179 W_STRAY_BACKSLASH = 149, /* stray '\\' at column %d" */
180 W_NEWLINE_IN_STRING = 150, /* newline in string constant */
181 W_USING_GENERIC_POINTER = 151, /* using generic pointer %s to initialize %s */
182 W_EXCESS_SHORT_OPTIONS = 152, /* Only one short option can be specified at a time. Rest of %s ignored. */
183 E_VOID_VALUE_USED = 153, /* void value not ignored as it ought to be */
184 W_INTEGRAL2PTR_NOCAST = 154, /* converting integral to pointer without a cast */
185 W_PTR2INTEGRAL_NOCAST = 155, /* converting pointer to integral without a cast */
186 W_SYMBOL_NAME_TOO_LONG = 156, /* symbol name too long, truncated to %d chars */
187 W_CAST_STRUCT_PTR = 157, /* pointer to different structure types */
188 W_LIT_OVERFLOW = 158, /* overflow in implicit constant conversion */
189 E_PARAM_NAME_OMITTED = 159, /* { in function %s: name omitted for parameter %d */
190 W_NO_FILE_ARG_IN_C1 = 160, /* only standard input is compiled in c1 mode. file '%s' ignored */
191 E_NEED_OPT_O_IN_C1 = 161, /* must specify assembler file name with -o in c1 mode */
192 W_ILLEGAL_OPT_COMBINATION = 162, /* illegal combination of options (--c1mode, -E, -S -c) */
193 E_DUPLICATE_MEMBER = 163, /* duplicate %s member '%s' */
194 E_STACK_VIOLATION = 164, /* internal stack violation */
195 W_INT_OVL = 165, /* integer overflow in expression */
196 W_USELESS_DECL = 166, /* useless declaration */
197 E_INT_BAD_INTNO = 167, /* invalid interrupt number */
198 W_BITFLD_NAMED = 168, /* declarator used with 0 length bit-field */
199 E_FUNC_ATTR = 169, /* function attribute without function */
200 W_SAVE_RESTORE = 170, /* unmatched #pragma SAVE and #pragma RESTORE */
201 E_INVALID_CRITICAL = 171, /* operation invalid in critical sequence */
202 E_NOT_ALLOWED = 172, /* %s not allowed here */
203 E_BAD_TAG = 173, /* '%s' is not a %s tag */
204 E_ENUM_NON_INTEGER = 174, /* enumeration constant not an integer */
205 W_DEPRECATED_PRAGMA = 175, /* deprecated pragma */
206 E_SIZEOF_INCOMPLETE_TYPE = 176, /* sizeof applied to an incomplete type */
207 E_PREVIOUS_DEF = 177, /* previously defined here */
208 W_SIZEOF_VOID = 178, /* size of void is zero */
209 W_POSSBUG2 = 179, /* possible bug, new format */
210 W_COMPLEMENT = 180, /* ~bit can give unexpected results */
211 E_SHADOWREGS_NO_ISR = 181, /* shadowregs keyword following non-ISR function */
212 W_SFR_ABSRANGE = 182, /* __sfr at address out of range */
213 E_BANKED_WITH_CALLEESAVES = 183, /* banked and callee-saves mixed */
214 W_INVALID_INT_CONST = 184, /* invalid integer literal string */
215 W_CMP_SU_CHAR = 185, /* comparison of 'signed char' with 'unsigned char' requires promotion to int */
216 W_INVALID_FLEXARRAY = 186, /* invalid use of structure with flexible array member */
217 W_C89_NO_FLEXARRAY = 187, /* ISO C90 does not support flexible array members */
218 E_FLEXARRAY_NOTATEND = 188, /* flexible array member not at end of struct */
219 E_FLEXARRAY_INEMPTYSTRCT = 189, /* flexible array in otherwise empty struct */
220 W_EMPTY_TRANSLATION_UNIT = 190, /* ISO C forbids an empty translation unit */
221 W_BAD_PRAGMA_ARGUMENTS = 191, /* #pragma %s: bad argument(s); pragma ignored */
222 E_BAD_RESTRICT = 192, /* Only object pointers may be qualified with 'restrict' */
223 E_BAD_INLINE = 193, /* Only functions may be qualified with 'inline' */
224 E_BAD_INT_ARGUMENT = 194, /* Bad integer option argument */
225 E_NEGATIVE_ARRAY_SIZE = 195, /* Size of array '%s' is negative */
226 W_TARGET_LOST_QUALIFIER = 196, /* Pointer target lost qualifier */
227 W_DEPRECATED_KEYWORD = 197, /* keyword '%s' is deprecated, use '%s' instead */
228 E_STORAGE_CLASS_FOR_PARAMETER = 198, /* storage class specified for parameter '%s' */
229 E_OFFSETOF_TYPE = 199, /* offsetof can only be applied to structs/unions */
230 E_INCOMPLETE_FIELD = 200, /* struct field has incomplete type */
231 W_DEPRECATED_OPTION = 201, /* deprecated compiler option '%s' */
232 E_BAD_DESIGNATOR = 202, /* Bad designated initializer */
233 W_DUPLICATE_INIT = 203, /* duplicate initializer */
234 W_INVALID_UNIVERSAL = 204, /* invalid universal character name %s. */
235 W_UNIVERSAL_C95 = 205, /* universal character names are only valid in C95 or later */
236 E_SHORTLONG = 206, /* Invalid combination of short / long */
237 E_INTEGERSUFFIX = 207, /* Invalid integer suffix */
238 E_AUTO_ADDRSPACE = 208, /* named address space for auto var */
239 W_NORETURNRETURN = 209, /* return in _noreturn function */
240 E_STRUCT_REDEF_INCOMPATIBLE = 210, /* struct or union tag redefined to incompatible type */
241 W_STRING_CANNOT_BE_TERMINATED = 211, /* string cannot be terminated within array */
242 W_LONGLONG_LITERAL = 212, /* long long literal */
243 S_SYNTAX_ERROR = 213, /* syntax error */
244 E_MIXING_CONFIG = 214, /* mixing __CONFIG and CONFIG directives */
245 W_STATIC_ASSERTION = 215, /* static assertion failed */
246 E_ALIGNAS = 216, /* invalid alignment specified */
247 W_INTERNAL_ERROR = 217, /* warning for non-fatal internal errors - things that should not have happened, but can be handled */
248 W_UNRECOGNIZED_ASM = 218, /* unrecognized asm instruction in peephole optimizer */
249 W_FLEXARRAY_INSTRUCT = 219, /* using flexible arrays in a struct */
250 E_TYPE_IS_FUNCTION = 220, /* typedef void foo_t(void); foo_t foo; */
251 W_INLINE_NAKED = 221, /* inline function is naked */
252 E_Z88DK_FASTCALL_PARAMETERS = 222, /* invalid number of parameters in __z88dk_fastcall */
253 E_Z88DK_FASTCALL_PARAMETER = 223, /* invalid parameter type in __z88dk_fastcall */
254 W_REPEAT_QUALIFIER = 224, /* the same qualifier appears more than once */
255 W_NO_TYPE_SPECIFIER = 225, /* type specifier missing in declaration */
256 E_NO_TYPE_SPECIFIER = 226, /* type specifier missing in declaration */
257 E_MULTIPLE_DEFAULT_IN_GENERIC = 227, /* multiple default expressions in generic association */
258 E_MULTIPLE_MATCHES_IN_GENERIC = 228, /* multiple matching expressions in generic association */
259 E_NO_MATCH_IN_GENERIC = 229, /* no matching expression in generic association */
260 W_LABEL_WITHOUT_STATEMENT_C23 = 230, /* label without statement requires ISO C23 or later */
261 E_WCHAR_CONST_C95 = 231, /* character constant of type wchar_t requires ISO C 95 or later */
262 E_WCHAR_CONST_C11 = 232, /* character constant of type char16_t or char32_t equires ISO C 11 or later */
263 E_WCHAR_STRING_C95 = 233, /* wide character string literal requires ISO C 95 or later */
264 E_WCHAR_STRING_C11 = 234, /* wide character string literal requires ISO C 11 or later */
265 W_UNKNOWN_REG = 235, /* unknown register specified */
266 E_HEXFLOAT_C99 = 236, /* hexadecimal floating constant requires ISO C99 or later */
267 E_ANONYMOUS_STRUCT_TAG = 237, /* anonymous struct/union should not have a tag */
268 W_INLINE_FUNCATTR = 238, /* inline functions should not be z88dk_fastcall or z88dk_callee */
269 E_FOR_INITAL_DECLARATION_C99 = 239, /* initial declaration in for loop requires ISO C99 or later */
270 E_QUALIFIED_ARRAY_PARAM_C99 = 240, /* qualifiers in array parameters require ISO C99 or later */
271 E_QUALIFIED_ARRAY_NOPARAM = 241, /* qualifier or static in array declarator that is not a parameter */
272 E_STATIC_ARRAY_PARAM_C99 = 242, /* static in array parameters requires ISO C99 or later */
273 E_INT_MULTIPLE = 243, /* multiple interrupt numbers */
274 W_INCOMPAT_PTYPES = 244, /* incompatible pointer assignment (not allowed by the standard, but allowed in SDCC) */
275 E_STATIC_ASSERTION_C23 = 245, /* static assertion with one argument requires C23 or later */
276 W_STATIC_ASSERTION_2 = 246, /* static assertion failed */
277 E_DECL_AFTER_STATEMENT_C99 = 247, /* declaration after statement requires ISO C99 or later */
278 E_SHORTCALL_INVALID_VALUE = 248, /* Invalid value for a __z88dk_shortcall specifier */
279 E_DUPLICATE_PARAMTER_NAME = 249, /* duplicate parameter name */
280 E_AUTO_FILE_SCOPE = 250, /* auto in declaration at file scope */
281 E_U8_CHAR_C23 = 251, /* u8 character constant requires ISO C23 or later */
282 E_U8_CHAR_INVALID = 252, /* invalid u8 character constant */
283 E_ATTRIBUTE_C23 = 253, /* attribute requires ISO C23 or later */
284 E_COMPOUND_LITERALS_C99 = 254, /* compound literals require ISO C99 or later */
285 E_THREAD_LOCAL = 255, /* thread-local storage is not implemented */
286 E_ENUM_COMMA_C99 = 256, /* trailing comma after enumerator list requires ISO C99 or later */
287 E_OUTPUT_FILE_OPEN_ERR = 257, /* Failed to open output file for writing (with error message) */
288 E_INPUT_FILE_OPEN_ERR = 258, /* Failed to open input file for readin (with error message) */
289 W_SHIFT_NEGATIVE = 259, /* shift by negative amount */
290 W_INVALID_STACK_LOCATION = 260, /* access to invalid stack location */
291 W_BINARY_INTEGER_CONSTANT_C23 = 261, /* binary integer constant requires ISO C23 or later */
292 E_U8CHAR_STRING_C11 = 262, /* unicode string literal requires ISO C 11 or later */
293 W_PREFIXED_STRINGS = 263, /* sequence of differently prefixed string literals */
294 W_DIGIT_SEPARATOR_C23 = 264, /* digit separators require ISO C23 or later */
295 E_INVALID_LANG_OVERRIDE = 265, /* argument to option -x is not a valid file type override */
296 E_RAISONANCE_LARGE_RETURN = 266, /* large return value not supported for Raisonance calling convention */
297 E_IAR_LARGE_RETURN = 267, /* large return value not supported for IAR calling convention */
298 E_IAR_PSEUDOPARM = 268, /* IAR function call with parameter in pseudoregister */
299 E_COSMIC_LARGE_RETURN = 269, /* large return value not supported for Cosmic calling convention */
300 E_MULTIPLE_CALLINGCONVENTIONS = 270, /* multiple incompatible calling conventions */
301 E_SFR_POINTER = 271, /* unsupported pointer to __sfr */
302 E_INVALID_BITINTWIDTH = 272, /* invalid with for bit-precise integer type */
303 W_BITINTCONST_C23 = 273, /* bit-precise integer constant requires ISO C23 or later */
304 E_INVALID_UNIVERSAL_IDENTIFIER = 274, /* universal character name %s invalid in identifier */
305 E_COMPLEX_UNSUPPORTED = 275, /* complex numbers are not supported */
306 E_DECIMAL_FLOAT_UNSUPPORTED = 276, /* decimal floating-point numbers are not supported */
307 E_ATOMIC_UNSUPPORTED = 277, /* atomics are not supported */
308 W_RETURN_TYPE_OMITTED_INT = 278, /* return type of function omitted, assuming int */
309 W_SINGLE_DASH_LONG_OPT = 279, /* use of single-dash long options is discouraged */
310 E_UNKNOWN_LANGUAGE_STANDARD = 280, /* unknown language standard */
311 E_CONSTEXPR = 281, /* constexpr not implemented */
312 E_TYPEOF = 282, /* typeof and typeof_unqual not implemented for nontrivial expressions */
313 W_FUNCDECL_WITH_NO_PROTOTYPE = 283, /* function declarator with no prototype */
314 W_UNKNOWN_ATTRIBUTE = 284, /* unknown attribute ignored*/
315 W_EMPTY_INIT_C23 = 285, /* empty initializer requires ISO C23 or later */
316 E_EMPTY_INIT_UNKNOWN_SIZE = 286, /* array of unknown size cannnot be initialized by an empty initializer */
317 E_VLA_TYPE_C99 = 287, /* variable length array type requires ISO C99 or later */
318 E_VLA_OBJECT = 288, /* object of variable length array type not supported */
319 E_VLA_SCOPE = 289, /* variable length array declarators must have function prototype scope or block scope */
320 E_VLA_INIT = 290, /* variable length arrays can be initialized by empty initalizers only */
321 W_ENUM_INT_RANGE_C23 = 291, /* enumeration constant outside the range of int requires ISO C23 or later */
322 E_Z88DK_CALLEE_VARARG = 292, /* __z88dk_callee with variable arguments not supported */
323 W_CODEMEM_WRITE = 293, /* attempt to write to read-only-memory */
324 W__SDCC_EXTERNAL_STARTUP_DEF = 294, /* _sdcc_external_startup function definition - probable deprecated old-style variant of __sdcc_external_startup */
325 E_NO_SKIP_TARGET = 295, /* target label missing for skip instruction */
326 W_SDCCCALL_STD_LIB_CRT0 = 296, /* non-default sdcccall specified, but default stdlib or crt0 */
327 W_PEEPHOLE_RULE_LIMIT = 297, /* peephole rule application limit reached */
328 W_DATA_ABSRANGE = 298, /* __data at address out of range */
329 W_IDATA_ABSRANGE = 299, /* __idata at address out of range */
330 W_CASE_RANGE_EMPTY = 300, /* empty case range specified */
331 E_CASE_RANGE_C2Y = 301, /* case range expressions require C2y or later */
332 E_GENERIC_WITH_TYPENAME_C2Y = 302, /* generic selection based on a type name requires C2y or later */
333 E_MIXED_FUNCTION_STYLES = 303, /* function mixes ISO and K&R style */
334 E_ENUM_TYPE_SPECIFIER_C23 = 304, /* enum type specifiers require C23 or later */
335 E_ENUM_UNDERLYING_TYPE = 305, /* enum's underlying type must be an integer type and cannot be bit-precise or an enum */
336 E_ENUM_TYPE_RANGE_TOO_SMALL = 306, /* the enum's underlying type cannot represent all enumerator values */
338 /* don't touch this! */
339 NUMBER_OF_ERROR_MESSAGES /* Number of error messages */
342 /** sdcc style assertion */
343 #ifdef assert
344 #undef assert
345 #endif
346 #ifdef NDEBUG
347 # define assert(expr) (void)0
348 #else
349 # define assert(expr) ((expr) ? (void)0 : fatal (1, E_INTERNAL_ERROR, __FILE__, __LINE__, #expr))
350 #endif
352 #define wassertl_bt(a,s) (void)((a) ? 0 : \
353 (werror_bt (E_INTERNAL_ERROR, __FILE__, __LINE__, s), 0))
355 #define wassert_bt(a) wassertl_bt(a, "code generator internal error")
357 /** Describes the maximum error level that will be logged. Any level
358 * includes all of the levels listed after it.
362 enum _ERROR_LOG_LEVEL {
363 /** Everything. Currently the same as PEDANTIC. */
364 ERROR_LEVEL_ALL,
365 /** All warnings, including those considered 'reasonable to use,
366 on occasion, in clean programs' (man 3 gcc). */
367 ERROR_LEVEL_PEDANTIC,
368 /** 'informational' warnings */
369 ERROR_LEVEL_INFO,
370 /** Most warnings. */
371 ERROR_LEVEL_WARNING,
372 /** Errors only. */
373 ERROR_LEVEL_ERROR,
374 /** Syntax error only. */
375 ERROR_LEVEL_SYNTAX_ERROR
378 typedef enum _ERROR_LOG_LEVEL ERROR_LOG_LEVEL;
380 struct SDCCERRG {
381 ERROR_LOG_LEVEL logLevel;
382 FILE *out;
383 int style; /* 1=MSVC */
384 int werror; /* treat the warnings as errors */
385 set *log;
388 extern struct SDCCERRG _SDCCERRG;
390 /** Sets the maximum error level to log.
391 See MAX_ERROR_LEVEL. The default is ERROR_LEVEL_ALL.
393 void setErrorLogLevel (ERROR_LOG_LEVEL level);
396 -------------------------------------------------------------------------------
397 SetErrorOut - Set the error output file
399 -------------------------------------------------------------------------------
402 FILE * SetErrorOut (FILE *NewErrorOut);
405 -------------------------------------------------------------------------------
406 vwerror - Output a standard error message with variable number of arguments
408 -------------------------------------------------------------------------------
411 int vwerror (int errNum, va_list marker);
414 -------------------------------------------------------------------------------
415 werror - Output a standard error message with variable number of arguments
417 -------------------------------------------------------------------------------
420 int werror (int errNum, ... );
423 -------------------------------------------------------------------------------
424 werror_bt - like werror(), but als provide a backtrace
426 -------------------------------------------------------------------------------
429 int werror_bt (int errNum, ... );
432 -------------------------------------------------------------------------------
433 werrorfl - Output a standard error message with variable number of arguments.
434 Use a specified filename and line number instead of the default.
436 -------------------------------------------------------------------------------
439 int werrorfl (char *newFilename, int newLineno, int errNum, ...);
442 -------------------------------------------------------------------------------
443 fatal - Output a standard error message with variable number of arguments and
444 call exit()
445 -------------------------------------------------------------------------------
448 void fatal (int exitCode, int errNum, ... );
451 -------------------------------------------------------------------------------
452 style - Change the output error style to MSVC
453 -------------------------------------------------------------------------------
456 void MSVC_style (int style);
459 -------------------------------------------------------------------------------
460 disabled - Disable output of specified warning
461 -------------------------------------------------------------------------------
464 void setWarningDisabled (int errNum);
467 -------------------------------------------------------------------------------
468 disabledState - Enable/Disable output of specified warning
469 -------------------------------------------------------------------------------
472 int setWarningDisabledState (int errNum, int disabled);
475 -------------------------------------------------------------------------------
476 Set the flag to treat warnings as errors
477 -------------------------------------------------------------------------------
479 void setWError (int flag);
481 #endif