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