#ifndef COMPILER_CERROR_H #define COMPILER_CERROR_H #include "compiler/common.h" #define CError_ASSERT(line, cond) if (!(cond)) { CError_Internal(__FILE__, line); } #define CError_FAIL(line, cond) if (cond) { CError_Internal(__FILE__, line); } #define CError_FATAL(line) do { CError_Internal(__FILE__, line); } while (0) enum { // "illegal character constant" CErrorStr100 = 100, // "illegal string constant" CErrorStr101 = 101, // "unexpected end of file" CErrorStr102 = 102, // "unterminated comment" CErrorStr103 = 103, // "undefined preprocessor directive" CErrorStr104 = 104, // "illegal token" CErrorStr105 = 105, // "string too long" CErrorStr106 = 106, // "identifier expected" CErrorStr107 = 107, // "macro '%u' redefined" CErrorStr108 = 108, // "illegal argument list" CErrorStr109 = 109, // "too many macro arguments" CErrorStr110 = 110, // "macro(s) too complex" CErrorStr111 = 111, // "unexpected end of line" CErrorStr112 = 112, // "end of line expected" CErrorStr113 = 113, // "'(' expected" CErrorStr114 = 114, // "')' expected" CErrorStr115 = 115, // "',' expected" CErrorStr116 = 116, // "preprocessor syntax error" CErrorStr117 = 117, // "preceding #if is missing" CErrorStr118 = 118, // "unterminated #if / macro" CErrorStr119 = 119, // "unexpected token" CErrorStr120 = 120, // "declaration syntax error" CErrorStr121 = 121, // "identifier '%u' redeclared" CErrorStr122 = 122, // "';' expected" CErrorStr123 = 123, // "illegal constant expression" CErrorStr124 = 124, // "']' expected" CErrorStr125 = 125, // "illegal use of 'void'" CErrorStr126 = 126, // "illegal function definition" CErrorStr127 = 127, // "illegal function return type" CErrorStr128 = 128, // "illegal array definition" CErrorStr129 = 129, // "'}' expected" CErrorStr130 = 130, // "illegal struct/union/enum/class definition" CErrorStr131 = 131, // "struct/union/enum/class tag '%u' redefined" CErrorStr132 = 132, // "struct/union/class member '%u' redefined" CErrorStr133 = 133, // "declarator expected" CErrorStr134 = 134, // "'{' expected" CErrorStr135 = 135, // "illegal use of incomplete struct/union/class '%t'" CErrorStr136 = 136, // "struct/union/class size exceeds 32K" CErrorStr137 = 137, // "illegal bitfield declaration" CErrorStr138 = 138, // "division by 0" CErrorStr139 = 139, // "undefined identifier '%u'" CErrorStr140 = 140, // "expression syntax error" CErrorStr141 = 141, // "not an lvalue" CErrorStr142 = 142, // "illegal operation" CErrorStr143 = 143, // "illegal operand" CErrorStr144 = 144, // "data type is incomplete" CErrorStr145 = 145, // "illegal type" CErrorStr146 = 146, // "too many initializers" CErrorStr147 = 147, // "pointer/array required" CErrorStr148 = 148, // "not a struct/union/class" CErrorStr149 = 149, // "'%u' is not a struct/union/class member" CErrorStr150 = 150, // "the file '%u' cannot be opened" CErrorStr151 = 151, // "illegal instruction for this processor" CErrorStr152 = 152, // "illegal operands for this processor" CErrorStr153 = 153, // "number is out of range" CErrorStr154 = 154, // "illegal addressing mode" CErrorStr155 = 155, // "illegal data size" CErrorStr156 = 156, // "illegal register list" CErrorStr157 = 157, // "branch out of range" CErrorStr158 = 158, // "undefined label '%u'" CErrorStr159 = 159, // "reference to label '%u' is out of range" CErrorStr160 = 160, // "call of non-function" CErrorStr161 = 161, // "function call does not match prototype" CErrorStr162 = 162, // "illegal use of register variable" CErrorStr163 = 163, // "illegal type cast" CErrorStr164 = 164, // "function already has a stackframe" CErrorStr165 = 165, // "function has no initialized stackframe" CErrorStr166 = 166, // "value is not stored in register" CErrorStr167 = 167, // "function nesting too complex" CErrorStr168 = 168, // "illegal use of keyword" CErrorStr169 = 169, // "':' expected" CErrorStr170 = 170, // "label '%u' redefined" CErrorStr171 = 171, // "case constant defined more than once" CErrorStr172 = 172, // "default label defined more than once" CErrorStr173 = 173, // "illegal initialization" CErrorStr174 = 174, // "illegal use of inline function" CErrorStr175 = 175, // "illegal type qualifier(s)" CErrorStr176 = 176, // "illegal storage class" CErrorStr177 = 177, // "function has no prototype" CErrorStr178 = 178, // "illegal assignment to constant" CErrorStr179 = 179, // "illegal use of precompiled header" CErrorStr180 = 180, // "illegal data in precompiled header" CErrorStr181 = 181, // "variable / argument '%u' is not used in function" CErrorStr182 = 182, // "illegal use of direct parameters" CErrorStr183 = 183, // "return value expected" CErrorStr184 = 184, // "variable '%u' is not initialized before being used" CErrorStr185 = 185, // "illegal #pragma" CErrorStr186 = 186, // "illegal access to protected/private member" CErrorStr187 = 187, // "ambiguous access to class/struct/union member" CErrorStr188 = 188, // "illegal use of 'this'" CErrorStr189 = 189, // "unimplemented C++ feature" CErrorStr190 = 190, // "illegal use of 'HandleObject'" CErrorStr191 = 191, // "illegal access qualifier" CErrorStr192 = 192, // "illegal 'operator' declaration" CErrorStr193 = 193, // "illegal use of abstract class ('%o')" CErrorStr194 = 194, // "illegal use of pure function" CErrorStr195 = 195, // "illegal '&' reference" CErrorStr196 = 196, // "illegal function overloading" CErrorStr197 = 197, // "illegal operator overloading" CErrorStr198 = 198, // "ambiguous access to overloaded function " CErrorStr199 = 199, // "illegal access/using declaration" CErrorStr200 = 200, // "illegal 'friend' declaration" CErrorStr201 = 201, // "illegal 'inline' function definition" CErrorStr202 = 202, // "class has no default constructor" CErrorStr203 = 203, // "illegal operator" CErrorStr204 = 204, // "illegal default argument(s)" CErrorStr205 = 205, // "possible unwanted ';'" CErrorStr206 = 206, // "possible unwanted assignment" CErrorStr207 = 207, // "possible unwanted compare" CErrorStr208 = 208, // "illegal implicit conversion from '%t' to\n'%t'" CErrorStr209 = 209, // "local data >32k" CErrorStr210 = 210, // "illegal jump past initializer" CErrorStr211 = 211, // "illegal ctor initializer" CErrorStr212 = 212, // "cannot construct %t's base class '%t'" CErrorStr213 = 213, // "cannot construct %t's direct member '%u'" CErrorStr214 = 214, // "#if nesting overflow" CErrorStr215 = 215, // "illegal empty declaration" CErrorStr216 = 216, // "illegal implicit enum conversion from '%t' to\n'%t'" CErrorStr217 = 217, // "illegal use of #pragma parameter" CErrorStr218 = 218, // "virtual functions cannot be pascal functions" CErrorStr219 = 219, // "illegal implicit const/volatile pointer conversion from '%t' to\n'%t'" CErrorStr220 = 220, // "illegal use of non-static member" CErrorStr221 = 221, // "illegal precompiled header version" CErrorStr222 = 222, // "illegal precompiled header compiler flags or target" CErrorStr223 = 223, // "'const' or '&' variable needs initializer" CErrorStr224 = 224, // "'%o' hides inherited virtual function '%o'" CErrorStr225 = 225, // "pascal function cannot be overloaded" CErrorStr226 = 226, // "derived function differs from virtual base function in return type only" CErrorStr227 = 227, // "non-const '&' reference initialized to temporary" CErrorStr228 = 228, // "illegal template declaration" CErrorStr229 = 229, // "'<' expected" CErrorStr230 = 230, // "'>' expected" CErrorStr231 = 231, // "illegal template argument(s)" CErrorStr232 = 232, // "cannot instantiate '%o'" CErrorStr233 = 233, // "template redefined" CErrorStr234 = 234, // "template parameter mismatch" CErrorStr235 = 235, // "cannot pass const/volatile data object to non-const/volatile member function" CErrorStr236 = 236, // "preceding '#pragma push' is missing" CErrorStr237 = 237, // "illegal explicit template instantiation" CErrorStr238 = 238, // "illegal X::X(X) copy constructor" CErrorStr239 = 239, // "function defined 'inline' after being called" CErrorStr240 = 240, // "illegal constructor/destructor declaration" CErrorStr241 = 241, // "'catch' expected" CErrorStr242 = 242, // "#include nesting overflow" CErrorStr243 = 243, // "cannot convert\n'%t' to\n'%t'" CErrorStr244 = 244, // "type mismatch\n'%t' and\n'%t'" CErrorStr245 = 245, // "class type expected" CErrorStr246 = 246, // "illegal explicit conversion from '%t' to\n'%t'" CErrorStr247 = 247, // "function call '*' does not match" CErrorStr248 = 248, // "identifier '%u' redeclared\nwas declared as: '%t'\nnow declared as: '%t'" CErrorStr249 = 249, // "cannot throw class with ambiguous base class ('%u')" CErrorStr250 = 250, // "class '%t': '%o' has more than one final overrider:\n'%o'\nand '%o'" CErrorStr251 = 251, // "exception handling option is disabled" CErrorStr252 = 252, // "cannot delete pointer to const" CErrorStr253 = 253, // "cannot destroy const object" CErrorStr254 = 254, // "const member '%u' is not initialized" CErrorStr255 = 255, // "'&' reference member '%u' is not initialized" CErrorStr256 = 256, // "RTTI option is disabled" CErrorStr257 = 257, // "constness casted away" CErrorStr258 = 258, // "illegal const/volatile '&' reference initialization" CErrorStr259 = 259, // "inconsistent linkage: 'extern' object redeclared as 'static'" CErrorStr260 = 260, // "unknown assembler instruction mnemonic" CErrorStr261 = 261, // "local data > 224 bytes" CErrorStr262 = 262, // "'%u' could not be assigned to a register" CErrorStr263 = 263, // "illegal exception specification" CErrorStr264 = 264, // "exception specification list mismatch" CErrorStr265 = 265, // "the parameter(s) of the '%n' function must be immediate value(s)" CErrorStr266 = 266, // "SOM classes can only inherit from other SOM based classes" CErrorStr267 = 267, // "SOM classes inhertiance must be virtual" CErrorStr268 = 268, // "SOM class data members must be private" CErrorStr269 = 269, // "illegal SOM function overload '%o'" CErrorStr270 = 270, // "no static members allowed in SOM classes" CErrorStr271 = 271, // "no parameters allowed in SOM class constructors" CErrorStr272 = 272, // "illegal SOM function parameters or return type" CErrorStr273 = 273, // "SOM runtime function '%u' not defined (should be defined in somobj.hh)" CErrorStr274 = 274, // "SOM runtime function '%u' has unexpected type" CErrorStr275 = 275, // "'%u' is not a SOM class" CErrorStr276 = 276, // "illegal use of #pragma outside of SOM class definition" CErrorStr277 = 277, // "introduced method '%o' is not specified in release order list" CErrorStr278 = 278, // "SOM class access qualification only allowed to direct parent or own class" CErrorStr279 = 279, // "SOM class must have one non-inline member function" CErrorStr280 = 280, // "SOM type '%u' undefined" CErrorStr281 = 281, // "new SOM callstyle method '%o' must have explicit 'Environment *' parameter" CErrorStr282 = 282, // "functions cannot return SOM classes" CErrorStr283 = 283, // "functions cannot have SOM class arguments" CErrorStr284 = 284, // "assignment is not supported for SOM classes" CErrorStr285 = 285, // "sizeof() is not supported for SOM classes" CErrorStr286 = 286, // "SOM classes cannot be class members" CErrorStr287 = 287, // "global SOM class objects are not supported" CErrorStr288 = 288, // "SOM class arrays are not supported" CErrorStr289 = 289, // "'pointer to member' is not supported for SOM classes" CErrorStr290 = 290, // "SOM class has no release order list" CErrorStr291 = 291, // "'%u' is not an Objective-C class" CErrorStr292 = 292, // "method '%m' redeclared" CErrorStr293 = 293, // "undefined method '%m'" CErrorStr294 = 294, // "class '%u' redeclared" CErrorStr295 = 295, // "class '%u' redefined" CErrorStr296 = 296, // "Objective-C type '%u' is undefined (should be defined in objc.h)" CErrorStr297 = 297, // "Objective-C type '%u' has unexpected type" CErrorStr298 = 298, // "method '%m' not defined" CErrorStr299 = 299, // "method '%m' redefined" CErrorStr300 = 300, // "illegal use of 'self'" CErrorStr301 = 301, // "illegal use of 'super'" CErrorStr302 = 302, // "illegal message receiver" CErrorStr303 = 303, // "receiver cannot handle this message" CErrorStr304 = 304, // "ambiguous message selector\nused: '%m'\nalso had: '%m'" CErrorStr305 = 305, // "unknown message selector" CErrorStr306 = 306, // "illegal use of Objective-C object" CErrorStr307 = 307, // "protocol '%u' redefined" CErrorStr308 = 308, // "protocol '%u' is undefined" CErrorStr309 = 309, // "protocol '%u' is already in protocol list" CErrorStr310 = 310, // "category '%u' redefined" CErrorStr311 = 311, // "category '%u' is undefined" CErrorStr312 = 312, // "illegal use of '%u'" CErrorStr313 = 313, // "template too complex or recursive" CErrorStr314 = 314, // "illegal return value in void/constructor/destructor function" CErrorStr315 = 315, // "assigning a non-int numeric value to an unprototyped function" CErrorStr316 = 316, // "implicit arithmetic conversion from '%t' to '%t'" CErrorStr317 = 317, // "preprocessor #error directive" CErrorStr318 = 318, // "ambiguous access to name found '%u' and '%u'" CErrorStr319 = 319, // "illegal namespace" CErrorStr320 = 320, // "illegal use of namespace name" CErrorStr321 = 321, // "illegal name overloading" CErrorStr322 = 322, // "instance variable list does not match @interface" CErrorStr323 = 323, // "protocol list does not match @interface" CErrorStr324 = 324, // "super class does not match @interface" CErrorStr325 = 325, // "function result is a pointer/reference to an automatic variable" CErrorStr326 = 326, // "cannot allocate initialized objects in the scratchpad" CErrorStr327 = 327, // "illegal class member access" CErrorStr328 = 328, // "data object '%o' redefined" CErrorStr329 = 329, // "illegal access to local variable from other function" CErrorStr330 = 330, // "illegal implicit member pointer conversion" CErrorStr331 = 331, // "typename redefined" CErrorStr332 = 332, // "object '%o' redefined" CErrorStr333 = 333, // "'main' not defined as external 'int main()' function" CErrorStr334 = 334, // "illegal explicit template specialization" CErrorStr335 = 335, // "name has not been declared in namespace/class" CErrorStr336 = 336, // "preprocessor #warning directive" CErrorStr337 = 337, // "illegal use of asm inline function" CErrorStr338 = 338, // "illegal use of C++ feature in EC++" CErrorStr339 = 339, // "illegal use template argument dependent type 'T::%u'" CErrorStr340 = 340, // "illegal use of alloca() in function argument" CErrorStr341 = 341, // "inline function call '%o' not inlined" CErrorStr342 = 342, // "inconsistent use of 'class' and 'struct' keywords" CErrorStr343 = 343, // "illegal partial specialization" CErrorStr344 = 344, // "illegal partial specialization argument list" CErrorStr345 = 345, // "ambiguous use of partial specialization" CErrorStr346 = 346, // "local classes shall not have member templates" CErrorStr347 = 347, // "illegal template argument dependent expression" CErrorStr348 = 348, // "implicit 'int' is no longer supported in C++" CErrorStr349 = 349, // "%i pad byte(s) inserted after data member '%u'" CErrorStr350 = 350, // "pure function '%o' is not virtual" CErrorStr351 = 351, // "illegal virtual function '%o' in 'union'" CErrorStr352 = 352, // "cannot pass 'void' or 'function' parameter" CErrorStr353 = 353, // "illegal static const member '%u' initialization" CErrorStr354 = 354, // "'typename' is missing in template argument dependent qualified type" CErrorStr355 = 355, // "more than one expression in non-class type conversion" CErrorStr356 = 356, // "template non-type argument objects shall have external linkage" CErrorStr357 = 357, // "illegal inline assembly operand: %u" CErrorStr358 = 358, // "illegal or unsupported __attribute__" CErrorStr359 = 359, // "cannot create object file '%f'" CErrorStr360 = 360, // "error writing to object file '%f'" CErrorStr361 = 361, // "printf-family format string doesn't match arguments" CErrorStr362 = 362, // "scanf-family format string doesn't match arguments" CErrorStr363 = 363, // "__alignof__() is not supported for SOM classes" CErrorStr364 = 364, // "illegal macro argument name '%u'" CErrorStr365 = 365, // "case has an empty range of values" CErrorStr366 = 366, // "'long long' switch() is not supported" CErrorStr367 = 367, // "'long long' case range is not supported" CErrorStr368 = 368, // "expression has no side effect" CErrorStr369 = 369, // "result of function call is not used" CErrorStr370 = 370, // "illegal non-type template argument" CErrorStr371 = 371, // "illegal use of abstract class ('%t')" CErrorStr372 = 372, // "illegal use of 'template' prefix" CErrorStr373 = 373, // "template parameter/argument list mismatch" CErrorStr374 = 374, // "cannot find matching deallocation function for '%t'" CErrorStr375 = 375, // "illegal operand '%t'" CErrorStr376 = 376, // "illegal operands '%t' %u '%t'" CErrorStr377 = 377, // "illegal use of default template-argument" CErrorStr378 = 378, // "illegal UUID syntax" CErrorStr379 = 379, // "__uuidof() is not supported for SOM classes" CErrorStr380 = 380, // "illegal access from '%t' to protected/private member '%o'" CErrorStr381 = 381, // "integral type is not large enough to hold pointer" CErrorStr382 = 382, // "unknown x86 assembler instruction mnemonic" CErrorStr383 = 383, // "illegal use of const/volatile function qualifier sequence" CErrorStr384 = 384, // "illegal optimization level for this limited version of CodeWarrior" CErrorStr385 = 385, // "no UUID defined for type '%t'" CErrorStr386 = 386, // "using implicit copy assigment for class with const or reference member ('%t')" CErrorStr387 = 387, // "unimplemented assembler instruction/directive" CErrorStr388 = 388, // "override of dllimport function '%u' only has application scope" CErrorStr389 = 389, // "illegal combination of operands in inline statement at line %i" CErrorStr390 = 390, // "illegal operand in inline statement at line %i" CErrorStr391 = 391, // "function call '*' is ambiguous" CErrorStr392 = 392, CErrorStrMAX = 393 }; typedef struct _CErrorBuffer { char *start; char *end; UInt32 size; UInt32 remaining; } CErrorBuffer; extern TStreamElement *cerror_locktoken; extern char cerror_synchdata[32]; extern short cerror_synchoffset; extern int CError_BreakPointcount; extern void CError_Init(void); extern void CError_SetErrorToken(TStreamElement *token); extern void CError_SetNullErrorToken(void); extern void CError_LockErrorPos(TStreamElement *token, TStreamElement **saved); extern void CError_UnlockErrorPos(TStreamElement **saved); extern void CError_ResetErrorSkip(void); extern void CError_GetErrorString(char *buf, short code); extern void CError_BufferInit(CErrorBuffer *eb, char *buf, SInt32 bufSize); extern void CError_BufferGrow(CErrorBuffer *eb, SInt32 amount); extern void CError_BufferAppendChar(CErrorBuffer *eb, char ch); extern void CError_BufferAppendString(CErrorBuffer *eb, const char *str); extern void CError_BufferTerminate(CErrorBuffer *eb); extern void CError_BufferAppendQualifier(CErrorBuffer *eb, UInt32 qual); extern void CError_BufferAppendTemplArgExpr(CErrorBuffer *eb, ENode *node); extern void CError_BufferAppendTemplArg(CErrorBuffer *eb, TemplArg *targ); extern void CError_BufferAppendTemplArgs(CErrorBuffer *eb, TemplArg *targs); extern void CError_BufferAppendNameSpace(CErrorBuffer *eb, NameSpace *nspace); extern void CError_BufferAppendPType(CErrorBuffer *eb, Type *ty); extern void CError_BufferAppendTemplDepType(CErrorBuffer *eb, TypeTemplDep *type); extern void CError_BufferAppendFuncArgs(CErrorBuffer *eb, TypeFunc *tfunc, Boolean isMethod); extern void CError_BufferAppendType(CErrorBuffer *eb, Type *ty, UInt32 qual); extern char *CError_GetTypeName(Type *ty, UInt32 qual, Boolean useGlobalHeap); extern void CError_AppendUnqualFunctionName(CErrorBuffer *eb, NameSpace *nspace, HashNameNode *name, TypeFunc *tfunc); extern void CError_AppendFunctionName(CErrorBuffer *eb, NameSpace *nspace, HashNameNode *name, TemplArg *templargs, TypeFunc *tfunc); extern void CError_AppendObjectName(CErrorBuffer *eb, Object *obj); extern void CError_AppendMethodName(CErrorBuffer *eb, ObjCMethod *meth); extern char *CError_GetQualifiedName(NameSpace *nspace, HashNameNode *name); extern char *CError_GetFunctionName(NameSpace *nspace, HashNameNode *name, TypeFunc *tfunc); extern char *CError_GetObjectName(Object *obj); extern char *CError_GetNameString(NameSpace *nspace, HashNameNode *operatorName); extern void CError_ErrorMessage(int errTable, char *buf, Boolean flag1, Boolean flag2); extern void CError_BufferAppendTemplateStack(CErrorBuffer *eb); extern void CError_ErrorMessageVA(int code, const char *format, va_list list, Boolean flag1, Boolean flag2); extern void CError_VAErrorMessage(int code, va_list list, Boolean flag1, Boolean flag2); extern void CError_Error(int code, ...); extern void CError_ErrorTerm(short code); extern void CError_ErrorSkip(int code, ...); extern void CError_ErrorFuncCall(short code, NameSpaceObjectList *args, ENodeList *argNodes); extern void CError_OverloadedFunctionError2(Object *obj, ObjectList *olst, ENodeList *argNodes); extern void CError_OverloadedFunctionError(Object *obj, ObjectList *olst); extern void CError_AbstractClassError(TypeClass *tclass); extern void CError_Warning(int code, ...); extern void CError_BreakPoint(const char *a, const char *b); extern void CError_Internal(char *filename, int line); extern void CError_ExpressionTooComplex(void); extern void CError_NoMem(void); extern void CError_UserBreak(void); extern void CError_CannotOpen(void); extern void CError_QualifierCheck(UInt32 qual); #endif