]>
Commit | Line | Data |
---|---|---|
885824d3 | 1 | /* |
2 | ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2000. | |
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 | ||
18 | typedef struct _ucinfo | |
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 */ |
50 | typedef enum _bbufstate { | |
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 | ||
56 | typedef struct _bbufinfo { | |
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 | ||
885824d3 | 62 | typedef struct _uvinfo |
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 | |
73 | typedef struct _udinfo | |
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 | ||
91 | typedef struct _ufinfo | |
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 | ||
101 | specialClauses specclauses; | |
102 | ||
103 | /*@dependent@*/ uentryList defparams; | |
104 | bool hasGlobs BOOLBITS; | |
105 | bool hasMods BOOLBITS; | |
93307a76 | 106 | |
107 | constraintList preconditions; | |
ef2aa32a | 108 | constraintList postconditions; |
93307a76 | 109 | |
885824d3 | 110 | } *ufinfo ; |
111 | ||
112 | typedef struct _uiinfo | |
113 | { | |
114 | typeIdSet access; | |
115 | /*@owned@*/ globSet globs; /* globals list */ | |
116 | /*@owned@*/ sRefSet mods; /* modifies */ | |
117 | } *uiinfo ; | |
118 | ||
119 | typedef struct _ueinfo | |
120 | { | |
121 | typeIdSet access; | |
122 | } *ueinfo ; | |
123 | ||
124 | typedef union _uinfo | |
125 | { | |
126 | ucinfo uconst; | |
127 | uvinfo var; | |
128 | udinfo datatype; | |
129 | ufinfo fcn; | |
130 | uiinfo iter; | |
131 | ueinfo enditer; | |
132 | } *uinfo ; | |
133 | ||
134 | struct _uentry | |
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 | */ | |
149 | /*@exposed@*/ /*@null@*/ sRef sref; | |
150 | ||
151 | /* Location list is complete only if showalluses is set. */ | |
152 | filelocList uses; | |
153 | ||
154 | bool used BOOLBITS; | |
155 | bool lset BOOLBITS; /* set in local table */ | |
156 | bool isPrivate BOOLBITS; /* specification only */ | |
157 | bool hasNameError BOOLBITS; | |
158 | ||
159 | storageClassCode storageclass; | |
160 | /*@relnull@*/ uinfo info; /* null for KELIPSMARKER, KINVALID */ | |
161 | } ; | |
162 | ||
163 | /* | |
164 | ** There is no uentry_isDefined to avoid confusion with | |
165 | ** uentry_isCodeDefined (which was previously called | |
166 | ** uentry_isDefined. | |
167 | */ | |
168 | ||
169 | extern /*@truenull@*/ bool uentry_isUndefined (/*@special@*/ uentry p_e) | |
170 | /*@*/ ; | |
171 | extern /*@truenull@*/ bool uentry_isInvalid (/*@special@*/ uentry p_e) | |
172 | /*@*/ ; | |
173 | extern /*@falsenull@*/ bool uentry_isValid (/*@special@*/ uentry p_e) | |
174 | /*@*/ ; | |
175 | ||
176 | /*@constant null uentry uentry_undefined; @*/ | |
177 | # define uentry_undefined ((uentry) NULL) | |
178 | ||
179 | # define uentry_isUndefined(e) ((e) == uentry_undefined) | |
180 | # define uentry_isValid(e) ((e) != uentry_undefined) | |
181 | # define uentry_isInvalid(e) ((e) == uentry_undefined) | |
182 | ||
183 | extern int uentry_compareStrict (uentry p_v1, uentry p_v2); | |
184 | ||
185 | /*@constant int PARAMUNKNOWN; @*/ | |
186 | # define PARAMUNKNOWN -1 | |
187 | ||
188 | extern bool uentry_isMaybeAbstract (uentry p_e) /*@*/ ; | |
189 | extern void uentry_setAbstract (uentry p_e) /*@modifies p_e@*/ ; | |
190 | extern void uentry_setConcrete (uentry p_e) /*@modifies p_e@*/ ; | |
191 | extern void uentry_setHasNameError (uentry p_ue) /*@modifies p_ue@*/ ; | |
192 | ||
193 | extern /*@falsenull@*/ bool uentry_isLset (/*@sef@*/ uentry p_e); | |
194 | # define uentry_isLset(e) \ | |
195 | (uentry_isValid(e) && (e)->lset) | |
196 | ||
197 | extern /*@falsenull@*/ bool uentry_isUsed (/*@sef@*/ uentry p_e); | |
198 | # define uentry_isUsed(e) (uentry_isValid(e) && (e)->used) | |
199 | ||
200 | extern /*@unused@*/ /*@falsenull@*/ bool | |
201 | uentry_isAbstractType (uentry p_e) /*@*/ ; | |
202 | # define uentry_isAbstractType(e) (uentry_isAbstractDatatype(e)) | |
203 | ||
204 | extern /*@falsenull@*/ bool uentry_isConstant (/*@sef@*/ uentry p_e) /*@*/ ; | |
205 | # define uentry_isConstant(e) \ | |
206 | (uentry_isValid(e) && ekind_isConst ((e)->ukind)) | |
207 | ||
208 | extern /*@falsenull@*/ bool uentry_isEitherConstant (/*@sef@*/ uentry p_e) /*@*/ ; | |
209 | # define uentry_isEitherConstant(e) \ | |
210 | (uentry_isValid(e) && (ekind_isConst ((e)->ukind) || ekind_isEnumConst ((e)->ukind))) | |
211 | ||
212 | extern /*@falsenull@*/ bool uentry_isEnumConstant (/*@sef@*/ uentry p_e) /*@*/ ; | |
213 | # define uentry_isEnumConstant(e) \ | |
214 | (uentry_isValid(e) && ekind_isEnumConst ((e)->ukind)) | |
215 | ||
216 | extern /*@falsenull@*/ bool uentry_isExternal (/*@sef@*/ uentry p_e) /*@*/ ; | |
217 | # define uentry_isExternal(c) \ | |
218 | (uentry_isValid(c) && fileloc_isExternal (uentry_whereDefined (c))) | |
219 | ||
220 | extern /*@falsenull@*/ bool uentry_isExtern (/*@sef@*/ uentry p_e) /*@*/ ; | |
221 | # define uentry_isExtern(c) \ | |
222 | (uentry_isValid(c) && (c)->storageclass == SCEXTERN) | |
223 | ||
224 | extern bool uentry_isForward (uentry p_e) /*@*/ ; | |
225 | ||
226 | extern /*@falsenull@*/ bool uentry_isFunction (/*@sef@*/ uentry p_e) /*@*/ ; | |
227 | # define uentry_isFunction(e) \ | |
228 | (uentry_isValid(e) && ekind_isFunction ((e)->ukind)) | |
229 | ||
230 | extern /*@falsenull@*/ bool uentry_isPriv (/*@sef@*/ uentry p_e) /*@*/ ; | |
231 | # define uentry_isPriv(e) \ | |
232 | (uentry_isValid(e) && (e)->isPrivate) | |
233 | ||
234 | extern /*@falsenull@*/ bool uentry_isFileStatic (uentry p_ue) /*@*/ ; | |
235 | extern /*@falsenull@*/ bool uentry_isExported (uentry p_ue) /*@*/ ; | |
236 | ||
237 | extern /*@falsenull@*/ bool uentry_isStatic (/*@sef@*/ uentry p_e) /*@*/ ; | |
238 | # define uentry_isStatic(c) \ | |
239 | (uentry_isValid(c) && (c)->storageclass == SCSTATIC) | |
240 | ||
241 | extern void uentry_setLset (/*@sef@*/ uentry p_e); | |
242 | # define uentry_setLset(e) \ | |
243 | (uentry_isValid(e) ? (e)->lset = TRUE : TRUE) | |
244 | ||
245 | extern bool uentry_isSpecialFunction (uentry p_ue) /*@*/ ; | |
246 | extern bool uentry_isMessageLike (uentry p_ue) /*@*/ ; | |
247 | extern bool uentry_isScanfLike (uentry p_ue) /*@*/ ; | |
248 | extern bool uentry_isPrintfLike (uentry p_ue) /*@*/ ; | |
249 | ||
250 | extern void uentry_setMessageLike (uentry p_ue) /*@modifies p_ue@*/ ; | |
251 | extern void uentry_setScanfLike (uentry p_ue) /*@modifies p_ue@*/ ; | |
252 | extern void uentry_setPrintfLike (uentry p_ue) /*@modifies p_ue@*/ ; | |
253 | ||
254 | extern void uentry_checkName (uentry p_ue) /*@modifies g_msgstream, p_ue@*/ ; | |
255 | ||
256 | extern bool uentry_sameObject (uentry p_e1, uentry p_e2); | |
257 | # define uentry_sameObject(e1,e2) ((e1) == (e2)) | |
258 | ||
259 | extern void uentry_addAccessType (uentry p_ue, typeId p_tid) /*@modifies p_ue@*/ ; | |
260 | ||
261 | extern void uentry_showWhereAny (uentry p_spec) | |
262 | /*@modifies g_msgstream@*/ ; | |
263 | ||
264 | extern void uentry_checkParams (uentry p_ue); | |
265 | extern void uentry_mergeUses (uentry p_res, uentry p_other); | |
266 | extern void uentry_setExtern (uentry p_c); | |
267 | extern void uentry_setUsed (uentry p_e, fileloc p_loc); | |
268 | extern void uentry_setDefState (uentry p_ue, sstate p_defstate); | |
269 | ||
270 | extern void uentry_setNotUsed (/*@sef@*/ uentry p_e); | |
271 | # define uentry_setNotUsed(e) \ | |
272 | (uentry_isValid (e) ? (e)->used = FALSE : FALSE) | |
273 | ||
274 | extern bool uentry_wasUsed (/*@sef@*/ uentry p_e); | |
275 | # define uentry_wasUsed(e) \ | |
276 | (uentry_isValid (e) ? (e)->used : TRUE) | |
277 | ||
278 | extern void uentry_mergeConstantValue (uentry p_ue, /*@only@*/ multiVal p_m); | |
279 | ||
280 | extern /*@observer@*/ fileloc uentry_whereEarliest (uentry p_e) /*@*/ ; | |
281 | extern /*@observer@*/ cstring uentry_rawName (uentry p_e) /*@*/ ; | |
282 | extern /*@observer@*/ fileloc uentry_whereDeclared (uentry p_e) /*@*/ ; | |
283 | extern bool uentry_equiv (uentry p_p1, uentry p_p2) /*@*/ ; | |
284 | extern /*@falsenull@*/ bool uentry_hasName (uentry p_e) /*@*/ ; | |
285 | extern /*@falsenull@*/ bool uentry_hasRealName (uentry p_e) /*@*/ ; | |
286 | extern /*@falsenull@*/ bool uentry_isAbstractDatatype (uentry p_e) /*@*/ ; | |
287 | extern /*@falsenull@*/ bool uentry_isAnyTag (/*@special@*/ uentry p_ue) | |
288 | /*@uses p_ue->ukind@*/ | |
289 | /*@*/ ; | |
290 | extern /*@falsenull@*/ bool uentry_isDatatype (uentry p_e) /*@*/ ; | |
291 | ||
292 | extern /*@falsenull@*/ bool uentry_isCodeDefined (uentry p_e) /*@*/ ; | |
293 | ||
294 | extern /*@falsenull@*/ bool uentry_isDeclared (/*@special@*/ uentry p_e) | |
295 | /*@uses p_e->whereDeclared@*/ /*@*/ ; | |
296 | ||
297 | extern /*@observer@*/ cstring uentry_ekindName (uentry p_ue) /*@*/ ; | |
298 | extern void uentry_showWhereDefined (uentry p_spec); | |
299 | extern /*@falsenull@*/ bool uentry_isEndIter (uentry p_e) /*@*/ ; | |
300 | extern /*@falsenull@*/ bool uentry_isEnumTag (/*@special@*/ uentry p_ue) | |
301 | /*@uses p_ue->ukind@*/ /*@*/ ; | |
302 | extern /*@falsenull@*/ bool uentry_isFakeTag (uentry p_e) /*@*/ ; | |
303 | extern /*@falsenull@*/ bool uentry_isIter (uentry p_e) /*@*/ ; | |
304 | extern /*@falsenull@*/ bool uentry_isMutableDatatype (uentry p_e) /*@*/ ; | |
305 | extern /*@falsenull@*/ bool uentry_isParam (uentry p_u) /*@*/ ; | |
306 | extern /*@falsenull@*/ bool uentry_isExpandedMacro (uentry p_u) /*@*/ ; | |
307 | extern /*@falsenull@*/ bool uentry_isSefParam (uentry p_u) /*@*/ ; | |
308 | extern /*@falsenull@*/ bool uentry_isAnyParam (/*@special@*/ uentry p_u) | |
309 | /*@uses p_u->ukind, p_u->info@*/ | |
310 | /*@*/ ; | |
311 | ||
312 | extern /*@falsenull@*/ bool uentry_isRealFunction (uentry p_e) /*@*/ ; | |
313 | extern /*@falsenull@*/ bool uentry_isSpecified (uentry p_e) /*@*/ ; | |
314 | ||
315 | extern /*@falsenull@*/ bool uentry_isStructTag (/*@special@*/ uentry p_ue) | |
316 | /*@uses p_ue->ukind@*/ /*@*/ ; | |
317 | extern /*@falsenull@*/ bool uentry_isUnionTag (/*@special@*/ uentry p_ue) | |
318 | /*@uses p_ue->ukind@*/ /*@*/ ; | |
319 | ||
320 | extern /*@falsenull@*/ bool uentry_isVar (/*@special@*/ uentry p_e) | |
321 | /*@uses p_e->ukind@*/ | |
322 | /*@*/ ; | |
323 | ||
324 | extern /*@falsenull@*/ bool uentry_isVariable (/*@special@*/ uentry p_e) | |
325 | /*@uses p_e->ukind@*/ | |
326 | /*@*/ ; | |
327 | ||
328 | extern cstring uentry_dump (uentry p_v) ; | |
329 | extern cstring uentry_dumpParam (uentry p_v); | |
330 | extern cstring uentry_getName (/*@special@*/ uentry p_e) | |
331 | /*@uses p_e->ukind, p_e->info, p_e->uname@*/ | |
332 | /*@*/ ; | |
333 | ||
334 | extern cstring uentry_unparse (uentry p_v) /*@*/ ; | |
335 | extern cstring uentry_unparseAbbrev (uentry p_v) /*@*/ ; | |
336 | extern cstring uentry_unparseFull (uentry p_v) /*@*/ ; | |
337 | extern void uentry_setMutable (uentry p_e) /*@modifies p_e@*/ ; | |
338 | extern ctype uentry_getAbstractType (uentry p_e) /*@*/ ; | |
339 | extern ctype uentry_getRealType (uentry p_e) /*@globals internalState@*/ ; | |
340 | extern ctype uentry_getType (uentry p_e) /*@*/ ; | |
341 | extern ekind uentry_getKind (uentry p_e) /*@*/ ; | |
342 | extern /*@observer@*/ fileloc uentry_whereDefined (uentry p_e) /*@*/ ; | |
343 | extern /*@observer@*/ fileloc uentry_whereSpecified (uentry p_e) /*@*/ ; | |
344 | extern int uentry_compare (uentry p_u1, uentry p_u2); | |
345 | extern /*@exposed@*/ sRef uentry_getSref (/*@temp@*/ uentry p_e) /*@*/ ; | |
346 | extern /*@observer@*/ sRefSet uentry_getMods (uentry p_l) /*@*/ ; | |
347 | extern typeIdSet uentry_accessType (uentry p_e) /*@*/ ; | |
348 | extern /*@observer@*/ fileloc uentry_whereEither (uentry p_e) /*@*/ ; | |
349 | extern /*@notnull@*/ uentry uentry_makeExpandedMacro (cstring p_s, | |
350 | /*@temp@*/ fileloc p_f) | |
351 | /*@*/ ; | |
352 | ||
353 | extern void uentry_checkMatchParam (uentry p_u1, uentry p_u2, int p_paramno, exprNode p_e) /*@modifies g_msgstream@*/ ; | |
354 | ||
355 | extern /*@observer@*/ specialClauses uentry_getSpecialClauses (uentry p_ue) /*@*/ ; | |
356 | ||
357 | extern void uentry_showWhereLastExtra (uentry p_spec, /*@only@*/ cstring p_extra) | |
358 | /*@modifies g_msgstream@*/ ; | |
359 | ||
360 | # ifndef NOLCL | |
361 | extern void uentry_setRefCounted (uentry p_e); | |
362 | ||
363 | extern /*@notnull@*/ /*@only@*/ uentry uentry_makeUnnamedVariable (ctype p_t); | |
364 | ||
365 | extern /*@notnull@*/ uentry | |
366 | uentry_makeUnspecFunction (cstring p_n, ctype p_t, typeIdSet p_access, | |
367 | /*@keep@*/ fileloc p_f); | |
368 | ||
369 | extern /*@notnull@*/ uentry | |
370 | uentry_makePrivFunction2 (cstring p_n, ctype p_t, | |
371 | typeIdSet p_access, | |
372 | /*@only@*/ globSet p_globs, | |
373 | /*@only@*/ sRefSet p_mods, /*@keep@*/ fileloc p_f); | |
374 | ||
375 | extern /*@notnull@*/ uentry | |
376 | uentry_makeSpecEnumConstant (cstring p_n, ctype p_t, /*@keep@*/ fileloc p_loc) /*@*/ ; | |
377 | ||
378 | extern /*@notnull@*/ uentry | |
379 | uentry_makeEnumTag (cstring p_n, ctype p_t, /*@only@*/ fileloc p_loc) /*@*/ ; | |
380 | ||
381 | extern /*@notnull@*/ uentry | |
382 | uentry_makeTypeListFunction (cstring p_n, typeIdSet p_access, /*@only@*/ fileloc p_f) | |
383 | /*@*/ ; | |
384 | ||
385 | extern /*@notnull@*/ uentry | |
386 | uentry_makeSpecFunction (cstring p_n, ctype p_t, | |
387 | typeIdSet p_access, /*@only@*/ globSet p_globs, | |
388 | /*@only@*/ sRefSet p_mods, /*@keep@*/ fileloc p_f); | |
389 | # endif | |
390 | ||
391 | extern /*@notnull@*/ uentry | |
392 | uentry_makeEnumConstant (cstring p_n, ctype p_t) /*@*/ ; | |
393 | ||
394 | extern /*@notnull@*/ uentry | |
395 | uentry_makeEnumInitializedConstant (cstring p_n, ctype p_t, exprNode p_expr) /*@*/ ; | |
396 | ||
397 | extern /*@notnull@*/ /*@only@*/ uentry | |
398 | uentry_makeConstant (/*@temp@*/ cstring p_n, ctype p_t, /*@keep@*/ fileloc p_f) | |
399 | /*@*/ ; | |
400 | extern /*@notnull@*/ /*@only@*/ uentry | |
401 | uentry_makeConstantAux (/*@temp@*/ cstring p_n, ctype p_t, | |
402 | /*@keep@*/ fileloc p_f, bool p_priv, | |
403 | /*@only@*/ multiVal p_m) /*@*/ ; | |
404 | extern /*@notnull@*/ /*@only@*/ uentry | |
405 | uentry_makeDatatype (/*@temp@*/ cstring p_n, ctype p_t, ynm p_mut, ynm p_abs, | |
406 | /*@only@*/ fileloc p_f) /*@*/ ; | |
407 | extern /*@notnull@*/ /*@only@*/ uentry | |
408 | uentry_makeDatatypeAux (/*@temp@*/ cstring p_n, ctype p_t, ynm p_mut, | |
409 | ynm p_abs, /*@keep@*/ fileloc p_f, bool p_priv) /*@*/ ; | |
410 | extern /*@notnull@*/ uentry uentry_makeElipsisMarker (void) /*@*/ ; | |
411 | ||
412 | extern void uentry_makeVarFunction (/*@temp@*/ uentry p_ue) /*@modifies p_ue@*/ ; | |
413 | ||
414 | extern bool uentry_isElipsisMarker (/*@sef@*/ uentry p_u) /*@*/ ; | |
415 | # define uentry_isElipsisMarker(u) \ | |
416 | (uentry_isValid(u) && ekind_isElipsis ((u)->ukind)) | |
417 | ||
418 | extern /*@notnull@*/ uentry | |
419 | uentry_makeEndIter (cstring p_n, /*@only@*/ fileloc p_f) /*@*/ ; | |
420 | extern /*@notnull@*/ uentry | |
421 | uentry_makeEnumTagLoc (cstring p_n, ctype p_t) /*@*/ ; | |
422 | extern /*@notnull@*/ uentry | |
423 | uentry_makeForwardFunction (cstring p_n, typeId p_access, /*@temp@*/ fileloc p_f) /*@*/ ; | |
424 | ||
425 | extern /*@notnull@*/ uentry | |
426 | uentry_makeFunction (cstring p_n, ctype p_t, | |
427 | typeId p_access, | |
428 | /*@only@*/ globSet p_globs, /*@only@*/ sRefSet p_mods, | |
429 | /*@only@*/ fileloc p_f); | |
430 | ||
431 | extern /*@notnull@*/ uentry | |
432 | uentry_makeIter (cstring p_n, ctype p_ct, /*@only@*/ fileloc p_f) /*@*/ ; | |
433 | extern /*@notnull@*/ uentry | |
434 | uentry_makeParam (idDecl p_t, int p_i) /*@*/ ; | |
435 | ||
436 | extern /*@notnull@*/ uentry | |
437 | uentry_makeStructTag (cstring p_n, ctype p_t, /*@only@*/ fileloc p_loc); | |
438 | extern /*@notnull@*/ uentry | |
439 | uentry_makeStructTagLoc (cstring p_n, ctype p_t); | |
440 | extern /*@notnull@*/ uentry | |
441 | uentry_makeUnionTag (cstring p_n, ctype p_t, /*@only@*/ fileloc p_loc); | |
442 | extern /*@notnull@*/ uentry | |
443 | uentry_makeUnionTagLoc (cstring p_n, ctype p_t); | |
444 | extern /*@notnull@*/ uentry | |
445 | uentry_makeVariable (cstring p_n, ctype p_t, /*@keep@*/ fileloc p_f, bool p_isPriv); | |
446 | extern /*@notnull@*/ /*@only@*/ uentry | |
447 | uentry_makeVariableLoc (cstring p_n, ctype p_t); | |
448 | ||
449 | # ifndef NOLCL | |
450 | extern /*@notnull@*/ /*@only@*/ | |
451 | uentry uentry_makeVariableParam (cstring p_n, ctype p_t); | |
452 | # endif | |
453 | ||
454 | extern /*@notnull@*/ /*@only@*/ | |
455 | uentry uentry_makeVariableSrefParam (cstring p_n, ctype p_t, | |
456 | sRef p_s); | |
457 | extern /*@notnull@*/ /*@only@*/ | |
458 | uentry uentry_makeIdFunction (idDecl p_id); | |
459 | extern /*@notnull@*/ /*@only@*/ | |
460 | uentry uentry_makeIdDatatype (idDecl p_id); | |
461 | extern /*@notnull@*/ /*@only@*/ | |
462 | uentry uentry_makeBoolDatatype (ynm p_abs); | |
463 | extern void uentry_mergeDefinition (uentry p_old, /*@only@*/ uentry p_unew); | |
464 | extern void uentry_mergeEntries (uentry p_spec, /*@only@*/ uentry p_def); | |
465 | extern uentry uentry_nameCopy (/*@only@*/ cstring p_name, uentry p_e); | |
466 | extern uentry uentry_undump (ekind p_kind, fileloc p_loc, char **p_s); | |
467 | extern /*@observer@*/ uentryList uentry_getParams (uentry p_l) /*@*/ ; | |
468 | extern void uentry_resetParams (uentry p_ue, /*@only@*/ uentryList p_pn) | |
469 | /*@modifies p_ue@*/ ; | |
470 | extern /*@observer@*/ globSet uentry_getGlobs (uentry p_l) /*@*/ ; | |
471 | extern qual uentry_nullPred (uentry p_u); | |
472 | extern void uentry_free (/*@only@*/ /*@only@*/ uentry p_e); | |
473 | extern void uentry_setDatatype (uentry p_e, usymId p_uid); | |
474 | ||
475 | extern void uentry_setDefined (/*@special@*/ uentry p_e, fileloc p_f) | |
476 | /*@uses p_e->whereDefined, p_e->ukind, p_e->uname, p_e->info@*/ | |
477 | /*@modifies p_e@*/ ; | |
478 | ||
479 | extern void uentry_checkDecl (void); | |
480 | extern void uentry_clearDecl (void); | |
481 | extern void uentry_setDeclared (uentry p_e, fileloc p_f); | |
482 | extern void uentry_setDeclaredOnly (uentry p_e, /*@only@*/ fileloc p_f); | |
483 | extern void uentry_setDeclaredForceOnly (uentry p_e, /*@only@*/ fileloc p_f); | |
484 | extern void uentry_setFunctionDefined (uentry p_e, fileloc p_loc); | |
485 | extern void uentry_setName (uentry p_e, /*@only@*/ cstring p_n); | |
486 | extern void uentry_setParam (uentry p_e); | |
487 | extern void uentry_setSref (uentry p_e, /*@exposed@*/ sRef p_s); | |
488 | extern void uentry_setStatic (uentry p_c); | |
489 | ||
490 | extern void uentry_setModifies (uentry p_ue, /*@owned@*/ sRefSet p_sr) | |
491 | /*@modifies p_ue, p_sr@*/; | |
492 | ||
493 | extern void uentry_setSpecialClauses (uentry p_ue, /*@only@*/ specialClauses p_clauses) | |
494 | /*@modifies p_ue@*/ ; | |
495 | ||
496 | extern void uentry_setType (uentry p_e, ctype p_t); | |
497 | ||
498 | extern /*@unused@*/ /*@observer@*/ cstring uentry_checkedName (uentry p_ue); | |
499 | extern void uentry_showWhereLastPlain (uentry p_spec) /*@modifies g_msgstream@*/ ; | |
500 | ||
501 | extern void | |
502 | uentry_showWhereSpecifiedExtra (uentry p_spec, /*@only@*/ cstring p_s) | |
503 | /*@modifies g_msgstream@*/ ; | |
504 | ||
505 | extern void uentry_showWhereSpecified (uentry p_spec) /*@modifies g_msgstream@*/ ; | |
506 | extern void uentry_showWhereLast (uentry p_spec) /*@modifies g_msgstream@*/ ; | |
507 | extern void uentry_showWhereDeclared (uentry p_spec) /*@modifies g_msgstream@*/ ; | |
508 | ||
509 | extern /*@notnull@*/ /*@only@*/ uentry uentry_makeIdVariable (idDecl p_t) /*@*/ ; | |
510 | extern uentry uentry_copy (uentry p_e) /*@*/ ; | |
511 | extern void uentry_freeComplete (/*@only@*/ uentry p_e) ; | |
512 | extern void uentry_clearDefined (uentry p_e) /*@modifies p_e@*/; | |
513 | extern /*@observer@*/ cstring uentry_specDeclName (uentry p_u) /*@*/ ; | |
514 | ||
515 | extern void | |
516 | uentry_mergeState (uentry p_res, uentry p_other, fileloc p_loc, | |
517 | bool p_mustReturn, bool p_flip, bool p_opt, | |
518 | clause p_cl) /*@modifies p_res, p_other@*/ ; | |
519 | ||
520 | extern void uentry_setState (uentry p_res, uentry p_other) | |
521 | /*@modifies p_res, p_other@*/ ; | |
522 | ||
523 | extern void uentry_setRefParam (uentry p_e) /*@modifies p_e@*/ ; | |
524 | ||
525 | extern void uentry_setDeclaredForce (uentry p_e, fileloc p_f) /*@modifies p_e@*/; | |
526 | extern bool uentry_isNonLocal (uentry p_ue) /*@*/ ; | |
527 | extern bool uentry_isGlobal (uentry p_ue) /*@*/; | |
528 | extern bool uentry_isRefParam (uentry p_u) /*@*/ ; | |
529 | extern bool uentry_hasGlobs (uentry p_ue) /*@*/ ; | |
530 | extern bool uentry_hasMods (uentry p_ue) /*@*/ ; | |
531 | ||
532 | extern bool uentry_hasSpecialClauses (uentry p_ue) /*@*/ ; | |
533 | extern exitkind uentry_getExitCode (uentry p_ue) /*@*/ ; | |
534 | ||
535 | extern void uentry_checkYieldParam (uentry p_old, uentry p_unew); | |
536 | extern bool uentry_isOnly (uentry p_ue) /*@*/ ; | |
537 | extern bool uentry_isUnique (uentry p_ue) /*@*/ ; | |
538 | extern void uentry_reflectQualifiers (uentry p_ue, qualList p_q) /*@modifies p_ue@*/; | |
539 | extern bool uentry_isOut (uentry p_u) /*@*/ ; | |
540 | extern bool uentry_isPartial (uentry p_u) /*@*/ ; | |
541 | extern bool uentry_isStateSpecial (uentry p_u) /*@*/ ; | |
542 | extern bool uentry_possiblyNull (uentry p_u) /*@*/ ; | |
543 | extern ctype uentry_getForceRealType (uentry p_e) /*@globals internalState@*/ ; | |
544 | extern alkind uentry_getAliasKind (uentry p_u) /*@*/ ; | |
545 | extern exkind uentry_getExpKind (uentry p_u) /*@*/ ; | |
546 | extern /*@observer@*/ multiVal uentry_getConstantValue (uentry p_e) /*@*/ ; | |
547 | extern void uentry_fixupSref (uentry p_ue) /*@modifies p_ue@*/ ; | |
548 | extern void uentry_setGlobals (uentry p_ue, /*@owned@*/ globSet p_globs) /*@modifies p_ue@*/ ; | |
549 | extern bool uentry_isYield (uentry p_ue) /*@*/ ; | |
550 | extern /*@notnull@*/ uentry uentry_makeIdConstant (idDecl p_t) /*@*/ ; | |
551 | extern /*@observer@*/ cstring uentry_getRealName (uentry p_e) /*@*/ ; | |
552 | extern int uentry_xcomparealpha (uentry *p_p1, uentry *p_p2) /*@*/ ; | |
553 | extern int uentry_xcompareuses (uentry *p_p1, uentry *p_p2) /*@*/ ; | |
554 | extern /*@observer@*/ cstring uentry_specOrDefName (uentry p_u) /*@*/ ; | |
555 | extern void uentry_copyState (uentry p_res, uentry p_other); | |
556 | extern bool uentry_sameKind (uentry p_u1, uentry p_u2); | |
557 | extern /*@exposed@*/ sRef uentry_returnedRef (uentry p_u, exprNodeList p_args); | |
558 | extern bool uentry_isReturned (uentry p_u); | |
559 | extern bool uentry_isRefCountedDatatype (uentry p_e); | |
560 | extern sstate uentry_getDefState (uentry p_u); | |
561 | extern /*@unused@*/ void uentry_markFree (/*@owned@*/ uentry p_u); | |
562 | extern /*@dependent@*/ sRef uentry_getOrigSref (uentry p_e); | |
563 | extern void uentry_destroyMod (void) /*@modifies internalState@*/; | |
564 | extern void uentry_showDefSpecInfo (uentry p_ce, fileloc p_fwhere); | |
565 | extern void uentry_markOwned (/*@owned@*/ uentry p_u); | |
566 | ||
567 | extern /*@observer@*/ fileloc uentry_whereLast (uentry p_e) /*@*/ ; | |
568 | extern void uentry_setParamNo (uentry p_ue, int p_pno) /*@modifies p_ue@*/; | |
569 | ||
570 | extern /*@observer@*/ filelocList uentry_getUses (/*@sef@*/ uentry p_e) /*@*/ ; | |
571 | # define uentry_getUses(u) (uentry_isValid (u) ? (u)->uses : filelocList_undefined) | |
572 | ||
573 | extern bool uentry_isCheckedUnknown (uentry p_ue) /*@*/ ; | |
574 | extern bool uentry_isCheckedModify (uentry p_ue) /*@*/ ; | |
575 | extern bool uentry_isUnchecked (uentry p_ue) /*@*/ ; | |
576 | extern bool uentry_isChecked (uentry p_ue) /*@*/ ; | |
577 | extern bool uentry_isCheckMod (uentry p_ue) /*@*/ ; | |
578 | extern bool uentry_isCheckedStrict (uentry p_ue) /*@*/ ; | |
579 | extern void uentry_setUnchecked (uentry p_ue) /*@modifies p_ue@*/ ; | |
580 | extern void uentry_setChecked (uentry p_ue) /*@modifies p_ue@*/ ; | |
581 | extern void uentry_setCheckMod (uentry p_ue) /*@modifies p_ue@*/ ; | |
582 | extern void uentry_setCheckedStrict (uentry p_ue) /*@modifies p_ue@*/ ; | |
583 | ||
584 | extern bool uentry_hasAccessType (uentry p_e); | |
585 | ||
586 | extern /*@exposed@*/ uentry uentry_makeUnrecognized (cstring p_c, /*@keep@*/ fileloc p_loc); | |
587 | ||
1ac6313d | 588 | |
589 | /* start modifications */ | |
11ed4f45 | 590 | //extern void uentry_setBufferSize (uentry p_e, exprNode cconstant); |
591 | ||
1ac6313d | 592 | /* functions for making modification to null-term info */ |
593 | extern void uentry_setNullTerminatedState (uentry p_e); | |
594 | extern void uentry_setPossiblyNullTerminatedState (uentry p_e); | |
595 | extern void uentry_setNotNullTerminated (uentry p_e); | |
4cccc6ad | 596 | extern void uentry_setSize(uentry p_e, int p_size); |
597 | extern void uentry_setLen(uentry p_e, int p_len); | |
1ac6313d | 598 | |
4cccc6ad | 599 | /*@i66*/ |
600 | /*@-nullderef@*/ | |
1ac6313d | 601 | extern bool uentry_hasBufStateInfo (uentry p_ue); |
602 | # define uentry_hasBufStateInfo(p_ue) \ | |
603 | (((p_ue)->info->var->bufinfo != NULL) ? TRUE : FALSE) | |
604 | ||
4cccc6ad | 605 | extern bool uentry_isNullTerminated(/*@sef@*/uentry p_ue); |
1ac6313d | 606 | # define uentry_isNullTerminated(p_ue) \ |
4cccc6ad | 607 | ( uentry_hasBufStateInfo( (p_ue ) ) ? ( (p_ue)->info->var->bufinfo->bufstate \ |
1ac6313d | 608 | == BB_NULLTERMINATED) : FALSE) |
609 | ||
4cccc6ad | 610 | extern bool uentry_isPossiblyNullTerminated( /*@sef@*/ uentry p_ue); |
1ac6313d | 611 | # define uentry_isPossiblyNullTerminated(p_ue) \ |
4cccc6ad | 612 | ( uentry_hasBufStateInfo((p_ue)) ? ( (p_ue)->info->var->bufinfo->bufstate \ |
1ac6313d | 613 | == BB_POSSIBLYNULLTERMINATED) : FALSE) |
614 | ||
4cccc6ad | 615 | extern bool uentry_isNotNullTerminated( /*@sef@*/ uentry p_ue); |
1ac6313d | 616 | # define uentry_isNotNullTerminated(p_ue) \ |
4cccc6ad | 617 | ( uentry_hasBufStateInfo( (p_ue) ) ? ( (p_ue)->info->var->bufinfo->bufstate \ |
1ac6313d | 618 | == BB_NOTNULLTERMINATED) : FALSE) |
4cccc6ad | 619 | /*@=nullderef@*/ |
1ac6313d | 620 | |
621 | /* end modifications */ | |
622 | ||
885824d3 | 623 | # ifdef DOANNOTS |
624 | typedef enum { AN_UNKNOWN, AN_FCNRETURN, AN_FCNPARAM, AN_SUFIELD, AN_TDEFN, AN_GSVAR, | |
625 | AN_CONST, AN_LAST | |
626 | } ancontext; | |
627 | ||
628 | extern void initAnnots (); | |
629 | extern void printAnnots (void); | |
630 | extern void uentry_tallyAnnots (uentry u, ancontext kind); | |
631 | # endif /* DOANNOTS */ | |
632 | ||
4cccc6ad | 633 | /* start modifications */ |
634 | extern void uentry_setBufferSize (uentry p_e, exprNode p_cconstant); | |
93307a76 | 635 | /*drl7x*/ |
ef2aa32a | 636 | extern constraintList uentry_getFcnPreconditions (uentry ue); |
637 | extern constraintList uentry_getFcnPostconditions (uentry ue); | |
93307a76 | 638 | /*end mods*/ |
4cccc6ad | 639 | |
885824d3 | 640 | # else |
641 | # error "Multiple include" | |
642 | # endif | |
643 | ||
644 | ||
645 |