]> git.sur5r.net Git - cc65/blob - src/cc65/error.h
b67fcb240251571f7666ea50bcfb9ab0a1aceb69
[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 /* Error numbers */
53 enum Errors {
54     ERR_NONE,                           /* No error */
55     ERR_SYNTAX,
56     ERR_QUOTE_EXPECTED,
57     ERR_COLON_EXPECTED,
58     ERR_SEMICOLON_EXPECTED,
59     ERR_COMMA_EXPECTED,
60     ERR_LPAREN_EXPECTED,
61     ERR_RPAREN_EXPECTED,
62     ERR_LBRACK_EXPECTED,
63     ERR_RBRACK_EXPECTED,
64     ERR_LCURLY_EXPECTED,
65     ERR_RCURLY_EXPECTED,
66     ERR_IDENT_EXPECTED,
67     ERR_TYPE_EXPECTED,
68     ERR_INCOMPATIBLE_TYPES,
69     ERR_INCOMPATIBLE_POINTERS,
70     ERR_TOO_MANY_FUNC_ARGS,
71     ERR_TOO_FEW_FUNC_ARGS,
72     ERR_DUPLICATE_MACRO_ARG,
73     ERR_VAR_IDENT_EXPECTED,
74     ERR_INT_EXPR_EXPECTED,
75     ERR_CONST_EXPR_EXPECTED,
76     ERR_NO_ACTIVE_LOOP,
77     ERR_MULTIPLE_DEFINITION,
78     ERR_CONFLICTING_TYPES,
79     ERR_STRLIT_EXPECTED,
80     ERR_WHILE_EXPECTED,
81     ERR_MUST_RETURN_VALUE,
82     ERR_CANNOT_RETURN_VALUE,
83     ERR_UNEXPECTED_CONTINUE,
84     ERR_UNDEFINED_SYMBOL,
85     ERR_UNDEFINED_LABEL,
86     ERR_TOO_MANY_LOCALS,
87     ERR_TOO_MANY_INITIALIZERS,
88     ERR_INIT_INCOMPLETE_TYPE,
89     ERR_CANNOT_SUBSCRIPT,
90     ERR_OP_NOT_ALLOWED,
91     ERR_STRUCT_EXPECTED,
92     ERR_STRUCT_FIELD_MISMATCH,
93     ERR_STRUCT_PTR_EXPECTED,
94     ERR_LVALUE_EXPECTED,
95     ERR_EXPR_EXPECTED,
96     ERR_CPP_EXPR_EXPECTED,
97     ERR_ILLEGAL_TYPE,
98     ERR_ILLEGAL_FUNC_CALL,
99     ERR_ILLEGAL_INDIRECT,
100     ERR_ILLEGAL_ADDRESS,
101     ERR_ILLEGAL_HEX_DIGIT,
102     ERR_ILLEGAL_CHARCONST,
103     ERR_ILLEGAL_MODIFIER,
104     ERR_ILLEGAL_QUALIFIER,
105     ERR_ILLEGAL_STORAGE_CLASS,
106     ERR_ILLEGAL_ATTRIBUTE,
107     ERR_ILLEGAL_SEG_NAME,
108     ERR_DIV_BY_ZERO,
109     ERR_MOD_BY_ZERO,
110     ERR_RANGE,
111     ERR_SYMBOL_KIND,
112     ERR_LEVEL_NESTING,
113     ERR_MISSING_PARAM_NAME,
114     ERR_OLD_STYLE_PROTO,
115     ERR_PARAM_DECL,
116     ERR_CANNOT_TAKE_ADDR_OF_REG,
117     ERR_ILLEGAL_SIZE,
118     ERR_FASTCALL,
119     ERR_UNKNOWN_SIZE,
120     ERR_UNKNOWN_IDENT,
121     ERR_DUPLICATE_QUALIFIER,
122     ERR_CONST_ASSIGN,
123     ERR_QUAL_DIFF,
124     ERR_COUNT                           /* Error count */
125 };
126
127 /* Count of errors/warnings */
128 extern unsigned ErrorCount;
129 extern unsigned WarningCount;
130
131
132
133 /*****************************************************************************/
134 /*                                   code                                    */
135 /*****************************************************************************/
136
137
138
139 void Warning (const char* Format, ...) attribute ((format (printf, 1, 2)));
140 /* Print warning message. */
141
142 void PPWarning (const char* Format, ...) attribute ((format (printf, 1, 2)));
143 /* Print warning message. For use within the preprocessor. */
144
145 void Error (unsigned ErrNum, ...);
146 /* Print an error message */
147
148 void MError (const char* Format, ...) attribute ((format (printf, 1, 2)));
149 /* Print an error message */
150
151 void PPError (const char* Format, ...) attribute ((format (printf, 1, 2)));
152 /* Print an error message. For use within the preprocessor.  */
153
154 void Fatal (const char* Format, ...) attribute ((noreturn, format (printf, 1, 2)));
155 /* Print a message about a fatal error and die */
156
157 void Internal (char* Format, ...) attribute ((noreturn, format (printf, 1, 2)));
158 /* Print a message about an internal compiler error and die. */
159
160 void ErrorReport (void);
161 /* Report errors (called at end of compile) */
162
163
164
165 /* End of error.h */
166 #endif
167
168
169
170
171