]> git.sur5r.net Git - cc65/blob - src/cc65/error.h
c44518300e00ee2c874a2b9203af409d18021513
[cc65] / src / cc65 / error.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                  error.h                                  */
4 /*                                                                           */
5 /*                  Error handling for the cc65 C compiler                   */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 1998-2000 Ullrich von Bassewitz                                       */
10 /*               Wacholderweg 14                                             */
11 /*               D-70597 Stuttgart                                           */
12 /* EMail:        uz@musoftware.de                                            */
13 /*                                                                           */
14 /*                                                                           */
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.                                    */
18 /*                                                                           */
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:                            */
22 /*                                                                           */
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              */
30 /*    distribution.                                                          */
31 /*                                                                           */
32 /*****************************************************************************/
33
34
35
36 #ifndef ERROR_H
37 #define ERROR_H
38
39
40
41 /* common */
42 #include "attrib.h"
43
44
45
46 /*****************************************************************************/
47 /*                                   Data                                    */
48 /*****************************************************************************/
49
50
51
52 /* Warning numbers */
53 enum Warnings {
54     WARN_NONE,                          /* No warning */
55     WARN_UNREACHABLE_CODE,
56     WARN_COND_NEVER_TRUE,
57     WARN_COND_ALWAYS_TRUE,
58     WARN_PTR_TO_INT_CONV,
59     WARN_INT_TO_PTR_CONV,
60     WARN_FUNC_WITHOUT_PROTO,
61     WARN_UNKNOWN_PRAGMA,
62     WARN_NO_CASE_LABELS,
63     WARN_FUNC_MUST_BE_EXTERN,
64     WARN_UNUSED_PARM,
65     WARN_UNUSED_ITEM,
66     WARN_CONSTANT_IS_LONG,
67     WARN_NESTED_COMMENT,
68     WARN_USELESS_DECL,
69     WARN_COUNT                          /* Warning count */
70 };
71
72 /* Error numbers */
73 enum Errors {   
74     ERR_NONE,                           /* No error */
75     ERR_INVALID_CHAR,
76     ERR_UNEXPECTED_NEWLINE,
77     ERR_EOF_IN_COMMENT,
78     ERR_SYNTAX,
79     ERR_QUOTE_EXPECTED,
80     ERR_COLON_EXPECTED,
81     ERR_SEMICOLON_EXPECTED,
82     ERR_COMMA_EXPECTED,
83     ERR_LPAREN_EXPECTED,
84     ERR_RPAREN_EXPECTED,
85     ERR_LBRACK_EXPECTED,
86     ERR_RBRACK_EXPECTED,
87     ERR_LCURLY_EXPECTED,
88     ERR_RCURLY_EXPECTED,
89     ERR_IDENT_EXPECTED,
90     ERR_TYPE_EXPECTED,
91     ERR_INCOMPATIBLE_TYPES,
92     ERR_INCOMPATIBLE_POINTERS,
93     ERR_TOO_MANY_FUNC_ARGS,
94     ERR_TOO_FEW_FUNC_ARGS,
95     ERR_MACRO_ARGCOUNT,
96     ERR_DUPLICATE_MACRO_ARG,
97     ERR_MACRO_REDEF,
98     ERR_VAR_IDENT_EXPECTED,
99     ERR_INT_EXPR_EXPECTED,
100     ERR_CONST_EXPR_EXPECTED,
101     ERR_NO_ACTIVE_LOOP,
102     ERR_INCLUDE_LTERM_EXPECTED,
103     ERR_INCLUDE_RTERM_EXPECTED,
104     ERR_INCLUDE_NOT_FOUND,
105     ERR_INCLUDE_OPEN_FAILURE,
106     ERR_INVALID_USER_ERROR,
107     ERR_USER_ERROR,
108     ERR_UNEXPECTED_CPP_ENDIF,
109     ERR_UNEXPECTED_CPP_ELSE,
110     ERR_CPP_ENDIF_EXPECTED,
111     ERR_CPP_DIRECTIVE_EXPECTED,
112     ERR_MULTIPLE_DEFINITION,
113     ERR_CONFLICTING_TYPES,
114     ERR_STRLIT_EXPECTED,
115     ERR_WHILE_EXPECTED,
116     ERR_MUST_RETURN_VALUE,
117     ERR_CANNOT_RETURN_VALUE,
118     ERR_UNEXPECTED_CONTINUE,
119     ERR_UNDEFINED_SYMBOL,
120     ERR_UNDEFINED_LABEL,
121     ERR_INCLUDE_NESTING,
122     ERR_TOO_MANY_LOCALS,
123     ERR_TOO_MANY_INITIALIZERS,
124     ERR_INIT_INCOMPLETE_TYPE,
125     ERR_CANNOT_SUBSCRIPT,
126     ERR_OP_NOT_ALLOWED,
127     ERR_STRUCT_EXPECTED,
128     ERR_STRUCT_FIELD_MISMATCH,
129     ERR_STRUCT_PTR_EXPECTED,
130     ERR_LVALUE_EXPECTED,
131     ERR_EXPR_EXPECTED,
132     ERR_CPP_EXPR_EXPECTED,
133     ERR_ILLEGAL_TYPE,
134     ERR_ILLEGAL_FUNC_CALL,
135     ERR_ILLEGAL_INDIRECT,
136     ERR_ILLEGAL_ADDRESS,
137     ERR_ILLEGAL_MACRO_CALL,
138     ERR_ILLEGAL_HEX_DIGIT,
139     ERR_ILLEGAL_CHARCONST,
140     ERR_ILLEGAL_MODIFIER,
141     ERR_ILLEGAL_QUALIFIER,
142     ERR_ILLEGAL_STORAGE_CLASS,
143     ERR_ILLEGAL_ATTRIBUTE,
144     ERR_ILLEGAL_SEG_NAME,
145     ERR_DIV_BY_ZERO,
146     ERR_MOD_BY_ZERO,
147     ERR_RANGE,
148     ERR_SYMBOL_KIND,
149     ERR_LEVEL_NESTING,
150     ERR_MISSING_PARAM_NAME,
151     ERR_OLD_STYLE_PROTO,
152     ERR_PARAM_DECL,
153     ERR_CANNOT_TAKE_ADDR_OF_REG,
154     ERR_ILLEGAL_SIZE,
155     ERR_FASTCALL,
156     ERR_UNKNOWN_SIZE,
157     ERR_UNKNOWN_IDENT,
158     ERR_DUPLICATE_QUALIFIER,
159     ERR_CONST_ASSIGN,
160     ERR_QUAL_DIFF,
161     ERR_COUNT                           /* Error count */
162 };
163
164 /* Fatal errors */
165 enum Fatals {
166     FAT_NONE,
167     FAT_TOO_MANY_ERRORS,
168     FAT_CANNOT_OPEN_OUTPUT,
169     FAT_CANNOT_WRITE_OUTPUT,
170     FAT_CANNOT_OPEN_INPUT,
171     FAT_OUT_OF_MEMORY,
172     FAT_STACK_OVERFLOW,
173     FAT_STACK_EMPTY,
174     FAT_OUT_OF_STRSPACE,
175     FAT_TOO_MANY_CASE_LABELS,
176     FAT_COUNT                           /* Fatal error count */
177 };
178
179
180
181 /* Count of errors/warnings */
182 extern unsigned ErrorCount;
183 extern unsigned WarningCount;
184
185
186
187 /*****************************************************************************/
188 /*                                   code                                    */
189 /*****************************************************************************/
190
191
192
193 void Warning (unsigned WarnNum, ...);
194 /* Print warning message. */
195
196 void PPWarning (unsigned WarnNum, ...);
197 /* Print warning message. For use within the preprocessor. */
198
199 void Error (unsigned ErrNum, ...);
200 /* Print an error message */
201
202 void PPError (unsigned ErrNum, ...);
203 /* Print an error message. For use within the preprocessor.  */
204
205 void Fatal (unsigned FatNum, ...);
206 /* Print a message about a fatal error and die */
207
208 void Internal (char* Format, ...) attribute ((noreturn));
209 /* Print a message about an internal compiler error and die. */
210
211 void ErrorReport (void);
212 /* Report errors (called at end of compile) */
213
214
215
216 /* End of error.h */
217 #endif
218
219
220
221
222