]>
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 | { |
b9904f57 | 20 | typeIdSet access; |
5e211f69 | 21 | bool macro; |
885824d3 | 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 | ||
abd7f895 | 56 | typedef /*@null@*/ 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 | |
b7e84605 | 169 | ** uentry_isDefined). |
885824d3 | 170 | */ |
171 | ||
0e41eb0e | 172 | extern /*@nullwhentrue@*/ bool uentry_isUndefined (/*@special@*/ uentry p_e) |
885824d3 | 173 | /*@*/ ; |
0e41eb0e | 174 | extern /*@nullwhentrue@*/ bool uentry_isInvalid (/*@special@*/ uentry p_e) |
885824d3 | 175 | /*@*/ ; |
0e41eb0e | 176 | extern /*@falsewhennull@*/ bool uentry_isValid (/*@special@*/ uentry p_e) |
885824d3 | 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 | ||
0e41eb0e | 196 | extern /*@falsewhennull@*/ bool uentry_isLset (/*@sef@*/ uentry p_e); |
885824d3 | 197 | # define uentry_isLset(e) \ |
198 | (uentry_isValid(e) && (e)->lset) | |
199 | ||
0e41eb0e | 200 | extern /*@falsewhennull@*/ bool uentry_isUsed (/*@sef@*/ uentry p_e); |
885824d3 | 201 | # define uentry_isUsed(e) (uentry_isValid(e) && (e)->used) |
202 | ||
0e41eb0e | 203 | extern /*@unused@*/ /*@falsewhennull@*/ bool |
885824d3 | 204 | uentry_isAbstractType (uentry p_e) /*@*/ ; |
205 | # define uentry_isAbstractType(e) (uentry_isAbstractDatatype(e)) | |
206 | ||
0e41eb0e | 207 | extern /*@falsewhennull@*/ bool uentry_isConstant (/*@sef@*/ uentry p_e) /*@*/ ; |
885824d3 | 208 | # define uentry_isConstant(e) \ |
209 | (uentry_isValid(e) && ekind_isConst ((e)->ukind)) | |
210 | ||
0e41eb0e | 211 | extern /*@falsewhennull@*/ bool uentry_isEitherConstant (/*@sef@*/ uentry p_e) /*@*/ ; |
885824d3 | 212 | # define uentry_isEitherConstant(e) \ |
213 | (uentry_isValid(e) && (ekind_isConst ((e)->ukind) || ekind_isEnumConst ((e)->ukind))) | |
214 | ||
0e41eb0e | 215 | extern /*@falsewhennull@*/ bool uentry_isEnumConstant (/*@sef@*/ uentry p_e) /*@*/ ; |
885824d3 | 216 | # define uentry_isEnumConstant(e) \ |
217 | (uentry_isValid(e) && ekind_isEnumConst ((e)->ukind)) | |
218 | ||
0e41eb0e | 219 | extern /*@falsewhennull@*/ bool uentry_isExternal (/*@sef@*/ uentry p_e) /*@*/ ; |
885824d3 | 220 | # define uentry_isExternal(c) \ |
221 | (uentry_isValid(c) && fileloc_isExternal (uentry_whereDefined (c))) | |
222 | ||
0e41eb0e | 223 | extern /*@falsewhennull@*/ bool uentry_isExtern (/*@sef@*/ uentry p_e) /*@*/ ; |
885824d3 | 224 | # define uentry_isExtern(c) \ |
225 | (uentry_isValid(c) && (c)->storageclass == SCEXTERN) | |
226 | ||
227 | extern bool uentry_isForward (uentry p_e) /*@*/ ; | |
228 | ||
0e41eb0e | 229 | extern /*@falsewhennull@*/ bool uentry_isFunction (/*@sef@*/ uentry p_e) /*@*/ ; |
885824d3 | 230 | # define uentry_isFunction(e) \ |
231 | (uentry_isValid(e) && ekind_isFunction ((e)->ukind)) | |
232 | ||
0e41eb0e | 233 | extern /*@falsewhennull@*/ bool uentry_isPriv (/*@sef@*/ uentry p_e) /*@*/ ; |
885824d3 | 234 | # define uentry_isPriv(e) \ |
235 | (uentry_isValid(e) && (e)->isPrivate) | |
236 | ||
0e41eb0e | 237 | extern /*@falsewhennull@*/ bool uentry_isFileStatic (uentry p_ue) /*@*/ ; |
238 | extern /*@falsewhennull@*/ bool uentry_isExported (uentry p_ue) /*@*/ ; | |
885824d3 | 239 | |
0e41eb0e | 240 | extern /*@falsewhennull@*/ bool uentry_isStatic (/*@sef@*/ uentry p_e) /*@*/ ; |
885824d3 | 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 | ||
80489f0a | 257 | extern void uentry_checkName (uentry p_ue) /*@modifies g_warningstream, p_ue@*/ ; |
885824d3 | 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) | |
80489f0a | 265 | /*@modifies g_warningstream@*/ ; |
885824d3 | 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) /*@*/ ; | |
0e41eb0e | 287 | extern /*@falsewhennull@*/ bool uentry_hasName (uentry p_e) /*@*/ ; |
288 | extern /*@falsewhennull@*/ bool uentry_hasRealName (uentry p_e) /*@*/ ; | |
289 | extern /*@falsewhennull@*/ bool uentry_isAbstractDatatype (uentry p_e) /*@*/ ; | |
290 | extern /*@falsewhennull@*/ bool uentry_isAnyTag (/*@special@*/ uentry p_ue) | |
885824d3 | 291 | /*@uses p_ue->ukind@*/ |
292 | /*@*/ ; | |
0e41eb0e | 293 | extern /*@falsewhennull@*/ bool uentry_isDatatype (uentry p_e) /*@*/ ; |
885824d3 | 294 | |
0e41eb0e | 295 | extern /*@falsewhennull@*/ bool uentry_isCodeDefined (uentry p_e) /*@*/ ; |
885824d3 | 296 | |
0e41eb0e | 297 | extern /*@falsewhennull@*/ bool uentry_isDeclared (/*@special@*/ uentry p_e) |
885824d3 | 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); |
0e41eb0e | 304 | extern /*@falsewhennull@*/ bool uentry_isEndIter (uentry p_e) /*@*/ ; |
305 | extern /*@falsewhennull@*/ bool uentry_isEnumTag (/*@special@*/ uentry p_ue) | |
885824d3 | 306 | /*@uses p_ue->ukind@*/ /*@*/ ; |
0e41eb0e | 307 | extern /*@falsewhennull@*/ bool uentry_isFakeTag (uentry p_e) /*@*/ ; |
308 | extern /*@falsewhennull@*/ bool uentry_isIter (uentry p_e) /*@*/ ; | |
309 | extern /*@falsewhennull@*/ bool uentry_isMutableDatatype (uentry p_e) /*@*/ ; | |
310 | extern /*@falsewhennull@*/ bool uentry_isParam (uentry p_u) /*@*/ ; | |
311 | extern /*@falsewhennull@*/ bool uentry_isExpandedMacro (uentry p_u) /*@*/ ; | |
312 | extern /*@falsewhennull@*/ bool uentry_isSefParam (uentry p_u) /*@*/ ; | |
313 | extern /*@falsewhennull@*/ bool uentry_isAnyParam (/*@special@*/ uentry p_u) | |
885824d3 | 314 | /*@uses p_u->ukind, p_u->info@*/ |
315 | /*@*/ ; | |
316 | ||
0e41eb0e | 317 | extern /*@falsewhennull@*/ bool uentry_isRealFunction (uentry p_e) /*@*/ ; |
318 | extern /*@falsewhennull@*/ bool uentry_isSpecified (uentry p_e) /*@*/ ; | |
885824d3 | 319 | |
0e41eb0e | 320 | extern /*@falsewhennull@*/ bool uentry_isStructTag (/*@special@*/ uentry p_ue) |
885824d3 | 321 | /*@uses p_ue->ukind@*/ /*@*/ ; |
0e41eb0e | 322 | extern /*@falsewhennull@*/ bool uentry_isUnionTag (/*@special@*/ uentry p_ue) |
885824d3 | 323 | /*@uses p_ue->ukind@*/ /*@*/ ; |
324 | ||
0e41eb0e | 325 | extern /*@falsewhennull@*/ bool uentry_isVar (/*@special@*/ uentry p_e) |
885824d3 | 326 | /*@uses p_e->ukind@*/ |
327 | /*@*/ ; | |
328 | ||
0e41eb0e | 329 | extern /*@falsewhennull@*/ bool uentry_isVariable (/*@special@*/ uentry p_e) |
885824d3 | 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 | ||
80489f0a | 361 | extern void uentry_checkMatchParam (uentry p_u1, uentry p_u2, int p_paramno, exprNode p_e) /*@modifies g_warningstream@*/ ; |
885824d3 | 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) | |
80489f0a | 366 | /*@modifies g_warningstream@*/ ; |
885824d3 | 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 | /*@*/ ; | |
5e211f69 | 408 | |
409 | extern /*@only@*/ /*@notnull@*/ uentry | |
3e3ec469 | 410 | uentry_makeConstantValue (/*@temp@*/ cstring p_n, ctype p_t, /*@keep@*/ fileloc p_f, |
411 | bool p_priv, /*@only@*/ multiVal p_val) | |
5e211f69 | 412 | /*@*/ ; |
413 | ||
414 | extern /*@notnull@*/ /*@only@*/ uentry | |
415 | uentry_makeMacroConstant (/*@temp@*/ cstring p_n, ctype p_t, /*@keep@*/ fileloc p_f) | |
416 | /*@*/ ; | |
417 | ||
885824d3 | 418 | extern /*@notnull@*/ /*@only@*/ uentry |
28bf4b0b | 419 | uentry_makeDatatype (/*@temp@*/ cstring p_n, ctype p_t, ynm p_mut, ynm p_abstract, |
885824d3 | 420 | /*@only@*/ fileloc p_f) /*@*/ ; |
421 | extern /*@notnull@*/ /*@only@*/ uentry | |
422 | uentry_makeDatatypeAux (/*@temp@*/ cstring p_n, ctype p_t, ynm p_mut, | |
28bf4b0b | 423 | ynm p_abstract, /*@keep@*/ fileloc p_f, bool p_priv) /*@*/ ; |
885824d3 | 424 | extern /*@notnull@*/ uentry uentry_makeElipsisMarker (void) /*@*/ ; |
425 | ||
426 | extern void uentry_makeVarFunction (/*@temp@*/ uentry p_ue) /*@modifies p_ue@*/ ; | |
b072092f | 427 | extern void uentry_makeConstantFunction (/*@temp@*/ uentry p_ue) /*@modifies p_ue@*/ ; |
885824d3 | 428 | |
429 | extern bool uentry_isElipsisMarker (/*@sef@*/ uentry p_u) /*@*/ ; | |
430 | # define uentry_isElipsisMarker(u) \ | |
431 | (uentry_isValid(u) && ekind_isElipsis ((u)->ukind)) | |
432 | ||
433 | extern /*@notnull@*/ uentry | |
434 | uentry_makeEndIter (cstring p_n, /*@only@*/ fileloc p_f) /*@*/ ; | |
435 | extern /*@notnull@*/ uentry | |
436 | uentry_makeEnumTagLoc (cstring p_n, ctype p_t) /*@*/ ; | |
437 | extern /*@notnull@*/ uentry | |
438 | uentry_makeForwardFunction (cstring p_n, typeId p_access, /*@temp@*/ fileloc p_f) /*@*/ ; | |
439 | ||
440 | extern /*@notnull@*/ uentry | |
441 | uentry_makeFunction (cstring p_n, ctype p_t, | |
442 | typeId p_access, | |
443 | /*@only@*/ globSet p_globs, /*@only@*/ sRefSet p_mods, | |
28bf4b0b | 444 | /*@only@*/ warnClause p_warn, |
885824d3 | 445 | /*@only@*/ fileloc p_f); |
446 | ||
447 | extern /*@notnull@*/ uentry | |
448 | uentry_makeIter (cstring p_n, ctype p_ct, /*@only@*/ fileloc p_f) /*@*/ ; | |
449 | extern /*@notnull@*/ uentry | |
450 | uentry_makeParam (idDecl p_t, int p_i) /*@*/ ; | |
451 | ||
452 | extern /*@notnull@*/ uentry | |
453 | uentry_makeStructTag (cstring p_n, ctype p_t, /*@only@*/ fileloc p_loc); | |
454 | extern /*@notnull@*/ uentry | |
455 | uentry_makeStructTagLoc (cstring p_n, ctype p_t); | |
456 | extern /*@notnull@*/ uentry | |
457 | uentry_makeUnionTag (cstring p_n, ctype p_t, /*@only@*/ fileloc p_loc); | |
458 | extern /*@notnull@*/ uentry | |
459 | uentry_makeUnionTagLoc (cstring p_n, ctype p_t); | |
460 | extern /*@notnull@*/ uentry | |
461 | uentry_makeVariable (cstring p_n, ctype p_t, /*@keep@*/ fileloc p_f, bool p_isPriv); | |
462 | extern /*@notnull@*/ /*@only@*/ uentry | |
463 | uentry_makeVariableLoc (cstring p_n, ctype p_t); | |
464 | ||
465 | # ifndef NOLCL | |
466 | extern /*@notnull@*/ /*@only@*/ | |
6970c11b | 467 | uentry uentry_makeVariableParam (cstring p_n, ctype p_t, fileloc p_loc); |
885824d3 | 468 | # endif |
469 | ||
470 | extern /*@notnull@*/ /*@only@*/ | |
6970c11b | 471 | uentry uentry_makeVariableSrefParam (cstring p_n, ctype p_t, /*@only@*/ fileloc p_loc, |
472 | /*@exposed@*/ sRef p_s); | |
885824d3 | 473 | extern /*@notnull@*/ /*@only@*/ |
474 | uentry uentry_makeIdFunction (idDecl p_id); | |
475 | extern /*@notnull@*/ /*@only@*/ | |
476 | uentry uentry_makeIdDatatype (idDecl p_id); | |
477 | extern /*@notnull@*/ /*@only@*/ | |
28bf4b0b | 478 | uentry uentry_makeBoolDatatype (ynm p_abstract); |
885824d3 | 479 | extern void uentry_mergeDefinition (uentry p_old, /*@only@*/ uentry p_unew); |
480 | extern void uentry_mergeEntries (uentry p_spec, /*@only@*/ uentry p_def); | |
481 | extern uentry uentry_nameCopy (/*@only@*/ cstring p_name, uentry p_e); | |
482 | extern uentry uentry_undump (ekind p_kind, fileloc p_loc, char **p_s); | |
483 | extern /*@observer@*/ uentryList uentry_getParams (uentry p_l) /*@*/ ; | |
484 | extern void uentry_resetParams (uentry p_ue, /*@only@*/ uentryList p_pn) | |
485 | /*@modifies p_ue@*/ ; | |
486 | extern /*@observer@*/ globSet uentry_getGlobs (uentry p_l) /*@*/ ; | |
487 | extern qual uentry_nullPred (uentry p_u); | |
488 | extern void uentry_free (/*@only@*/ /*@only@*/ uentry p_e); | |
489 | extern void uentry_setDatatype (uentry p_e, usymId p_uid); | |
490 | ||
491 | extern void uentry_setDefined (/*@special@*/ uentry p_e, fileloc p_f) | |
492 | /*@uses p_e->whereDefined, p_e->ukind, p_e->uname, p_e->info@*/ | |
493 | /*@modifies p_e@*/ ; | |
494 | ||
495 | extern void uentry_checkDecl (void); | |
496 | extern void uentry_clearDecl (void); | |
497 | extern void uentry_setDeclared (uentry p_e, fileloc p_f); | |
498 | extern void uentry_setDeclaredOnly (uentry p_e, /*@only@*/ fileloc p_f); | |
499 | extern void uentry_setDeclaredForceOnly (uentry p_e, /*@only@*/ fileloc p_f); | |
500 | extern void uentry_setFunctionDefined (uentry p_e, fileloc p_loc); | |
501 | extern void uentry_setName (uentry p_e, /*@only@*/ cstring p_n); | |
502 | extern void uentry_setParam (uentry p_e); | |
503 | extern void uentry_setSref (uentry p_e, /*@exposed@*/ sRef p_s); | |
504 | extern void uentry_setStatic (uentry p_c); | |
505 | ||
506 | extern void uentry_setModifies (uentry p_ue, /*@owned@*/ sRefSet p_sr) | |
507 | /*@modifies p_ue, p_sr@*/; | |
508 | ||
28bf4b0b | 509 | extern bool uentry_hasWarning (uentry p_ue) /*@*/ ; |
510 | ||
511 | extern void uentry_addWarning (uentry p_ue, /*@only@*/ warnClause p_warn) | |
512 | /*@modifies p_ue*/; | |
513 | ||
514 | extern void uentry_setStateClauseList (uentry p_ue, /*@only@*/ stateClauseList p_clauses) | |
885824d3 | 515 | /*@modifies p_ue@*/ ; |
516 | ||
517 | extern void uentry_setType (uentry p_e, ctype p_t); | |
518 | ||
519 | extern /*@unused@*/ /*@observer@*/ cstring uentry_checkedName (uentry p_ue); | |
80489f0a | 520 | extern void uentry_showWhereLastPlain (uentry p_spec) /*@modifies g_warningstream@*/ ; |
885824d3 | 521 | |
522 | extern void | |
523 | uentry_showWhereSpecifiedExtra (uentry p_spec, /*@only@*/ cstring p_s) | |
80489f0a | 524 | /*@modifies g_warningstream@*/ ; |
885824d3 | 525 | |
80489f0a | 526 | extern void uentry_showWhereSpecified (uentry p_spec) /*@modifies g_warningstream@*/ ; |
527 | extern void uentry_showWhereLast (uentry p_spec) /*@modifies g_warningstream@*/ ; | |
528 | extern void uentry_showWhereDeclared (uentry p_spec) /*@modifies g_warningstream@*/ ; | |
885824d3 | 529 | |
530 | extern /*@notnull@*/ /*@only@*/ uentry uentry_makeIdVariable (idDecl p_t) /*@*/ ; | |
531 | extern uentry uentry_copy (uentry p_e) /*@*/ ; | |
532 | extern void uentry_freeComplete (/*@only@*/ uentry p_e) ; | |
533 | extern void uentry_clearDefined (uentry p_e) /*@modifies p_e@*/; | |
534 | extern /*@observer@*/ cstring uentry_specDeclName (uentry p_u) /*@*/ ; | |
535 | ||
536 | extern void | |
537 | uentry_mergeState (uentry p_res, uentry p_other, fileloc p_loc, | |
538 | bool p_mustReturn, bool p_flip, bool p_opt, | |
539 | clause p_cl) /*@modifies p_res, p_other@*/ ; | |
540 | ||
541 | extern void uentry_setState (uentry p_res, uentry p_other) | |
542 | /*@modifies p_res, p_other@*/ ; | |
543 | ||
544 | extern void uentry_setRefParam (uentry p_e) /*@modifies p_e@*/ ; | |
545 | ||
546 | extern void uentry_setDeclaredForce (uentry p_e, fileloc p_f) /*@modifies p_e@*/; | |
547 | extern bool uentry_isNonLocal (uentry p_ue) /*@*/ ; | |
28bf4b0b | 548 | extern bool uentry_isGlobalVariable (uentry p_ue) /*@*/; |
549 | extern bool uentry_isVisibleExternally (uentry p_ue) /*@*/; | |
885824d3 | 550 | extern bool uentry_isRefParam (uentry p_u) /*@*/ ; |
551 | extern bool uentry_hasGlobs (uentry p_ue) /*@*/ ; | |
552 | extern bool uentry_hasMods (uentry p_ue) /*@*/ ; | |
553 | ||
28bf4b0b | 554 | extern bool uentry_hasStateClauseList (uentry p_ue) /*@*/ ; |
ccf0a4a8 | 555 | extern bool uentry_hasConditions (uentry p_ue) /*@*/ ; |
556 | ||
885824d3 | 557 | extern exitkind uentry_getExitCode (uentry p_ue) /*@*/ ; |
558 | ||
559 | extern void uentry_checkYieldParam (uentry p_old, uentry p_unew); | |
560 | extern bool uentry_isOnly (uentry p_ue) /*@*/ ; | |
561 | extern bool uentry_isUnique (uentry p_ue) /*@*/ ; | |
562 | extern void uentry_reflectQualifiers (uentry p_ue, qualList p_q) /*@modifies p_ue@*/; | |
563 | extern bool uentry_isOut (uentry p_u) /*@*/ ; | |
564 | extern bool uentry_isPartial (uentry p_u) /*@*/ ; | |
565 | extern bool uentry_isStateSpecial (uentry p_u) /*@*/ ; | |
566 | extern bool uentry_possiblyNull (uentry p_u) /*@*/ ; | |
567 | extern ctype uentry_getForceRealType (uentry p_e) /*@globals internalState@*/ ; | |
568 | extern alkind uentry_getAliasKind (uentry p_u) /*@*/ ; | |
569 | extern exkind uentry_getExpKind (uentry p_u) /*@*/ ; | |
570 | extern /*@observer@*/ multiVal uentry_getConstantValue (uentry p_e) /*@*/ ; | |
571 | extern void uentry_fixupSref (uentry p_ue) /*@modifies p_ue@*/ ; | |
28bf4b0b | 572 | extern void uentry_setGlobals (uentry p_ue, /*@owned@*/ globSet p_globs) /*@modifies p_ue, p_globs@*/ ; |
885824d3 | 573 | extern bool uentry_isYield (uentry p_ue) /*@*/ ; |
574 | extern /*@notnull@*/ uentry uentry_makeIdConstant (idDecl p_t) /*@*/ ; | |
575 | extern /*@observer@*/ cstring uentry_getRealName (uentry p_e) /*@*/ ; | |
576 | extern int uentry_xcomparealpha (uentry *p_p1, uentry *p_p2) /*@*/ ; | |
577 | extern int uentry_xcompareuses (uentry *p_p1, uentry *p_p2) /*@*/ ; | |
578 | extern /*@observer@*/ cstring uentry_specOrDefName (uentry p_u) /*@*/ ; | |
579 | extern void uentry_copyState (uentry p_res, uentry p_other); | |
580 | extern bool uentry_sameKind (uentry p_u1, uentry p_u2); | |
581 | extern /*@exposed@*/ sRef uentry_returnedRef (uentry p_u, exprNodeList p_args); | |
582 | extern bool uentry_isReturned (uentry p_u); | |
583 | extern bool uentry_isRefCountedDatatype (uentry p_e); | |
584 | extern sstate uentry_getDefState (uentry p_u); | |
585 | extern /*@unused@*/ void uentry_markFree (/*@owned@*/ uentry p_u); | |
586 | extern /*@dependent@*/ sRef uentry_getOrigSref (uentry p_e); | |
587 | extern void uentry_destroyMod (void) /*@modifies internalState@*/; | |
588 | extern void uentry_showDefSpecInfo (uentry p_ce, fileloc p_fwhere); | |
589 | extern void uentry_markOwned (/*@owned@*/ uentry p_u); | |
590 | ||
591 | extern /*@observer@*/ fileloc uentry_whereLast (uentry p_e) /*@*/ ; | |
592 | extern void uentry_setParamNo (uentry p_ue, int p_pno) /*@modifies p_ue@*/; | |
593 | ||
594 | extern /*@observer@*/ filelocList uentry_getUses (/*@sef@*/ uentry p_e) /*@*/ ; | |
595 | # define uentry_getUses(u) (uentry_isValid (u) ? (u)->uses : filelocList_undefined) | |
596 | ||
597 | extern bool uentry_isCheckedUnknown (uentry p_ue) /*@*/ ; | |
598 | extern bool uentry_isCheckedModify (uentry p_ue) /*@*/ ; | |
599 | extern bool uentry_isUnchecked (uentry p_ue) /*@*/ ; | |
600 | extern bool uentry_isChecked (uentry p_ue) /*@*/ ; | |
601 | extern bool uentry_isCheckMod (uentry p_ue) /*@*/ ; | |
602 | extern bool uentry_isCheckedStrict (uentry p_ue) /*@*/ ; | |
603 | extern void uentry_setUnchecked (uentry p_ue) /*@modifies p_ue@*/ ; | |
604 | extern void uentry_setChecked (uentry p_ue) /*@modifies p_ue@*/ ; | |
605 | extern void uentry_setCheckMod (uentry p_ue) /*@modifies p_ue@*/ ; | |
606 | extern void uentry_setCheckedStrict (uentry p_ue) /*@modifies p_ue@*/ ; | |
607 | ||
608 | extern bool uentry_hasAccessType (uentry p_e); | |
609 | ||
28bf4b0b | 610 | /*@constant cstring GLOBAL_MARKER_NAME@*/ |
611 | # define GLOBAL_MARKER_NAME cstring_makeLiteralTemp ("#GM#") | |
1ac6313d | 612 | |
1ac6313d | 613 | /* functions for making modification to null-term info */ |
b7b694d6 | 614 | extern void uentry_setNullTerminatedState (uentry p_e); |
615 | extern void uentry_setPossiblyNullTerminatedState (uentry p_e); | |
616 | extern void uentry_setSize(uentry p_e, int p_size); | |
617 | extern void uentry_setLen(uentry p_e, int p_len); | |
1ac6313d | 618 | |
4cccc6ad | 619 | /*@i66*/ |
620 | /*@-nullderef@*/ | |
1ac6313d | 621 | extern bool uentry_hasBufStateInfo (uentry p_ue); |
622 | # define uentry_hasBufStateInfo(p_ue) \ | |
623 | (((p_ue)->info->var->bufinfo != NULL) ? TRUE : FALSE) | |
624 | ||
84c9ffbf | 625 | /*@unused@*/ extern bool uentry_isNullTerminated(/*@sef@*/uentry p_ue); |
1ac6313d | 626 | # define uentry_isNullTerminated(p_ue) \ |
bb7c2085 | 627 | ( uentry_hasBufStateInfo((p_ue ) ) ? ((p_ue)->info->var->bufinfo->bufstate \ |
1ac6313d | 628 | == BB_NULLTERMINATED) : FALSE) |
629 | ||
84c9ffbf | 630 | /*@unused@*/ extern bool uentry_isPossiblyNullTerminated( /*@sef@*/ uentry p_ue); |
1ac6313d | 631 | # define uentry_isPossiblyNullTerminated(p_ue) \ |
bb7c2085 | 632 | ( uentry_hasBufStateInfo((p_ue)) ? ((p_ue)->info->var->bufinfo->bufstate \ |
1ac6313d | 633 | == BB_POSSIBLYNULLTERMINATED) : FALSE) |
634 | ||
84c9ffbf | 635 | /*@unused@*/ extern bool uentry_isNotNullTerminated( /*@sef@*/ uentry p_ue); |
1ac6313d | 636 | # define uentry_isNotNullTerminated(p_ue) \ |
bb7c2085 | 637 | ( uentry_hasBufStateInfo((p_ue) ) ? ((p_ue)->info->var->bufinfo->bufstate \ |
1ac6313d | 638 | == BB_NOTNULLTERMINATED) : FALSE) |
4cccc6ad | 639 | /*@=nullderef@*/ |
1ac6313d | 640 | |
641 | /* end modifications */ | |
642 | ||
28bf4b0b | 643 | extern uentry uentry_makeGlobalMarker (void) ; |
644 | extern bool uentry_isGlobalMarker (uentry) /*@*/ ; | |
645 | ||
7ebcc5bb | 646 | extern /*@exposed@*/ uentry uentry_makeUnrecognized (cstring p_c, /*@only@*/ fileloc p_loc); |
28bf4b0b | 647 | |
885824d3 | 648 | # ifdef DOANNOTS |
5e211f69 | 649 | typedef enum |
650 | { | |
651 | AN_UNKNOWN, AN_FCNRETURN, AN_FCNPARAM, AN_SUFIELD, AN_TDEFN, AN_GSVAR, | |
652 | AN_CONST, AN_LAST | |
653 | } ancontext; | |
885824d3 | 654 | |
655 | extern void initAnnots (); | |
656 | extern void printAnnots (void); | |
657 | extern void uentry_tallyAnnots (uentry u, ancontext kind); | |
658 | # endif /* DOANNOTS */ | |
659 | ||
ba45e1e4 | 660 | extern bool uentry_hasMetaStateEnsures (uentry p_e) /*@*/ ; |
ccf0a4a8 | 661 | extern /*@only@*/ metaStateConstraintList uentry_getMetaStateEnsures (uentry p_e); |
ba45e1e4 | 662 | |
4cccc6ad | 663 | /* start modifications */ |
b7b694d6 | 664 | |
93307a76 | 665 | /*drl7x*/ |
28bf4b0b | 666 | extern constraintList uentry_getFcnPreconditions (uentry p_ue); |
667 | extern constraintList uentry_getFcnPostconditions (uentry p_ue); | |
920a3797 | 668 | |
3814599d | 669 | extern void uentry_setPostconditions (uentry p_ue, /*@only@*/ functionConstraint p_postconditions); |
670 | ||
671 | extern void uentry_setPreconditions (uentry p_ue, /*@only@*/ functionConstraint p_preconditions); | |
b7b694d6 | 672 | /*end mods*/ |
4cccc6ad | 673 | |
6483a926 | 674 | /* |
675 | ** For debugging only | |
676 | */ | |
677 | ||
678 | # ifdef DEBUGSPLINT | |
679 | extern void uentry_checkValid (uentry p_ue) /*@modifies g_errorstream@*/ ; | |
680 | # endif | |
681 | ||
885824d3 | 682 | # else |
683 | # error "Multiple include" | |
684 | # endif | |
685 | ||
686 | ||
687 |