1 /*****************************************************************************/
5 /* Error handling for the cc65 C compiler */
9 /* (C) 1998-2000 Ullrich von Bassewitz */
11 /* D-70597 Stuttgart */
12 /* EMail: uz@musoftware.de */
15 /* This software is provided 'as-is', without any expressed or implied */
16 /* warranty. In no event will the authors be held liable for any damages */
17 /* arising from the use of this software. */
19 /* Permission is granted to anyone to use this software for any purpose, */
20 /* including commercial applications, and to alter it and redistribute it */
21 /* freely, subject to the following restrictions: */
23 /* 1. The origin of this software must not be misrepresented; you must not */
24 /* claim that you wrote the original software. If you use this software */
25 /* in a product, an acknowledgment in the product documentation would be */
26 /* appreciated but is not required. */
27 /* 2. Altered source versions must be plainly marked as such, and must not */
28 /* be misrepresented as being the original software. */
29 /* 3. This notice may not be removed or altered from any source */
32 /*****************************************************************************/
46 /*****************************************************************************/
48 /*****************************************************************************/
54 WARN_NONE, /* No warning */
55 WARN_UNREACHABLE_CODE,
57 WARN_COND_ALWAYS_TRUE,
60 WARN_FUNC_WITHOUT_PROTO,
63 WARN_FUNC_MUST_BE_EXTERN,
66 WARN_CONSTANT_IS_LONG,
69 WARN_COUNT /* Warning count */
74 ERR_NONE, /* No error */
76 ERR_UNEXPECTED_NEWLINE,
81 ERR_SEMICOLON_EXPECTED,
90 ERR_INCOMPATIBLE_TYPES,
91 ERR_INCOMPATIBLE_POINTERS,
92 ERR_TOO_MANY_FUNC_ARGS,
93 ERR_TOO_FEW_FUNC_ARGS,
95 ERR_DUPLICATE_MACRO_ARG,
96 ERR_VAR_IDENT_EXPECTED,
97 ERR_INT_EXPR_EXPECTED,
98 ERR_CONST_EXPR_EXPECTED,
100 ERR_INCLUDE_LTERM_EXPECTED,
101 ERR_INCLUDE_RTERM_EXPECTED,
102 ERR_INCLUDE_NOT_FOUND,
103 ERR_INCLUDE_OPEN_FAILURE,
104 ERR_INVALID_USER_ERROR,
106 ERR_UNEXPECTED_CPP_ENDIF,
107 ERR_UNEXPECTED_CPP_ELSE,
108 ERR_CPP_ENDIF_EXPECTED,
109 ERR_CPP_DIRECTIVE_EXPECTED,
110 ERR_MULTIPLE_DEFINITION,
111 ERR_CONFLICTING_TYPES,
114 ERR_MUST_RETURN_VALUE,
115 ERR_CANNOT_RETURN_VALUE,
116 ERR_UNEXPECTED_CONTINUE,
117 ERR_UNDEFINED_SYMBOL,
121 ERR_TOO_MANY_INITIALIZERS,
122 ERR_INIT_INCOMPLETE_TYPE,
123 ERR_CANNOT_SUBSCRIPT,
126 ERR_STRUCT_FIELD_MISMATCH,
127 ERR_STRUCT_PTR_EXPECTED,
130 ERR_CPP_EXPR_EXPECTED,
132 ERR_ILLEGAL_FUNC_CALL,
133 ERR_ILLEGAL_INDIRECT,
135 ERR_ILLEGAL_MACRO_CALL,
136 ERR_ILLEGAL_HEX_DIGIT,
137 ERR_ILLEGAL_CHARCONST,
138 ERR_ILLEGAL_MODIFIER,
139 ERR_ILLEGAL_QUALIFIER,
140 ERR_ILLEGAL_STORAGE_CLASS,
141 ERR_ILLEGAL_SEG_NAME,
147 ERR_MISSING_PARAM_NAME,
150 ERR_CANNOT_TAKE_ADDR_OF_REG,
155 ERR_DUPLICATE_QUALIFIER,
158 ERR_COUNT /* Error count */
165 FAT_CANNOT_OPEN_OUTPUT,
166 FAT_CANNOT_WRITE_OUTPUT,
167 FAT_CANNOT_OPEN_INPUT,
172 FAT_TOO_MANY_CASE_LABELS,
173 FAT_COUNT /* Fatal error count */
178 /* Count of errors/warnings */
179 extern unsigned ErrorCount;
180 extern unsigned WarningCount;
184 /*****************************************************************************/
186 /*****************************************************************************/
190 void Warning (unsigned WarnNum, ...);
191 /* Print warning message. */
193 void PPWarning (unsigned WarnNum, ...);
194 /* Print warning message. For use within the preprocessor. */
196 void Error (unsigned ErrNum, ...);
197 /* Print an error message */
199 void PPError (unsigned ErrNum, ...);
200 /* Print an error message. For use within the preprocessor. */
202 void Fatal (unsigned FatNum, ...);
203 /* Print a message about a fatal error and die */
205 void Internal (char* Format, ...) attribute ((noreturn));
206 /* Print a message about an internal compiler error and die. */
208 void ErrorReport (void);
209 /* Report errors (called at end of compile) */