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