]>
Commit | Line | Data |
---|---|---|
885824d3 | 1 | /* |
28bf4b0b | 2 | ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2001. |
885824d3 | 3 | ** See ../LICENSE for license information. |
4 | */ | |
5 | # ifndef UENTRY_H | |
6 | # define UENTRY_H | |
7 | # define CENTRY_H | |
8 | ||
9 | /* | |
10 | ** universal symbol table entry | |
11 | ** (combines old llentry, centry, and ttentry) | |
12 | */ | |
13 | ||
14 | /* | |
15 | ** vkind --- need to fix value for consistency in dump files | |
16 | */ | |
17 | ||
28bf4b0b | 18 | typedef struct |
885824d3 | 19 | { |
20 | /*@only@*/ multiVal val; | |
21 | typeIdSet access; | |
22 | } *ucinfo; | |
23 | ||
24 | typedef enum | |
25 | { | |
26 | VKSPEC = 0, VKNORMAL, | |
27 | VKPARAM, VKYIELDPARAM, VKREFYIELDPARAM, | |
28 | VKRETPARAM, VKREFPARAM, | |
29 | VKSEFPARAM, VKREFSEFPARAM, | |
30 | VKSEFRETPARAM, VKREFSEFRETPARAM, | |
31 | VKEXPMACRO | |
32 | } vkind; | |
33 | ||
34 | /*@constant vkind VKFIRST;@*/ | |
35 | # define VKFIRST VKSPEC | |
36 | ||
37 | /*@constant vkind VKLAST;@*/ | |
38 | # define VKLAST VKEXPMACRO | |
39 | ||
40 | typedef enum | |
41 | { | |
42 | CH_UNKNOWN, | |
43 | CH_UNCHECKED, | |
44 | CH_CHECKED, | |
45 | CH_CHECKMOD, | |
46 | CH_CHECKEDSTRICT | |
47 | } chkind; | |
48 | ||
1ac6313d | 49 | /* start modifications */ |
28bf4b0b | 50 | typedef enum { |
1ac6313d | 51 | BB_POSSIBLYNULLTERMINATED, /* buffer is possibly nullterm(can't decide statically) */ |
52 | BB_NULLTERMINATED, /*buffer is known to be nullterminated */ | |
53 | BB_NOTNULLTERMINATED /* buffer is known to be not nullterm */ | |
54 | } bbufstate; | |
55 | ||
28bf4b0b | 56 | typedef struct s_bbufinfo { |
1ac6313d | 57 | bbufstate bufstate; /* state of the buffer */ |
58 | int size; /* size of the buffer allocated */ | |
59 | int len; /* len of the buffer VALID ONLY IF state is NULLTERM */ | |
60 | } *bbufinfo ; | |
61 | ||
28bf4b0b | 62 | typedef struct |
885824d3 | 63 | { |
64 | vkind kind; /* kind (parameter, specified) */ | |
65 | chkind checked; /* how is it checked */ | |
66 | sstate defstate; | |
67 | nstate nullstate; | |
1ac6313d | 68 | bbufinfo bufinfo; /* is valid only if the entry is a variable and (a pointer |
69 | or array) */ | |
885824d3 | 70 | } *uvinfo ; |
1ac6313d | 71 | /* end modifications */ |
885824d3 | 72 | |
28bf4b0b | 73 | typedef struct |
885824d3 | 74 | { |
75 | ynm abs; | |
76 | ynm mut; | |
77 | ctype type; | |
78 | } *udinfo ; | |
79 | ||
80 | /* information for specified functions */ | |
81 | ||
82 | typedef enum | |
83 | { | |
84 | SPC_NONE, | |
85 | SPC_PRINTFLIKE, | |
86 | SPC_SCANFLIKE, | |
87 | SPC_MESSAGELIKE, | |
88 | SPC_LAST | |
89 | } specCode; | |
90 | ||
28bf4b0b | 91 | typedef struct |
885824d3 | 92 | { |
93 | qual nullPred; | |
94 | specCode specialCode; | |
95 | exitkind exitCode; | |
96 | typeIdSet access; /* access types */ | |
97 | ||
98 | /*@owned@*/ globSet globs; /* globals list */ | |
99 | /*@owned@*/ sRefSet mods; /* modifies */ | |
100 | ||
28bf4b0b | 101 | stateClauseList specclauses; |
885824d3 | 102 | |
103 | /*@dependent@*/ uentryList defparams; | |
104 | bool hasGlobs BOOLBITS; | |
105 | bool hasMods BOOLBITS; | |
93307a76 | 106 | |
3814599d | 107 | functionConstraint preconditions; |
108 | functionConstraint postconditions; | |
93307a76 | 109 | |
885824d3 | 110 | } *ufinfo ; |
111 | ||
28bf4b0b | 112 | typedef struct |
885824d3 | 113 | { |
114 | typeIdSet access; | |
115 | /*@owned@*/ globSet globs; /* globals list */ | |
116 | /*@owned@*/ sRefSet mods; /* modifies */ | |
117 | } *uiinfo ; | |
118 | ||
28bf4b0b | 119 | typedef struct |
885824d3 | 120 | { |
121 | typeIdSet access; | |
122 | } *ueinfo ; | |
123 | ||
28bf4b0b | 124 | typedef union |
885824d3 | 125 | { |
126 | ucinfo uconst; | |
127 | uvinfo var; | |
128 | udinfo datatype; | |
129 | ufinfo fcn; | |
130 | uiinfo iter; | |
131 | ueinfo enditer; | |
132 | } *uinfo ; | |
133 | ||
28bf4b0b | 134 | struct s_uentry |
885824d3 | 135 | { |
136 | ekind ukind; | |
137 | cstring uname; | |
138 | ctype utype; | |
139 | ||
140 | fileloc whereSpecified; | |
141 | fileloc whereDefined; | |
142 | fileloc whereDeclared; | |
143 | ||
144 | /* meaning of sref is different for: | |
145 | ** variables current state | |
146 | ** functions state of return value | |
147 | ** types state of datatype | |
148 | */ | |
28bf4b0b | 149 | |
885824d3 | 150 | /*@exposed@*/ /*@null@*/ sRef sref; |
151 | ||
28bf4b0b | 152 | warnClause warn; |
153 | ||
885824d3 | 154 | /* Location list is complete only if showalluses is set. */ |
155 | filelocList uses; | |
156 | ||
157 | bool used BOOLBITS; | |
158 | bool lset BOOLBITS; /* set in local table */ | |
159 | bool isPrivate BOOLBITS; /* specification only */ | |
160 | bool hasNameError BOOLBITS; | |
161 | ||
162 | storageClassCode storageclass; | |
163 | /*@relnull@*/ uinfo info; /* null for KELIPSMARKER, KINVALID */ | |
164 | } ; | |
165 | ||
166 | /* | |
167 | ** There is no uentry_isDefined to avoid confusion with | |
168 | ** uentry_isCodeDefined (which was previously called | |
169 | ** uentry_isDefined. | |
170 | */ | |
171 | ||
172 | extern /*@truenull@*/ bool uentry_isUndefined (/*@special@*/ uentry p_e) | |
173 | /*@*/ ; | |
174 | extern /*@truenull@*/ bool uentry_isInvalid (/*@special@*/ uentry p_e) | |
175 | /*@*/ ; | |
176 | extern /*@falsenull@*/ bool uentry_isValid (/*@special@*/ uentry p_e) | |
177 | /*@*/ ; | |
178 | ||
179 | /*@constant null uentry uentry_undefined; @*/ | |
180 | # define uentry_undefined ((uentry) NULL) | |
181 | ||
182 | # define uentry_isUndefined(e) ((e) == uentry_undefined) | |
183 | # define uentry_isValid(e) ((e) != uentry_undefined) | |
184 | # define uentry_isInvalid(e) ((e) == uentry_undefined) | |
185 | ||
186 | extern int uentry_compareStrict (uentry p_v1, uentry p_v2); | |
187 | ||
188 | /*@constant int PARAMUNKNOWN; @*/ | |
189 | # define PARAMUNKNOWN -1 | |
190 | ||
191 | extern bool uentry_isMaybeAbstract (uentry p_e) /*@*/ ; | |
192 | extern void uentry_setAbstract (uentry p_e) /*@modifies p_e@*/ ; | |
193 | extern void uentry_setConcrete (uentry p_e) /*@modifies p_e@*/ ; | |
194 | extern void uentry_setHasNameError (uentry p_ue) /*@modifies p_ue@*/ ; | |
195 | ||
196 | extern /*@falsenull@*/ bool uentry_isLset (/*@sef@*/ uentry p_e); | |
197 | # define uentry_isLset(e) \ | |
198 | (uentry_isValid(e) && (e)->lset) | |
199 | ||
200 | extern /*@falsenull@*/ bool uentry_isUsed (/*@sef@*/ uentry p_e); | |
201 | # define uentry_isUsed(e) (uentry_isValid(e) && (e)->used) | |
202 | ||
203 | extern /*@unused@*/ /*@falsenull@*/ bool | |
204 | uentry_isAbstractType (uentry p_e) /*@*/ ; | |
205 | # define uentry_isAbstractType(e) (uentry_isAbstractDatatype(e)) | |
206 | ||
207 | extern /*@falsenull@*/ bool uentry_isConstant (/*@sef@*/ uentry p_e) /*@*/ ; | |
208 | # define uentry_isConstant(e) \ | |
209 | (uentry_isValid(e) && ekind_isConst ((e)->ukind)) | |
210 | ||
211 | extern /*@falsenull@*/ bool uentry_isEitherConstant (/*@sef@*/ uentry p_e) /*@*/ ; | |
212 | # define uentry_isEitherConstant(e) \ | |
213 | (uentry_isValid(e) && (ekind_isConst ((e)->ukind) || ekind_isEnumConst ((e)->ukind))) | |
214 | ||
215 | extern /*@falsenull@*/ bool uentry_isEnumConstant (/*@sef@*/ uentry p_e) /*@*/ ; | |
216 | # define uentry_isEnumConstant(e) \ | |
217 | (uentry_isValid(e) && ekind_isEnumConst ((e)->ukind)) | |
218 | ||
219 | extern /*@falsenull@*/ bool uentry_isExternal (/*@sef@*/ uentry p_e) /*@*/ ; | |
220 | # define uentry_isExternal(c) \ | |
221 | (uentry_isValid(c) && fileloc_isExternal (uentry_whereDefined (c))) | |
222 | ||
223 | extern /*@falsenull@*/ bool uentry_isExtern (/*@sef@*/ uentry p_e) /*@*/ ; | |
224 | # define uentry_isExtern(c) \ | |
225 | (uentry_isValid(c) && (c)->storageclass == SCEXTERN) | |
226 | ||
227 | extern bool uentry_isForward (uentry p_e) /*@*/ ; | |
228 | ||
229 | extern /*@falsenull@*/ bool uentry_isFunction (/*@sef@*/ uentry p_e) /*@*/ ; | |
230 | # define uentry_isFunction(e) \ | |
231 | (uentry_isValid(e) && ekind_isFunction ((e)->ukind)) | |
232 | ||
233 | extern /*@falsenull@*/ bool uentry_isPriv (/*@sef@*/ uentry p_e) /*@*/ ; | |
234 | # define uentry_isPriv(e) \ | |
235 | (uentry_isValid(e) && (e)->isPrivate) | |
236 | ||
237 | extern /*@falsenull@*/ bool uentry_isFileStatic (uentry p_ue) /*@*/ ; | |
238 | extern /*@falsenull@*/ bool uentry_isExported (uentry p_ue) /*@*/ ; | |
239 | ||
240 | extern /*@falsenull@*/ bool uentry_isStatic (/*@sef@*/ uentry p_e) /*@*/ ; | |
241 | # define uentry_isStatic(c) \ | |
242 | (uentry_isValid(c) && (c)->storageclass == SCSTATIC) | |
243 | ||
244 | extern void uentry_setLset (/*@sef@*/ uentry p_e); | |
245 | # define uentry_setLset(e) \ | |
246 | (uentry_isValid(e) ? (e)->lset = TRUE : TRUE) | |
247 | ||
248 | extern bool uentry_isSpecialFunction (uentry p_ue) /*@*/ ; | |
249 | extern bool uentry_isMessageLike (uentry p_ue) /*@*/ ; | |
250 | extern bool uentry_isScanfLike (uentry p_ue) /*@*/ ; | |
251 | extern bool uentry_isPrintfLike (uentry p_ue) /*@*/ ; | |
252 | ||
253 | extern void uentry_setMessageLike (uentry p_ue) /*@modifies p_ue@*/ ; | |
254 | extern void uentry_setScanfLike (uentry p_ue) /*@modifies p_ue@*/ ; | |
255 | extern void uentry_setPrintfLike (uentry p_ue) /*@modifies p_ue@*/ ; | |
256 | ||
257 | extern void uentry_checkName (uentry p_ue) /*@modifies g_msgstream, p_ue@*/ ; | |
258 | ||
259 | extern bool uentry_sameObject (uentry p_e1, uentry p_e2); | |
260 | # define uentry_sameObject(e1,e2) ((e1) == (e2)) | |
261 | ||
262 | extern void uentry_addAccessType (uentry p_ue, typeId p_tid) /*@modifies p_ue@*/ ; | |
263 | ||
264 | extern void uentry_showWhereAny (uentry p_spec) | |
265 | /*@modifies g_msgstream@*/ ; | |
266 | ||
267 | extern void uentry_checkParams (uentry p_ue); | |
268 | extern void uentry_mergeUses (uentry p_res, uentry p_other); | |
269 | extern void uentry_setExtern (uentry p_c); | |
270 | extern void uentry_setUsed (uentry p_e, fileloc p_loc); | |
271 | extern void uentry_setDefState (uentry p_ue, sstate p_defstate); | |
272 | ||
273 | extern void uentry_setNotUsed (/*@sef@*/ uentry p_e); | |
274 | # define uentry_setNotUsed(e) \ | |
275 | (uentry_isValid (e) ? (e)->used = FALSE : FALSE) | |
276 | ||
277 | extern bool uentry_wasUsed (/*@sef@*/ uentry p_e); | |
278 | # define uentry_wasUsed(e) \ | |
279 | (uentry_isValid (e) ? (e)->used : TRUE) | |
280 | ||
281 | extern void uentry_mergeConstantValue (uentry p_ue, /*@only@*/ multiVal p_m); | |
282 | ||
283 | extern /*@observer@*/ fileloc uentry_whereEarliest (uentry p_e) /*@*/ ; | |
284 | extern /*@observer@*/ cstring uentry_rawName (uentry p_e) /*@*/ ; | |
285 | extern /*@observer@*/ fileloc uentry_whereDeclared (uentry p_e) /*@*/ ; | |
286 | extern bool uentry_equiv (uentry p_p1, uentry p_p2) /*@*/ ; | |
287 | extern /*@falsenull@*/ bool uentry_hasName (uentry p_e) /*@*/ ; | |
288 | extern /*@falsenull@*/ bool uentry_hasRealName (uentry p_e) /*@*/ ; | |
289 | extern /*@falsenull@*/ bool uentry_isAbstractDatatype (uentry p_e) /*@*/ ; | |
290 | extern /*@falsenull@*/ bool uentry_isAnyTag (/*@special@*/ uentry p_ue) | |
291 | /*@uses p_ue->ukind@*/ | |
292 | /*@*/ ; | |
293 | extern /*@falsenull@*/ bool uentry_isDatatype (uentry p_e) /*@*/ ; | |
294 | ||
295 | extern /*@falsenull@*/ bool uentry_isCodeDefined (uentry p_e) /*@*/ ; | |
296 | ||
297 | extern /*@falsenull@*/ bool uentry_isDeclared (/*@special@*/ uentry p_e) | |
298 | /*@uses p_e->whereDeclared@*/ /*@*/ ; | |
299 | ||
300 | extern /*@observer@*/ cstring uentry_ekindName (uentry p_ue) /*@*/ ; | |
28bf4b0b | 301 | extern /*@observer@*/ cstring uentry_ekindNameLC (uentry p_ue) /*@*/ ; |
302 | ||
885824d3 | 303 | extern void uentry_showWhereDefined (uentry p_spec); |
304 | extern /*@falsenull@*/ bool uentry_isEndIter (uentry p_e) /*@*/ ; | |
305 | extern /*@falsenull@*/ bool uentry_isEnumTag (/*@special@*/ uentry p_ue) | |
306 | /*@uses p_ue->ukind@*/ /*@*/ ; | |
307 | extern /*@falsenull@*/ bool uentry_isFakeTag (uentry p_e) /*@*/ ; | |
308 | extern /*@falsenull@*/ bool uentry_isIter (uentry p_e) /*@*/ ; | |
309 | extern /*@falsenull@*/ bool uentry_isMutableDatatype (uentry p_e) /*@*/ ; | |
310 | extern /*@falsenull@*/ bool uentry_isParam (uentry p_u) /*@*/ ; | |
311 | extern /*@falsenull@*/ bool uentry_isExpandedMacro (uentry p_u) /*@*/ ; | |
312 | extern /*@falsenull@*/ bool uentry_isSefParam (uentry p_u) /*@*/ ; | |
313 | extern /*@falsenull@*/ bool uentry_isAnyParam (/*@special@*/ uentry p_u) | |
314 | /*@uses p_u->ukind, p_u->info@*/ | |
315 | /*@*/ ; | |
316 | ||
317 | extern /*@falsenull@*/ bool uentry_isRealFunction (uentry p_e) /*@*/ ; | |
318 | extern /*@falsenull@*/ bool uentry_isSpecified (uentry p_e) /*@*/ ; | |
319 | ||
320 | extern /*@falsenull@*/ bool uentry_isStructTag (/*@special@*/ uentry p_ue) | |
321 | /*@uses p_ue->ukind@*/ /*@*/ ; | |
322 | extern /*@falsenull@*/ bool uentry_isUnionTag (/*@special@*/ uentry p_ue) | |
323 | /*@uses p_ue->ukind@*/ /*@*/ ; | |
324 | ||
325 | extern /*@falsenull@*/ bool uentry_isVar (/*@special@*/ uentry p_e) | |
326 | /*@uses p_e->ukind@*/ | |
327 | /*@*/ ; | |
328 | ||
329 | extern /*@falsenull@*/ bool uentry_isVariable (/*@special@*/ uentry p_e) | |
330 | /*@uses p_e->ukind@*/ | |
331 | /*@*/ ; | |
332 | ||
333 | extern cstring uentry_dump (uentry p_v) ; | |
334 | extern cstring uentry_dumpParam (uentry p_v); | |
28bf4b0b | 335 | |
336 | extern /*@observer@*/ cstring uentry_observeRealName (uentry p_e) /*@*/ ; | |
337 | ||
885824d3 | 338 | extern cstring uentry_getName (/*@special@*/ uentry p_e) |
339 | /*@uses p_e->ukind, p_e->info, p_e->uname@*/ | |
340 | /*@*/ ; | |
341 | ||
342 | extern cstring uentry_unparse (uentry p_v) /*@*/ ; | |
343 | extern cstring uentry_unparseAbbrev (uentry p_v) /*@*/ ; | |
344 | extern cstring uentry_unparseFull (uentry p_v) /*@*/ ; | |
345 | extern void uentry_setMutable (uentry p_e) /*@modifies p_e@*/ ; | |
346 | extern ctype uentry_getAbstractType (uentry p_e) /*@*/ ; | |
347 | extern ctype uentry_getRealType (uentry p_e) /*@globals internalState@*/ ; | |
348 | extern ctype uentry_getType (uentry p_e) /*@*/ ; | |
349 | extern ekind uentry_getKind (uentry p_e) /*@*/ ; | |
350 | extern /*@observer@*/ fileloc uentry_whereDefined (uentry p_e) /*@*/ ; | |
351 | extern /*@observer@*/ fileloc uentry_whereSpecified (uentry p_e) /*@*/ ; | |
352 | extern int uentry_compare (uentry p_u1, uentry p_u2); | |
353 | extern /*@exposed@*/ sRef uentry_getSref (/*@temp@*/ uentry p_e) /*@*/ ; | |
354 | extern /*@observer@*/ sRefSet uentry_getMods (uentry p_l) /*@*/ ; | |
355 | extern typeIdSet uentry_accessType (uentry p_e) /*@*/ ; | |
356 | extern /*@observer@*/ fileloc uentry_whereEither (uentry p_e) /*@*/ ; | |
357 | extern /*@notnull@*/ uentry uentry_makeExpandedMacro (cstring p_s, | |
358 | /*@temp@*/ fileloc p_f) | |
359 | /*@*/ ; | |
360 | ||
361 | extern void uentry_checkMatchParam (uentry p_u1, uentry p_u2, int p_paramno, exprNode p_e) /*@modifies g_msgstream@*/ ; | |
362 | ||
28bf4b0b | 363 | extern /*@observer@*/ stateClauseList uentry_getStateClauseList (uentry p_ue) /*@*/ ; |
885824d3 | 364 | |
365 | extern void uentry_showWhereLastExtra (uentry p_spec, /*@only@*/ cstring p_extra) | |
366 | /*@modifies g_msgstream@*/ ; | |
367 | ||
368 | # ifndef NOLCL | |
369 | extern void uentry_setRefCounted (uentry p_e); | |
370 | ||
371 | extern /*@notnull@*/ /*@only@*/ uentry uentry_makeUnnamedVariable (ctype p_t); | |
372 | ||
373 | extern /*@notnull@*/ uentry | |
374 | uentry_makeUnspecFunction (cstring p_n, ctype p_t, typeIdSet p_access, | |
375 | /*@keep@*/ fileloc p_f); | |
376 | ||
377 | extern /*@notnull@*/ uentry | |
378 | uentry_makePrivFunction2 (cstring p_n, ctype p_t, | |
379 | typeIdSet p_access, | |
380 | /*@only@*/ globSet p_globs, | |
381 | /*@only@*/ sRefSet p_mods, /*@keep@*/ fileloc p_f); | |
382 | ||
383 | extern /*@notnull@*/ uentry | |
384 | uentry_makeSpecEnumConstant (cstring p_n, ctype p_t, /*@keep@*/ fileloc p_loc) /*@*/ ; | |
385 | ||
386 | extern /*@notnull@*/ uentry | |
387 | uentry_makeEnumTag (cstring p_n, ctype p_t, /*@only@*/ fileloc p_loc) /*@*/ ; | |
388 | ||
389 | extern /*@notnull@*/ uentry | |
390 | uentry_makeTypeListFunction (cstring p_n, typeIdSet p_access, /*@only@*/ fileloc p_f) | |
391 | /*@*/ ; | |
392 | ||
393 | extern /*@notnull@*/ uentry | |
394 | uentry_makeSpecFunction (cstring p_n, ctype p_t, | |
395 | typeIdSet p_access, /*@only@*/ globSet p_globs, | |
396 | /*@only@*/ sRefSet p_mods, /*@keep@*/ fileloc p_f); | |
397 | # endif | |
398 | ||
399 | extern /*@notnull@*/ uentry | |
400 | uentry_makeEnumConstant (cstring p_n, ctype p_t) /*@*/ ; | |
401 | ||
402 | extern /*@notnull@*/ uentry | |
403 | uentry_makeEnumInitializedConstant (cstring p_n, ctype p_t, exprNode p_expr) /*@*/ ; | |
404 | ||
405 | extern /*@notnull@*/ /*@only@*/ uentry | |
406 | uentry_makeConstant (/*@temp@*/ cstring p_n, ctype p_t, /*@keep@*/ fileloc p_f) | |
407 | /*@*/ ; | |
408 | extern /*@notnull@*/ /*@only@*/ uentry | |
409 | uentry_makeConstantAux (/*@temp@*/ cstring p_n, ctype p_t, | |
410 | /*@keep@*/ fileloc p_f, bool p_priv, | |
411 | /*@only@*/ multiVal p_m) /*@*/ ; | |
412 | extern /*@notnull@*/ /*@only@*/ uentry | |
28bf4b0b | 413 | uentry_makeDatatype (/*@temp@*/ cstring p_n, ctype p_t, ynm p_mut, ynm p_abstract, |
885824d3 | 414 | /*@only@*/ fileloc p_f) /*@*/ ; |
415 | extern /*@notnull@*/ /*@only@*/ uentry | |
416 | uentry_makeDatatypeAux (/*@temp@*/ cstring p_n, ctype p_t, ynm p_mut, | |
28bf4b0b | 417 | ynm p_abstract, /*@keep@*/ fileloc p_f, bool p_priv) /*@*/ ; |
885824d3 | 418 | extern /*@notnull@*/ uentry uentry_makeElipsisMarker (void) /*@*/ ; |
419 | ||
420 | extern void uentry_makeVarFunction (/*@temp@*/ uentry p_ue) /*@modifies p_ue@*/ ; | |
421 | ||
422 | extern bool uentry_isElipsisMarker (/*@sef@*/ uentry p_u) /*@*/ ; | |
423 | # define uentry_isElipsisMarker(u) \ | |
424 | (uentry_isValid(u) && ekind_isElipsis ((u)->ukind)) | |
425 | ||
426 | extern /*@notnull@*/ uentry | |
427 | uentry_makeEndIter (cstring p_n, /*@only@*/ fileloc p_f) /*@*/ ; | |
428 | extern /*@notnull@*/ uentry | |
429 | uentry_makeEnumTagLoc (cstring p_n, ctype p_t) /*@*/ ; | |
430 | extern /*@notnull@*/ uentry | |
431 | uentry_makeForwardFunction (cstring p_n, typeId p_access, /*@temp@*/ fileloc p_f) /*@*/ ; | |
432 | ||
433 | extern /*@notnull@*/ uentry | |
434 | uentry_makeFunction (cstring p_n, ctype p_t, | |
435 | typeId p_access, | |
436 | /*@only@*/ globSet p_globs, /*@only@*/ sRefSet p_mods, | |
28bf4b0b | 437 | /*@only@*/ warnClause p_warn, |
885824d3 | 438 | /*@only@*/ fileloc p_f); |
439 | ||
440 | extern /*@notnull@*/ uentry | |
441 | uentry_makeIter (cstring p_n, ctype p_ct, /*@only@*/ fileloc p_f) /*@*/ ; | |
442 | extern /*@notnull@*/ uentry | |
443 | uentry_makeParam (idDecl p_t, int p_i) /*@*/ ; | |
444 | ||
445 | extern /*@notnull@*/ uentry | |
446 | uentry_makeStructTag (cstring p_n, ctype p_t, /*@only@*/ fileloc p_loc); | |
447 | extern /*@notnull@*/ uentry | |
448 | uentry_makeStructTagLoc (cstring p_n, ctype p_t); | |
449 | extern /*@notnull@*/ uentry | |
450 | uentry_makeUnionTag (cstring p_n, ctype p_t, /*@only@*/ fileloc p_loc); | |
451 | extern /*@notnull@*/ uentry | |
452 | uentry_makeUnionTagLoc (cstring p_n, ctype p_t); | |
453 | extern /*@notnull@*/ uentry | |
454 | uentry_makeVariable (cstring p_n, ctype p_t, /*@keep@*/ fileloc p_f, bool p_isPriv); | |
455 | extern /*@notnull@*/ /*@only@*/ uentry | |
456 | uentry_makeVariableLoc (cstring p_n, ctype p_t); | |
457 | ||
458 | # ifndef NOLCL | |
459 | extern /*@notnull@*/ /*@only@*/ | |
460 | uentry uentry_makeVariableParam (cstring p_n, ctype p_t); | |
461 | # endif | |
462 | ||
463 | extern /*@notnull@*/ /*@only@*/ | |
464 | uentry uentry_makeVariableSrefParam (cstring p_n, ctype p_t, | |
28bf4b0b | 465 | /*@exposed@*/ sRef p_s); |
885824d3 | 466 | extern /*@notnull@*/ /*@only@*/ |
467 | uentry uentry_makeIdFunction (idDecl p_id); | |
468 | extern /*@notnull@*/ /*@only@*/ | |
469 | uentry uentry_makeIdDatatype (idDecl p_id); | |
470 | extern /*@notnull@*/ /*@only@*/ | |
28bf4b0b | 471 | uentry uentry_makeBoolDatatype (ynm p_abstract); |
885824d3 | 472 | extern void uentry_mergeDefinition (uentry p_old, /*@only@*/ uentry p_unew); |
473 | extern void uentry_mergeEntries (uentry p_spec, /*@only@*/ uentry p_def); | |
474 | extern uentry uentry_nameCopy (/*@only@*/ cstring p_name, uentry p_e); | |
475 | extern uentry uentry_undump (ekind p_kind, fileloc p_loc, char **p_s); | |
476 | extern /*@observer@*/ uentryList uentry_getParams (uentry p_l) /*@*/ ; | |
477 | extern void uentry_resetParams (uentry p_ue, /*@only@*/ uentryList p_pn) | |
478 | /*@modifies p_ue@*/ ; | |
479 | extern /*@observer@*/ globSet uentry_getGlobs (uentry p_l) /*@*/ ; | |
480 | extern qual uentry_nullPred (uentry p_u); | |
481 | extern void uentry_free (/*@only@*/ /*@only@*/ uentry p_e); | |
482 | extern void uentry_setDatatype (uentry p_e, usymId p_uid); | |
483 | ||
484 | extern void uentry_setDefined (/*@special@*/ uentry p_e, fileloc p_f) | |
485 | /*@uses p_e->whereDefined, p_e->ukind, p_e->uname, p_e->info@*/ | |
486 | /*@modifies p_e@*/ ; | |
487 | ||
488 | extern void uentry_checkDecl (void); | |
489 | extern void uentry_clearDecl (void); | |
490 | extern void uentry_setDeclared (uentry p_e, fileloc p_f); | |
491 | extern void uentry_setDeclaredOnly (uentry p_e, /*@only@*/ fileloc p_f); | |
492 | extern void uentry_setDeclaredForceOnly (uentry p_e, /*@only@*/ fileloc p_f); | |
493 | extern void uentry_setFunctionDefined (uentry p_e, fileloc p_loc); | |
494 | extern void uentry_setName (uentry p_e, /*@only@*/ cstring p_n); | |
495 | extern void uentry_setParam (uentry p_e); | |
496 | extern void uentry_setSref (uentry p_e, /*@exposed@*/ sRef p_s); | |
497 | extern void uentry_setStatic (uentry p_c); | |
498 | ||
499 | extern void uentry_setModifies (uentry p_ue, /*@owned@*/ sRefSet p_sr) | |
500 | /*@modifies p_ue, p_sr@*/; | |
501 | ||
28bf4b0b | 502 | extern bool uentry_hasWarning (uentry p_ue) /*@*/ ; |
503 | ||
504 | extern void uentry_addWarning (uentry p_ue, /*@only@*/ warnClause p_warn) | |
505 | /*@modifies p_ue*/; | |
506 | ||
507 | extern void uentry_setStateClauseList (uentry p_ue, /*@only@*/ stateClauseList p_clauses) | |
885824d3 | 508 | /*@modifies p_ue@*/ ; |
509 | ||
510 | extern void uentry_setType (uentry p_e, ctype p_t); | |
511 | ||
512 | extern /*@unused@*/ /*@observer@*/ cstring uentry_checkedName (uentry p_ue); | |
513 | extern void uentry_showWhereLastPlain (uentry p_spec) /*@modifies g_msgstream@*/ ; | |
514 | ||
515 | extern void | |
516 | uentry_showWhereSpecifiedExtra (uentry p_spec, /*@only@*/ cstring p_s) | |
517 | /*@modifies g_msgstream@*/ ; | |
518 | ||
519 | extern void uentry_showWhereSpecified (uentry p_spec) /*@modifies g_msgstream@*/ ; | |
520 | extern void uentry_showWhereLast (uentry p_spec) /*@modifies g_msgstream@*/ ; | |
521 | extern void uentry_showWhereDeclared (uentry p_spec) /*@modifies g_msgstream@*/ ; | |
522 | ||
523 | extern /*@notnull@*/ /*@only@*/ uentry uentry_makeIdVariable (idDecl p_t) /*@*/ ; | |
524 | extern uentry uentry_copy (uentry p_e) /*@*/ ; | |
525 | extern void uentry_freeComplete (/*@only@*/ uentry p_e) ; | |
526 | extern void uentry_clearDefined (uentry p_e) /*@modifies p_e@*/; | |
527 | extern /*@observer@*/ cstring uentry_specDeclName (uentry p_u) /*@*/ ; | |
528 | ||
529 | extern void | |
530 | uentry_mergeState (uentry p_res, uentry p_other, fileloc p_loc, | |
531 | bool p_mustReturn, bool p_flip, bool p_opt, | |
532 | clause p_cl) /*@modifies p_res, p_other@*/ ; | |
533 | ||
534 | extern void uentry_setState (uentry p_res, uentry p_other) | |
535 | /*@modifies p_res, p_other@*/ ; | |
536 | ||
537 | extern void uentry_setRefParam (uentry p_e) /*@modifies p_e@*/ ; | |
538 | ||
539 | extern void uentry_setDeclaredForce (uentry p_e, fileloc p_f) /*@modifies p_e@*/; | |
540 | extern bool uentry_isNonLocal (uentry p_ue) /*@*/ ; | |
28bf4b0b | 541 | extern bool uentry_isGlobalVariable (uentry p_ue) /*@*/; |
542 | extern bool uentry_isVisibleExternally (uentry p_ue) /*@*/; | |
885824d3 | 543 | extern bool uentry_isRefParam (uentry p_u) /*@*/ ; |
544 | extern bool uentry_hasGlobs (uentry p_ue) /*@*/ ; | |
545 | extern bool uentry_hasMods (uentry p_ue) /*@*/ ; | |
546 | ||
28bf4b0b | 547 | extern bool uentry_hasStateClauseList (uentry p_ue) /*@*/ ; |
885824d3 | 548 | extern exitkind uentry_getExitCode (uentry p_ue) /*@*/ ; |
549 | ||
550 | extern void uentry_checkYieldParam (uentry p_old, uentry p_unew); | |
551 | extern bool uentry_isOnly (uentry p_ue) /*@*/ ; | |
552 | extern bool uentry_isUnique (uentry p_ue) /*@*/ ; | |
553 | extern void uentry_reflectQualifiers (uentry p_ue, qualList p_q) /*@modifies p_ue@*/; | |
554 | extern bool uentry_isOut (uentry p_u) /*@*/ ; | |
555 | extern bool uentry_isPartial (uentry p_u) /*@*/ ; | |
556 | extern bool uentry_isStateSpecial (uentry p_u) /*@*/ ; | |
557 | extern bool uentry_possiblyNull (uentry p_u) /*@*/ ; | |
558 | extern ctype uentry_getForceRealType (uentry p_e) /*@globals internalState@*/ ; | |
559 | extern alkind uentry_getAliasKind (uentry p_u) /*@*/ ; | |
560 | extern exkind uentry_getExpKind (uentry p_u) /*@*/ ; | |
561 | extern /*@observer@*/ multiVal uentry_getConstantValue (uentry p_e) /*@*/ ; | |
562 | extern void uentry_fixupSref (uentry p_ue) /*@modifies p_ue@*/ ; | |
28bf4b0b | 563 | extern void uentry_setGlobals (uentry p_ue, /*@owned@*/ globSet p_globs) /*@modifies p_ue, p_globs@*/ ; |
885824d3 | 564 | extern bool uentry_isYield (uentry p_ue) /*@*/ ; |
565 | extern /*@notnull@*/ uentry uentry_makeIdConstant (idDecl p_t) /*@*/ ; | |
566 | extern /*@observer@*/ cstring uentry_getRealName (uentry p_e) /*@*/ ; | |
567 | extern int uentry_xcomparealpha (uentry *p_p1, uentry *p_p2) /*@*/ ; | |
568 | extern int uentry_xcompareuses (uentry *p_p1, uentry *p_p2) /*@*/ ; | |
569 | extern /*@observer@*/ cstring uentry_specOrDefName (uentry p_u) /*@*/ ; | |
570 | extern void uentry_copyState (uentry p_res, uentry p_other); | |
571 | extern bool uentry_sameKind (uentry p_u1, uentry p_u2); | |
572 | extern /*@exposed@*/ sRef uentry_returnedRef (uentry p_u, exprNodeList p_args); | |
573 | extern bool uentry_isReturned (uentry p_u); | |
574 | extern bool uentry_isRefCountedDatatype (uentry p_e); | |
575 | extern sstate uentry_getDefState (uentry p_u); | |
576 | extern /*@unused@*/ void uentry_markFree (/*@owned@*/ uentry p_u); | |
577 | extern /*@dependent@*/ sRef uentry_getOrigSref (uentry p_e); | |
578 | extern void uentry_destroyMod (void) /*@modifies internalState@*/; | |
579 | extern void uentry_showDefSpecInfo (uentry p_ce, fileloc p_fwhere); | |
580 | extern void uentry_markOwned (/*@owned@*/ uentry p_u); | |
581 | ||
582 | extern /*@observer@*/ fileloc uentry_whereLast (uentry p_e) /*@*/ ; | |
583 | extern void uentry_setParamNo (uentry p_ue, int p_pno) /*@modifies p_ue@*/; | |
584 | ||
585 | extern /*@observer@*/ filelocList uentry_getUses (/*@sef@*/ uentry p_e) /*@*/ ; | |
586 | # define uentry_getUses(u) (uentry_isValid (u) ? (u)->uses : filelocList_undefined) | |
587 | ||
588 | extern bool uentry_isCheckedUnknown (uentry p_ue) /*@*/ ; | |
589 | extern bool uentry_isCheckedModify (uentry p_ue) /*@*/ ; | |
590 | extern bool uentry_isUnchecked (uentry p_ue) /*@*/ ; | |
591 | extern bool uentry_isChecked (uentry p_ue) /*@*/ ; | |
592 | extern bool uentry_isCheckMod (uentry p_ue) /*@*/ ; | |
593 | extern bool uentry_isCheckedStrict (uentry p_ue) /*@*/ ; | |
594 | extern void uentry_setUnchecked (uentry p_ue) /*@modifies p_ue@*/ ; | |
595 | extern void uentry_setChecked (uentry p_ue) /*@modifies p_ue@*/ ; | |
596 | extern void uentry_setCheckMod (uentry p_ue) /*@modifies p_ue@*/ ; | |
597 | extern void uentry_setCheckedStrict (uentry p_ue) /*@modifies p_ue@*/ ; | |
598 | ||
599 | extern bool uentry_hasAccessType (uentry p_e); | |
600 | ||
28bf4b0b | 601 | /*@constant cstring GLOBAL_MARKER_NAME@*/ |
602 | # define GLOBAL_MARKER_NAME cstring_makeLiteralTemp ("#GM#") | |
1ac6313d | 603 | |
604 | /* start modifications */ | |
11ed4f45 | 605 | //extern void uentry_setBufferSize (uentry p_e, exprNode cconstant); |
606 | ||
1ac6313d | 607 | /* functions for making modification to null-term info */ |
bb25bea6 | 608 | void uentry_setNullTerminatedState (uentry p_e); |
609 | void uentry_setPossiblyNullTerminatedState (uentry p_e); | |
84c9ffbf | 610 | //extern void uentry_setNotNullTerminated (uentry p_e); |
bb25bea6 | 611 | void uentry_setSize(uentry p_e, int p_size); |
612 | void uentry_setLen(uentry p_e, int p_len); | |
1ac6313d | 613 | |
4cccc6ad | 614 | /*@i66*/ |
615 | /*@-nullderef@*/ | |
1ac6313d | 616 | extern bool uentry_hasBufStateInfo (uentry p_ue); |
617 | # define uentry_hasBufStateInfo(p_ue) \ | |
618 | (((p_ue)->info->var->bufinfo != NULL) ? TRUE : FALSE) | |
619 | ||
84c9ffbf | 620 | /*@unused@*/ extern bool uentry_isNullTerminated(/*@sef@*/uentry p_ue); |
1ac6313d | 621 | # define uentry_isNullTerminated(p_ue) \ |
4cccc6ad | 622 | ( uentry_hasBufStateInfo( (p_ue ) ) ? ( (p_ue)->info->var->bufinfo->bufstate \ |
1ac6313d | 623 | == BB_NULLTERMINATED) : FALSE) |
624 | ||
84c9ffbf | 625 | /*@unused@*/ extern bool uentry_isPossiblyNullTerminated( /*@sef@*/ uentry p_ue); |
1ac6313d | 626 | # define uentry_isPossiblyNullTerminated(p_ue) \ |
4cccc6ad | 627 | ( uentry_hasBufStateInfo((p_ue)) ? ( (p_ue)->info->var->bufinfo->bufstate \ |
1ac6313d | 628 | == BB_POSSIBLYNULLTERMINATED) : FALSE) |
629 | ||
84c9ffbf | 630 | /*@unused@*/ extern bool uentry_isNotNullTerminated( /*@sef@*/ uentry p_ue); |
1ac6313d | 631 | # define uentry_isNotNullTerminated(p_ue) \ |
4cccc6ad | 632 | ( uentry_hasBufStateInfo( (p_ue) ) ? ( (p_ue)->info->var->bufinfo->bufstate \ |
1ac6313d | 633 | == BB_NOTNULLTERMINATED) : FALSE) |
4cccc6ad | 634 | /*@=nullderef@*/ |
1ac6313d | 635 | |
636 | /* end modifications */ | |
637 | ||
28bf4b0b | 638 | extern uentry uentry_makeGlobalMarker (void) ; |
639 | extern bool uentry_isGlobalMarker (uentry) /*@*/ ; | |
640 | ||
641 | extern /*@exposed@*/ uentry uentry_makeUnrecognized (cstring p_c, /*@keep@*/ fileloc p_loc); | |
642 | ||
885824d3 | 643 | # ifdef DOANNOTS |
644 | typedef enum { AN_UNKNOWN, AN_FCNRETURN, AN_FCNPARAM, AN_SUFIELD, AN_TDEFN, AN_GSVAR, | |
645 | AN_CONST, AN_LAST | |
646 | } ancontext; | |
647 | ||
648 | extern void initAnnots (); | |
649 | extern void printAnnots (void); | |
650 | extern void uentry_tallyAnnots (uentry u, ancontext kind); | |
651 | # endif /* DOANNOTS */ | |
652 | ||
ba45e1e4 | 653 | extern bool uentry_hasMetaStateEnsures (uentry p_e) /*@*/ ; |
654 | extern /*@observer@*/ metaStateConstraint uentry_getMetaStateEnsures (uentry p_e); | |
655 | ||
4cccc6ad | 656 | /* start modifications */ |
bb25bea6 | 657 | //extern void uentry_setBufferSize (uentry p_e, exprNode p_cconstant); |
93307a76 | 658 | /*drl7x*/ |
28bf4b0b | 659 | extern constraintList uentry_getFcnPreconditions (uentry p_ue); |
660 | extern constraintList uentry_getFcnPostconditions (uentry p_ue); | |
920a3797 | 661 | |
3814599d | 662 | extern void uentry_setPostconditions (uentry p_ue, /*@only@*/ functionConstraint p_postconditions); |
663 | ||
664 | extern void uentry_setPreconditions (uentry p_ue, /*@only@*/ functionConstraint p_preconditions); | |
bb25bea6 | 665 | |
93307a76 | 666 | /*end mods*/ |
4cccc6ad | 667 | |
885824d3 | 668 | # else |
669 | # error "Multiple include" | |
670 | # endif | |
671 | ||
672 | ||
673 |