]> andersk Git - splint.git/blame - src/Headers/constraint.h
Changes to fix malloc size problem.
[splint.git] / src / Headers / constraint.h
CommitLineData
92c4a786 1#ifndef __constraint_h__
bf92e32c 2
92c4a786 3#define __constraint_h__
bf92e32c 4
d0e5b01f 5typedef enum
6{
ae133592 7 LT, LTE, GT, GTE, EQ, NONNEGATIVE, POSITIVE, CASTEQ
d0e5b01f 8}
9arithType;
10
28bf4b0b 11struct s_constraint {
ae133592 12 arithType ar;
13 constraint orig;
14 constraint or;
15 bool fcnPre;
361091cc 16 constraintExpr lexpr;
ae133592 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 26extern /*@falsewhennull@*/ bool constraint_isDefined (constraint p_e) /*@*/ ;
27extern /*@unused@*/ /*@nullwhentrue@*/ bool constraint_isUndefined (constraint p_e) /*@*/ ;
28extern /*@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 34extern void constraint_free (/*@only@*/ constraint p_c);
4cccc6ad 35
b7b694d6 36/* constraint makeConstraintParse (sRef x, lltok relOp, exprNode cconstant); */
4cccc6ad 37
4cccc6ad 38/*@-czechfcns*/
4cccc6ad 39
abd7f895 40extern constraint
41constraint_makeReadSafeExprNode (/*@observer@*/ exprNode p_po,
42 /*@observer@*/ exprNode p_ind);
4cccc6ad 43
abd7f895 44extern /*@only@*/ constraint constraint_makeWriteSafeExprNode (/*@observer@*/ exprNode p_po,
45 /*@observer@*/ exprNode p_ind);
4cccc6ad 46
abd7f895 47extern /*@only@*/ constraint constraint_makeReadSafeInt (/*@observer@*/ exprNode p_t1, int p_index);
4cccc6ad 48
abd7f895 49extern /*@only@*/ constraint
50constraint_makeEnsureMaxReadAtLeast (/*@observer@*/ exprNode p_t1,
51 /*@observer@*/ exprNode p_t2, fileloc p_sequencePoint);
4cccc6ad 52
abd7f895 53extern void constraint_overWrite (constraint p_c1, /*@observer@*/ constraint p_c2)
54 /*@modifies p_c1 @*/;
4cccc6ad 55
abd7f895 56extern /*@only@*/ constraint constraint_copy (/*@temp@*/ constraint p_c);
4cccc6ad 57
abd7f895 58extern bool fileloc_closer (/*@observer@*/ fileloc p_loc1,
59 /*@observer@*/ fileloc p_loc2,
60 /*@observer@*/ fileloc p_loc3) /*@*/;
4cccc6ad 61
28bf4b0b 62extern /*@only@*/ cstring arithType_print (arithType p_ar) /*@*/;
4cccc6ad 63
28bf4b0b 64extern /*@only@*/ fileloc constraint_getFileloc (constraint p_c);
3814599d 65
2a6e9c30 66extern /*@only@*/ cstring constraint_unparse (/*@temp@*/ constraint p_c) /*@*/;
67extern /*@only@*/ cstring constraint_unparseOr (/*@temp@*/ constraint p_c) /*@*/ ;
68extern /*@only@*/ cstring constraint_unparseDetailed (constraint p_c) /*@*/ ;
3814599d 69
2a6e9c30 70extern /*@only@*/ constraint
71constraint_makeWriteSafeInt (/*@dependent@*/ /*@observer@*/ exprNode p_po, int p_ind);
ef2aa32a 72
28bf4b0b 73extern exprNode exprNode_copyConstraints (/*@returned@*/ exprNode p_dst, exprNode p_src) /*@modifies p_dst @*/;
4cccc6ad 74
03d670b6 75extern /*@only@*/ constraint constraint_makeEnsureEqual (/*@dependent@*/ /*@observer@*/ exprNode p_e1, /*@dependent@*/ /*@observer@*/ exprNode p_e2, fileloc p_sequencePoint);
4cccc6ad 76
03d670b6 77extern /*@only@*/ constraint constraint_makeMaxSetSideEffectPostIncrement (/*@dependent@*/ /*@observer@*/ exprNode p_e, fileloc p_sequencePoint);
ef2aa32a 78
28bf4b0b 79extern constraint constraint_preserveOrig (/*@returned@*/ constraint p_c) /*@modifies p_c @*/;
80extern /*@only@*/ constraint constraint_doSRefFixBaseParam (/*@returned@*/ /*@only@*/ constraint p_precondition,
81 exprNodeList p_arglist);
03d670b6 82extern /*@only@*/ constraint constraint_makeEnsureLessThan (/*@dependent@*/ /*@observer@*/ exprNode p_e1, /*@dependent@*/ /*@observer@*/ exprNode p_e2, fileloc p_sequencePoint);
83extern /*@only@*/ constraint constraint_makeEnsureLessThanEqual (/*@dependent@*/ /*@observer@*/ exprNode p_e1, /*@dependent@*/ /*@observer@*/ exprNode p_e2, fileloc p_sequencePoint);
754746a0 84
03d670b6 85extern /*@only@*/ constraint constraint_makeEnsureGreaterThan (/*@dependent@*/ /*@observer@*/ exprNode p_e1, /*@dependent@*/ /*@observer@*/ exprNode p_e2, fileloc p_sequencePoint);
86extern /*@only@*/ constraint constraint_makeEnsureGreaterThanEqual (/*@dependent@*/ /*@observer@*/ exprNode p_e1, /*@dependent@*/ /*@observer@*/ exprNode p_e2, fileloc p_sequencePoint);
34f0c5e7 87
88/*drl add 11/28/2000 */
28bf4b0b 89extern /*@only@*/ constraint constraint_makeSRefWriteSafeInt (sRef p_s, int p_ind);
90extern /*@unused@*/ /*@only@*/ constraint constraint_makeSRefReadSafeInt (sRef p_s, int p_ind);
ef2aa32a 91/*drl add 11/26/2000 */
28bf4b0b 92extern void constraint_printError (/*@observer@*/ /*@temp@*/ constraint p_c, /*@temp@*/ /*@observer@*/ fileloc p_loc);
d46ce6a4 93
28bf4b0b 94extern /*@only@*/ constraint constraint_doSRefFixConstraintParam (constraint p_precondition,
95 /*@temp@*/ /*@observer@*/ exprNodeList p_arglist);
ef2aa32a 96
28bf4b0b 97extern /*@only@*/ constraint constraint_makeSRefSetBufferSize (sRef p_s, long int p_size);
d46ce6a4 98
28bf4b0b 99extern /*@only@*/ constraint constraint_doFixResult (constraint p_postcondition, /*@dependent@*/ /*@observer@*/ exprNode p_fcnCall);
ef2aa32a 100
03d670b6 101extern /*@only@*/ constraint constraint_makeEnsureLteMaxRead(/*@dependent@*/ /*@observer@*/ exprNode p_index, /*@dependent@*/ /*@observer@*/ exprNode p_buffer);
ef2aa32a 102
03d670b6 103extern /*@only@*/ constraint constraint_makeMaxSetSideEffectPostDecrement (/*@dependent@*/ /*@observer@*/ exprNode p_e, fileloc p_sequencePoint);
ef2aa32a 104
28bf4b0b 105extern bool constraint_search (constraint p_c, constraintExpr p_old);
103db890 106
28bf4b0b 107extern /*@only@*/ constraint makeConstraintParse3 (constraintExpr p_l, lltok p_relOp, constraintExpr p_r);
103db890 108
b37cf05e 109extern constraint constraint_addGeneratingExpr (/*@returned@*/ constraint p_c, /*@dependent@*/ /*@exposed@*/ exprNode p_e);
103db890 110
28bf4b0b 111extern bool constraint_hasMaxSet(constraint p_c);
103db890 112
470b7798 113/*from constraintGenreation.c*/
abd7f895 114extern void exprNode_exprTraverse (exprNode p_e, bool p_definatelv, bool p_definaterv, /*@temp@*/ /*@observer@*/ fileloc p_sequencePoint);
2934b455 115
abd7f895 116extern /*@only@*/ constraintList
ae133592 117exprNode_traverseRequiresConstraints (exprNode p_e);
abd7f895 118
119extern /*@only@*/ constraintList
ae133592 120exprNode_traverseEnsuresConstraints (exprNode p_e);
2934b455 121
28bf4b0b 122extern constraint constraint_togglePost (/*@returned@*/ constraint p_c);
123extern bool constraint_same (constraint p_c1, constraint p_c2) ;
2934b455 124extern void constraint_printErrorPostCondition (constraint p_c, fileloc p_loc) ;
e60dcce4 125
126extern cstring constraint_printLocation (/*@observer@*/ /*@temp@*/ constraint p_c) /*@*/; /*drl add 8-11-001*/
127
2934b455 128extern constraint constraint_setFcnPre (/*@returned@*/ constraint p_c) ;
03d670b6 129extern constraint constraint_origAddGeneratingExpr (/*@returned@*/ constraint p_c, /*@dependent@*/ /*@observer@*/ exprNode p_e) ;
470b7798 130
393e573f 131extern bool /*@alt void@*/ exprNode_generateConstraints (/*@temp@*/ exprNode p_e) ;
28bf4b0b 132constraint constraint_togglePostOrig (/*@returned@*/ constraint p_c);
470b7798 133
28bf4b0b 134bool constraint_hasOrig( /*@observer@*/ /*@temp@*/ constraint p_c);
470b7798 135
28bf4b0b 136constraint constraint_makeAddAssign (/*@dependent@*/ /*@observer@*/ exprNode p_e, /*@dependent@*/ /*@observer@*/ exprNode p_f, fileloc p_sequencePoint);
920a3797 137
28bf4b0b 138constraint constraint_makeSubtractAssign (/*@dependent@*/ /*@observer@*/ exprNode p_e, /*@dependent@*/ /*@observer@*/ exprNode p_f, fileloc p_sequencePoint);
920a3797 139
28bf4b0b 140/*@only@*/ constraint constraint_undump (FILE * p_f);
920a3797 141
28bf4b0b 142void constraint_dump (/*@observer@*/ constraint p_c, FILE * p_f);
143
144extern void exprNode_forLoopHeuristics( /*@dependent@*/ exprNode p_e, /*@dependent@*/ exprNode p_forPred, /*@dependent@*/ exprNode p_forBody);
d46ce6a4 145
e60dcce4 146int constraint_compare (/*@observer@*/ /*@temp@*/ const constraint * p_c1, /*@observer@*/ /*@temp@*/ const constraint * p_c2) /*@*/;
02984642 147
84380658 148bool constraint_isPost (/*@observer@*/ /*@temp@*/ constraint p_c);
02984642 149
a779b61e 150bool constraint_tooDeep (/*@observer@*/ /*@temp@*/ constraint p_c);
151
e5f31c00 152void exprNode_findValue( exprNode p_e);
a779b61e 153
86d93ed3 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 ); */
fba0ed37 157
158/*drl added 12/19 */
159bool constraint_isConstantOnly (constraint p_c);
4cccc6ad 160/*@=czechfcns*/
b7b694d6 161/* drl possible problem : warning take this out */
d0e5b01f 162
754746a0 163#include "constraintResolve.h"
dc92450f 164#include "constraintOutput.h"
165
6e88de2d 166#else
167
168#error Multiple include
169
92c4a786 170#endif
d0e5b01f 171
This page took 0.355335 seconds and 5 git commands to generate.