]>
Commit | Line | Data |
---|---|---|
1 | #ifndef __constraint_h__ | |
2 | ||
3 | #define __constraint_h__ | |
4 | ||
5 | typedef enum | |
6 | { | |
7 | LT, LTE, GT, GTE, EQ, NONNEGATIVE, POSITIVE | |
8 | } | |
9 | arithType; | |
10 | ||
11 | struct s_constraint { | |
12 | constraint orig; | |
13 | constraint or; | |
14 | bool fcnPre; | |
15 | constraintExpr lexpr; | |
16 | arithType ar; | |
17 | constraintExpr expr; | |
18 | bool post; | |
19 | /*@exposed@*/ /*@dependent@*/ exprNode generatingExpr; | |
20 | } ; | |
21 | ||
22 | /*@constant null constraint constraint_undefined; @*/ | |
23 | ||
24 | # define constraint_undefined ((constraint)NULL) | |
25 | ||
26 | extern /*@falsewhennull@*/ bool constraint_isDefined (constraint p_e) /*@*/ ; | |
27 | extern /*@unused@*/ /*@nullwhentrue@*/ bool constraint_isUndefined (constraint p_e) /*@*/ ; | |
28 | extern /*@nullwhentrue@*/ /*@unused@*/ bool constraint_isError (constraint p_e) /*@*/ ; | |
29 | ||
30 | # define constraint_isDefined(e) ((e) != constraint_undefined) | |
31 | # define constraint_isUndefined(e) ((e) == constraint_undefined) | |
32 | # define constraint_isError(e) ((e) == constraint_undefined) | |
33 | ||
34 | extern void constraint_free (/*@only@*/ constraint p_c); | |
35 | ||
36 | /* constraint makeConstraintParse (sRef x, lltok relOp, exprNode cconstant); */ | |
37 | ||
38 | /*@-czechfcns*/ | |
39 | ||
40 | extern constraint | |
41 | constraint_makeReadSafeExprNode (/*@observer@*/ exprNode p_po, | |
42 | /*@observer@*/ exprNode p_ind); | |
43 | ||
44 | extern /*@only@*/ constraint constraint_makeWriteSafeExprNode (/*@observer@*/ exprNode p_po, | |
45 | /*@observer@*/ exprNode p_ind); | |
46 | ||
47 | extern /*@only@*/ constraint constraint_makeReadSafeInt (/*@observer@*/ exprNode p_t1, int p_index); | |
48 | ||
49 | extern /*@only@*/ constraint | |
50 | constraint_makeEnsureMaxReadAtLeast (/*@observer@*/ exprNode p_t1, | |
51 | /*@observer@*/ exprNode p_t2, fileloc p_sequencePoint); | |
52 | ||
53 | extern void constraint_overWrite (constraint p_c1, /*@observer@*/ constraint p_c2) | |
54 | /*@modifies p_c1 @*/; | |
55 | ||
56 | extern /*@only@*/ constraint constraint_copy (/*@temp@*/ constraint p_c); | |
57 | ||
58 | extern bool fileloc_closer (/*@observer@*/ fileloc p_loc1, | |
59 | /*@observer@*/ fileloc p_loc2, | |
60 | /*@observer@*/ fileloc p_loc3) /*@*/; | |
61 | ||
62 | extern /*@only@*/ cstring arithType_print (arithType p_ar) /*@*/; | |
63 | ||
64 | extern /*@only@*/ fileloc constraint_getFileloc (constraint p_c); | |
65 | ||
66 | extern /*@only@*/ cstring constraint_unparse (/*@temp@*/ constraint p_c) /*@*/; | |
67 | extern /*@only@*/ cstring constraint_unparseOr (/*@temp@*/ constraint p_c) /*@*/ ; | |
68 | extern /*@only@*/ cstring constraint_unparseDetailed (constraint p_c) /*@*/ ; | |
69 | ||
70 | extern /*@only@*/ constraint | |
71 | constraint_makeWriteSafeInt (/*@dependent@*/ /*@observer@*/ exprNode p_po, int p_ind); | |
72 | ||
73 | extern exprNode exprNode_copyConstraints (/*@returned@*/ exprNode p_dst, exprNode p_src) /*@modifies p_dst @*/; | |
74 | ||
75 | extern /*@only@*/ constraint constraint_makeEnsureEqual (/*@dependent@*/ /*@observer@*/ exprNode p_e1, /*@dependent@*/ /*@observer@*/ exprNode p_e2, fileloc p_sequencePoint); | |
76 | ||
77 | extern /*@only@*/ constraint constraint_makeMaxSetSideEffectPostIncrement (/*@dependent@*/ /*@observer@*/ exprNode p_e, fileloc p_sequencePoint); | |
78 | ||
79 | extern constraint constraint_preserveOrig (/*@returned@*/ constraint p_c) /*@modifies p_c @*/; | |
80 | extern /*@only@*/ constraint constraint_doSRefFixBaseParam (/*@returned@*/ /*@only@*/ constraint p_precondition, | |
81 | exprNodeList p_arglist); | |
82 | extern /*@only@*/ constraint constraint_makeEnsureLessThan (/*@dependent@*/ /*@observer@*/ exprNode p_e1, /*@dependent@*/ /*@observer@*/ exprNode p_e2, fileloc p_sequencePoint); | |
83 | extern /*@only@*/ constraint constraint_makeEnsureLessThanEqual (/*@dependent@*/ /*@observer@*/ exprNode p_e1, /*@dependent@*/ /*@observer@*/ exprNode p_e2, fileloc p_sequencePoint); | |
84 | ||
85 | extern /*@only@*/ constraint constraint_makeEnsureGreaterThan (/*@dependent@*/ /*@observer@*/ exprNode p_e1, /*@dependent@*/ /*@observer@*/ exprNode p_e2, fileloc p_sequencePoint); | |
86 | extern /*@only@*/ constraint constraint_makeEnsureGreaterThanEqual (/*@dependent@*/ /*@observer@*/ exprNode p_e1, /*@dependent@*/ /*@observer@*/ exprNode p_e2, fileloc p_sequencePoint); | |
87 | ||
88 | /*drl add 11/28/2000 */ | |
89 | extern /*@only@*/ constraint constraint_makeSRefWriteSafeInt (sRef p_s, int p_ind); | |
90 | extern /*@unused@*/ /*@only@*/ constraint constraint_makeSRefReadSafeInt (sRef p_s, int p_ind); | |
91 | /*drl add 11/26/2000 */ | |
92 | extern void constraint_printError (/*@observer@*/ /*@temp@*/ constraint p_c, /*@temp@*/ /*@observer@*/ fileloc p_loc); | |
93 | ||
94 | extern /*@only@*/ constraint constraint_doSRefFixConstraintParam (constraint p_precondition, | |
95 | /*@temp@*/ /*@observer@*/ exprNodeList p_arglist); | |
96 | ||
97 | extern /*@only@*/ constraint constraint_makeSRefSetBufferSize (sRef p_s, long int p_size); | |
98 | ||
99 | extern /*@only@*/ constraint constraint_doFixResult (constraint p_postcondition, /*@dependent@*/ /*@observer@*/ exprNode p_fcnCall); | |
100 | ||
101 | extern /*@only@*/ constraint constraint_makeEnsureLteMaxRead(/*@dependent@*/ /*@observer@*/ exprNode p_index, /*@dependent@*/ /*@observer@*/ exprNode p_buffer); | |
102 | ||
103 | extern /*@only@*/ constraint constraint_makeMaxSetSideEffectPostDecrement (/*@dependent@*/ /*@observer@*/ exprNode p_e, fileloc p_sequencePoint); | |
104 | ||
105 | extern bool constraint_search (constraint p_c, constraintExpr p_old); | |
106 | ||
107 | extern /*@only@*/ constraint makeConstraintParse3 (constraintExpr p_l, lltok p_relOp, constraintExpr p_r); | |
108 | ||
109 | extern constraint constraint_addGeneratingExpr (/*@returned@*/ constraint p_c, /*@dependent@*/ /*@exposed@*/ exprNode p_e); | |
110 | ||
111 | extern bool constraint_hasMaxSet(constraint p_c); | |
112 | ||
113 | /*from constraintGenreation.c*/ | |
114 | extern void exprNode_exprTraverse (exprNode p_e, bool p_definatelv, bool p_definaterv, /*@temp@*/ /*@observer@*/ fileloc p_sequencePoint); | |
115 | ||
116 | extern /*@only@*/ constraintList | |
117 | exprNode_traversRequiresConstraints (exprNode p_e); | |
118 | ||
119 | extern /*@only@*/ constraintList | |
120 | exprNode_traversEnsuresConstraints (exprNode p_e); | |
121 | ||
122 | extern constraint constraint_togglePost (/*@returned@*/ constraint p_c); | |
123 | extern bool constraint_same (constraint p_c1, constraint p_c2) ; | |
124 | extern void constraint_printErrorPostCondition (constraint p_c, fileloc p_loc) ; | |
125 | ||
126 | extern cstring constraint_printLocation (/*@observer@*/ /*@temp@*/ constraint p_c) /*@*/; /*drl add 8-11-001*/ | |
127 | ||
128 | extern constraint constraint_setFcnPre (/*@returned@*/ constraint p_c) ; | |
129 | extern constraint constraint_origAddGeneratingExpr (/*@returned@*/ constraint p_c, /*@dependent@*/ /*@observer@*/ exprNode p_e) ; | |
130 | ||
131 | extern bool /*@alt void@*/ exprNode_generateConstraints (/*@temp@*/ exprNode p_e) ; | |
132 | constraint constraint_togglePostOrig (/*@returned@*/ constraint p_c); | |
133 | ||
134 | bool constraint_hasOrig( /*@observer@*/ /*@temp@*/ constraint p_c); | |
135 | ||
136 | constraint constraint_makeAddAssign (/*@dependent@*/ /*@observer@*/ exprNode p_e, /*@dependent@*/ /*@observer@*/ exprNode p_f, fileloc p_sequencePoint); | |
137 | ||
138 | constraint constraint_makeSubtractAssign (/*@dependent@*/ /*@observer@*/ exprNode p_e, /*@dependent@*/ /*@observer@*/ exprNode p_f, fileloc p_sequencePoint); | |
139 | ||
140 | /*@only@*/ constraint constraint_undump (FILE * p_f); | |
141 | ||
142 | void constraint_dump (/*@observer@*/ constraint p_c, FILE * p_f); | |
143 | ||
144 | extern void exprNode_forLoopHeuristics( /*@dependent@*/ exprNode p_e, /*@dependent@*/ exprNode p_forPred, /*@dependent@*/ exprNode p_forBody); | |
145 | ||
146 | int constraint_compare (/*@observer@*/ /*@temp@*/ const constraint * p_c1, /*@observer@*/ /*@temp@*/ const constraint * p_c2) /*@*/; | |
147 | ||
148 | bool constraint_isPost (/*@observer@*/ /*@temp@*/ constraint p_c); | |
149 | ||
150 | bool constraint_tooDeep (/*@observer@*/ /*@temp@*/ constraint p_c); | |
151 | ||
152 | void exprNode_findValue( exprNode p_e); | |
153 | ||
154 | /*drl 1/6/2001: I didn't think these functions were solid enough to include in the stable release of splint.*/ | |
155 | /*drl added 12/30/01 */ | |
156 | /* extern / *@only@* / constraint constraint_doSRefFixInvarConstraint(constraint p_invar, sRef p_s, ctype p_ct ); */ | |
157 | ||
158 | /*drl added 12/19 */ | |
159 | bool constraint_isConstantOnly (constraint p_c); | |
160 | /*@=czechfcns*/ | |
161 | /* drl possible problem : warning take this out */ | |
162 | ||
163 | #include "constraintResolve.h" | |
164 | #include "constraintOutput.h" | |
165 | ||
166 | #else | |
167 | ||
168 | #error Multiple include | |
169 | ||
170 | #endif | |
171 |