1 /* SDCCerr.c - error handling routines */
8 extern int fatalError ;
10 extern char *filename;
16 { ERROR ,"error *** Duplicate symbol '%s', symbol IGNORED\n" },
17 { ERROR ,"error *** Syntax Error Declaration ingonerd\n" },
18 { ERROR ,"error *** Constant Expected Found Variable\n" },
19 { ERROR ,"error *** 'malloc' failed file '%s' for size %ld\n" },
20 { ERROR ,"error *** 'fopen' failed on file '%s'\n" },
21 { ERROR ,"error *** Internal Error Oclass invalid '%s'\n" },
22 { ERROR ,"error *** Cannot allocate variable '%s'.\n" },
23 { ERROR ,"error *** Old style C declaration. IGNORED '%s'\n" },
24 { ERROR ,"error *** Out of stack Space. '%s' not allocted\n" },
25 { ERROR ,"error *** FATAL Compiler Internal Error in file '%s' line number '%d' : %s \nContact Author with source code\n" },
26 { ERROR ,"error *** 'lvalue' required for '%s' operation .\n" },
27 { ERROR ,"error *** Creation of temp file failed\n" },
28 { ERROR ,"error *** Function expected here '%s'\n" },
29 { ERROR ,"error *** 'using', 'interrupt' or 'reentrant' must follow a function definiton .'%s'\n"},
30 { ERROR ,"error *** Absolute address & initial value both cannot be specified for\n a 'sfr','sbit' storage class, initial value ignored '%s'\n" },
31 { WARNING,"warning *** Variable in the storage class cannot be initialized.'%s'\n"},
32 { WARNING,"warning *** storage class not allowed for automatic variable '%s' in reentrant function\n" },
33 { ERROR ,"error *** absolute address not allowed for automatic var '%s' in reentrant function \n" },
34 { WARNING,"warning *** Initializer different levels of indirections\n" },
35 { ERROR ,"error *** Function name '%s' redefined \n" },
36 { ERROR ,"error *** Undefined identifier '%s'\n" },
37 { WARNING,"warning *** stack exceeds 256 bytes for function '%s'\n"},
38 { ERROR ,"error *** Array or pointer required for '%s' operation \n" },
39 { ERROR ,"error *** Array index not an integer\n" },
40 { ERROR ,"error *** Array bound Exceeded, assuming zero\n" },
41 { ERROR ,"error *** Structure/Union expected left of '.%s'\n" },
42 { ERROR ,"error *** '%s' not a structure/union member\n" },
43 { ERROR ,"error *** Pointer required\n" },
44 { ERROR ,"error *** 'unary %c': illegal operand\n" },
45 { ERROR ,"error *** convertion error: integral promotion failed\n" },
46 { ERROR ,"error *** type must be INT for bit field definition\n" },
47 { ERROR ,"error *** bit field size greater than 16 . assuming 16\n" },
48 { WARNING,"warning *** high order truncation might occur\n" },
49 { ERROR ,"error *** Attempt to assign value to a constant variable %s\n" },
50 { ERROR ,"error *** Lvalue specifies constant object\n" },
51 { ERROR ,"error *** '&' illegal operand , %s\n" },
52 { ERROR ,"error *** illegal cast (cast cannot be aggregate)\n" },
53 { ERROR ,"error *** '*' bad operand\n" },
54 { ERROR ,"error *** Argument count error, argument ignored\n" },
55 { ERROR ,"error *** Function was expecting more arguments\n" },
56 { ERROR ,"error *** Function name expected '%s'.ANSI style declaration REQUIRED\n"},
57 { ERROR ,"error *** invalid operand '%s'\n" },
58 { ERROR ,"error *** pointer + pointer invalid\n" },
59 { ERROR ,"error *** invalid operand for shift operator\n" },
60 { ERROR ,"error *** compare operand cannot be struct/union\n" },
61 { ERROR ,"error *** operand invalid for bitwise operation\n" },
62 { ERROR ,"error *** Invalid operand for '&&' or '||'\n" },
63 { WARNING,"warning *** indirections to different types %s %s \n" },
64 { ERROR ,"error *** cannot assign values to aggregates\n" },
65 { ERROR ,"error *** bit Arrays can be accessed by literal index only\n" },
66 { ERROR ,"error *** Array or Pointer to bit|sbit|sfr not allowed.'%s'\n" },
67 { ERROR ,"error *** typedef/enum '%s' duplicate.Previous definiton Ignored\n" },
68 { ERROR ,"error *** Actual Argument type different from declaration %d\n" },
69 { ERROR ,"error *** Function return value mismatch\n" },
70 { ERROR ,"error *** Function cannot return aggregate. Func body ignored\n" },
71 { ERROR ,"error *** ANSI Style declaration needed\n" },
72 { ERROR ,"error *** Label name redefined '%s'\n" },
73 { ERROR ,"error *** Label undefined '%s'\n" },
74 { ERROR ,"error *** void function returning value\n" },
75 { ERROR ,"error *** function '%s' must return value\n" },
76 { WARNING,"warning *** function return value mismatch\n" },
77 { ERROR ,"error *** 'case/default' found without 'switch'.statement ignored\n" },
78 { ERROR ,"error *** 'case' expression not constant. statement ignored\n" },
79 { ERROR ,"error *** 'break/continue' statement out of context\n" },
80 { ERROR ,"error *** nonintegral used in switch expression\n" },
81 { ERROR ,"error *** function '%s' already has body\n" },
82 { ERROR ,"error *** attempt to allocate variable of unknown size '%s'\n" },
83 { ERROR ,"error *** aggregate 'auto' variable '%s' cannot be initialized\n" },
84 { ERROR ,"error *** too many initializers\n" },
85 { ERROR ,"error *** struct/union/array '%s' :initialization needs curly braces\n"},
86 { ERROR ,"error *** non-address initialization expression\n" },
87 { ERROR ,"error *** interrupt no '%d' already has a service routine '%s'\n" },
88 { ERROR ,"error *** interrupt routine cannot have arguments, arguments ingored\n"},
89 { ERROR ,"error *** critical compiler #include file missing. \n" },
90 { ERROR ,"error *** function 'main' undefined\n" },
91 { ERROR ,"error *** 'extern' variable '%s' cannot be initialised \n" },
92 { ERROR ,"error *** Pre-Processor %s\n" },
93 { ERROR ,"error *** _dup call failed\n" },
94 { WARNING,"warning *** pointer being cast to incompatible type \n" },
95 { WARNING,"warning *** 'while' loop with 'zero' constant.loop eliminated\n" },
96 { WARNING,"warning *** %s expression has NO side effects.expr eliminated\n" },
97 { WARNING,"warning *** constant value '%s', out of range.\n" },
98 { WARNING,"warning *** comparison will either, ALWAYs succeed or ALWAYs fail\n" },
99 { ERROR ,"error *** Compiler Terminating , contact author with source\n" },
100 { WARNING,"warning *** 'auto' variable '%s' may be used before initialization at %s(%d)\n" },
101 { WARNING,"warning *** in function %s unreferenced %s : '%s'\n" },
102 { ERROR ,"error *** unknown size for operand\n" },
103 { WARNING,"warning *** '%s' 'long' not supported , declared as 'int' .\n" },
104 { WARNING,"warning *** LITERAL value being cast to '_generic' pointer\n" },
105 { ERROR ,"error *** %s '%s' address out of range\n" },
106 { ERROR ,"error *** storage class CANNOT be specified for bit variable '%s'\n" },
107 { WARNING,"warning *** extern definition for '%s' mismatches with declaration.\n" },
108 { WARNING,"warning *** Functions called via pointers must be 'reentrant' to take arguments\n" },
109 { WARNING,"warning *** type 'double' not supported assuming 'float'\n" },
110 { WARNING,"warning *** if-statement condition always false.if-statement not generated\n"},
111 { WARNING,"warning *** no 'return' statement found for function '%s'\n" },
112 { WARNING,"warning *** Pre-Processor %s\n" },
113 { WARNING,"warning *** structure '%s' passed as function argument changed to pointer\n"},
114 { ERROR ,"error *** conflict with previous definition of '%s' for attribute '%s'\n" },
115 { ERROR ,"error *** variable '%s' declared in code space must have initialiser\n" },
116 { ERROR ,"error *** operands not integral for assignment operation\n" },
117 { ERROR ,"error *** too many parameters \n" },
118 { ERROR ,"error *** to few parameters\n" },
119 { ERROR ,"error *** code not generated for '%s' due to previous errors\n"},
120 { WARNING,"warning *** type mismatch for parameter number %d\n"},
121 { ERROR ,"error *** invalid float constant '%s'\n"},
122 { ERROR ,"error *** invalid operand for '%s' operation\n"},
123 { ERROR ,"error *** switch value not an integer\n"},
124 { ERROR ,"error *** case label not an integer\n"},
125 { WARNING,"warning *** function '%s' too large for global optimization\n"},
126 { WARNING,"warning *** conditional flow changed by optimizer '%s(%d)':so said EVELYN the modified DOG\n"},
127 { WARNING,"warning *** invalid type specifier for pointer type specifier ignored\n"},
128 { WARNING,"warning *** function '%s' implicit declaration\n"},
129 { WARNING,"warning *** %s"},
130 { WARNING,"info *** %s extended by %d bytes for compiler temp(s) :in function '%s': %s \n"},
131 { WARNING,"warning *** unknown or unsupported #pragma directive '%s'\n"},
132 { WARNING,"warning *** %s shifting more than size of object changed to zero\n"},
133 { WARNING,"warning *** unknown compiler option '%s' ignored\n"},
134 { WARNING,"warning *** option '%s' no longer supported '%s' \n"},
135 { WARNING,"warning *** don't know what to do with file '%s'. file extension unsupported\n"},
136 { WARNING,"warning *** cannot compile more than one source file . file '%s' ignored\n"},
137 { WARNING,"info *** function '%s', # edges %d , # nodes %d , cyclomatic complexity %d\n"},
138 { ERROR ,"error *** dividing by ZERO\n"},
139 { ERROR ,"error *** function cannot return 'bit'\n"},
140 { ERROR ,"error *** casting from to type 'void' is illegal\n"},
141 { WARNING,"warning *** constant is out of range %s\n" },
142 { WARNING,"warning *** unreachable code %s(%d)\n"},
143 { WARNING,"warning *** non-pointer type cast to _generic pointer\n"},
144 { WARNING,"warning *** possible code generation error at line %d,\n send source to sandeep.dutta@usa.net\n"},
145 { WARNING,"warning *** pointer types incompatible \n" },
146 { WARNING,"warning *** unknown memory model at %s : %d\n" },
147 { ERROR ,"error *** cannot generate code for target '%s'\n"}
150 /****************************************************************************/
151 /* werror - writes an error to the listing file & to standarderr */
152 /****************************************************************************/
153 void werror (int errNum, ... )
158 if ( ErrTab[errNum].errType== ERROR )
161 if ( filename && lineno ) {
162 fprintf(stderr,"%s(%d):",filename,lineno);
164 va_start(marker,errNum);
165 vfprintf(stderr,ErrTab[errNum].errText,marker);