]>
Commit | Line | Data |
---|---|---|
616915dd | 1 | /* |
4ab867d6 | 2 | ** constraint.c |
616915dd | 3 | */ |
4 | ||
5 | //#define DEBUGPRINT 1 | |
6 | ||
7 | # include <ctype.h> /* for isdigit */ | |
8 | # include "lclintMacros.nf" | |
9 | # include "basic.h" | |
10 | # include "cgrammar.h" | |
11 | # include "cgrammar_tokens.h" | |
f0171cff | 12 | |
616915dd | 13 | # include "exprChecks.h" |
616915dd | 14 | # include "exprNodeSList.h" |
616915dd | 15 | |
16 | /*@i33*/ | |
616915dd | 17 | |
c3e695ff | 18 | /*@access exprNode @*/ |
616915dd | 19 | |
d46ce6a4 | 20 | |
28bf4b0b | 21 | static /*@only@*/ cstring constraint_printDetailedPostCondition (/*@observer@*/ /*@temp@*/ constraint p_c); |
2934b455 | 22 | |
23 | ||
ccf0a4a8 | 24 | static /*@notnull@*/ /*@special@*/ constraint constraint_makeNew (void) |
25 | /*@post:isnull result->or, result->orig, result->generatingExpr, result->fcnPre @*/ | |
26 | /*@defines result->or, result->generatingExpr, result->orig, result->fcnPre @*/; | |
4ab867d6 | 27 | |
d46ce6a4 | 28 | /* constraint makeConstraintParse (sRef x, lltok relOp, exprNode cconstant) */ |
616915dd | 29 | |
d46ce6a4 | 30 | /* { */ |
31 | /* char *t; */ | |
32 | /* int c; */ | |
33 | /* constraint ret; */ | |
34 | /* ret = constraint_makeNew(); */ | |
35 | /* llassert (sRef_isValid(x) ); */ | |
36 | /* if (!sRef_isValid(x)) */ | |
37 | /* return ret; */ | |
616915dd | 38 | |
39 | ||
d46ce6a4 | 40 | /* ret->lexpr = constraintExpr_makeTermsRef (x); */ |
41 | /* #warning fix abstraction */ | |
616915dd | 42 | |
d46ce6a4 | 43 | /* if (relOp.tok == GE_OP) */ |
44 | /* ret->ar = GTE; */ | |
45 | /* else if (relOp.tok == LE_OP) */ | |
46 | /* ret->ar = LTE; */ | |
47 | /* else if (relOp.tok == EQ_OP) */ | |
48 | /* ret->ar = EQ; */ | |
49 | /* else */ | |
50 | /* llfatalbug(message ("Unsupported relational operator") ); */ | |
616915dd | 51 | |
52 | ||
d46ce6a4 | 53 | /* t = cstring_toCharsSafe (exprNode_unparse(cconstant)); */ |
54 | /* c = atoi( t ); */ | |
55 | /* ret->expr = constraintExpr_makeIntLiteral (c); */ | |
616915dd | 56 | |
d46ce6a4 | 57 | /* ret->post = TRUE; */ |
58 | /* // ret->orig = ret; */ | |
59 | /* DPRINTF(("GENERATED CONSTRAINT:")); */ | |
60 | /* DPRINTF( (message ("%s", constraint_print(ret) ) ) ); */ | |
61 | /* return ret; */ | |
62 | /* } */ | |
616915dd | 63 | |
920a3797 | 64 | |
65 | static void | |
66 | advanceField (char **s) | |
67 | { | |
28bf4b0b | 68 | reader_checkChar (s, '@'); |
920a3797 | 69 | } |
70 | ||
71 | ||
72 | ||
28bf4b0b | 73 | static constraint makeConstraintParse2 (constraintExpr l, lltok relOp, exprNode cconstant) |
616915dd | 74 | { |
75 | char *t; | |
76 | int c; | |
77 | constraint ret; | |
ccf0a4a8 | 78 | ret = constraint_makeNew (); |
28bf4b0b | 79 | llassert (constraintExpr_isDefined(l) ); |
d46ce6a4 | 80 | |
616915dd | 81 | ret->lexpr = constraintExpr_copy (l); |
2934b455 | 82 | |
616915dd | 83 | |
84 | if (relOp.tok == GE_OP) | |
85 | ret->ar = GTE; | |
86 | else if (relOp.tok == LE_OP) | |
87 | ret->ar = LTE; | |
88 | else if (relOp.tok == EQ_OP) | |
89 | ret->ar = EQ; | |
90 | else | |
dc92450f | 91 | llfatalbug(message("Unsupported relational operator") ); |
616915dd | 92 | |
93 | ||
94 | t = cstring_toCharsSafe (exprNode_unparse(cconstant)); | |
95 | c = atoi( t ); | |
96 | ret->expr = constraintExpr_makeIntLiteral (c); | |
97 | ||
98 | ret->post = TRUE; | |
99 | // ret->orig = ret; | |
100 | DPRINTF(("GENERATED CONSTRAINT:")); | |
101 | DPRINTF( (message ("%s", constraint_print(ret) ) ) ); | |
102 | return ret; | |
103 | } | |
104 | ||
c3e695ff | 105 | bool constraint_same (constraint c1, constraint c2) |
90bc41f7 | 106 | { |
107 | ||
108 | if (c1->ar != c2->ar) | |
109 | return FALSE; | |
110 | ||
111 | if (!constraintExpr_similar (c1->lexpr, c2->lexpr) ) | |
112 | return FALSE; | |
113 | ||
114 | if (!constraintExpr_similar (c1->expr, c2->expr) ) | |
115 | return FALSE; | |
116 | ||
117 | return TRUE; | |
118 | } | |
616915dd | 119 | |
120 | constraint makeConstraintParse3 (constraintExpr l, lltok relOp, constraintExpr r) | |
121 | { | |
122 | constraint ret; | |
123 | ret = constraint_makeNew(); | |
28bf4b0b | 124 | llassert (constraintExpr_isDefined(l) ); |
616915dd | 125 | |
126 | ret->lexpr = constraintExpr_copy (l); | |
616915dd | 127 | |
128 | if (relOp.tok == GE_OP) | |
129 | ret->ar = GTE; | |
130 | else if (relOp.tok == LE_OP) | |
131 | ret->ar = LTE; | |
132 | else if (relOp.tok == EQ_OP) | |
133 | ret->ar = EQ; | |
134 | else | |
dc92450f | 135 | llfatalbug( message("Unsupported relational operator") ); |
616915dd | 136 | |
137 | ret->expr = constraintExpr_copy (r); | |
138 | ||
139 | ret->post = TRUE; | |
90bc41f7 | 140 | |
141 | ret->orig = constraint_copy(ret); | |
142 | ||
143 | ret = constraint_simplify (ret); | |
144 | ||
616915dd | 145 | // ret->orig = ret; |
146 | DPRINTF(("GENERATED CONSTRAINT:")); | |
147 | DPRINTF( (message ("%s", constraint_print(ret) ) ) ); | |
148 | return ret; | |
149 | } | |
150 | ||
28bf4b0b | 151 | constraint constraint_copy (/*@temp@*/ /*@observer@*/ constraint c) |
616915dd | 152 | { |
153 | constraint ret; | |
90bc41f7 | 154 | |
c3e695ff | 155 | llassert (constraint_isDefined(c) ); |
28bf4b0b | 156 | // DPRINTF((message("Copying constraint %q", constraint_print) )); |
90bc41f7 | 157 | |
616915dd | 158 | ret = constraint_makeNew(); |
159 | ret->lexpr = constraintExpr_copy (c->lexpr); | |
160 | ret->ar = c->ar; | |
161 | ret->expr = constraintExpr_copy (c->expr); | |
162 | ret->post = c->post; | |
795e7f34 | 163 | /*@-assignexpose@*/ |
28bf4b0b | 164 | ret->generatingExpr = c->generatingExpr; |
795e7f34 | 165 | /*@=assignexpose@*/ |
9280addf | 166 | |
616915dd | 167 | /*@i33 fix this*/ |
168 | if (c->orig != NULL) | |
169 | ret->orig = constraint_copy (c->orig); | |
170 | else | |
171 | ret->orig = NULL; | |
90bc41f7 | 172 | |
173 | if (c->or != NULL) | |
174 | ret->or = constraint_copy (c->or); | |
175 | else | |
176 | ret->or = NULL; | |
4ab867d6 | 177 | |
178 | ret->fcnPre = c->fcnPre; | |
90bc41f7 | 179 | |
616915dd | 180 | return ret; |
181 | } | |
182 | ||
183 | /*like copy expect it doesn't allocate memory for the constraint*/ | |
184 | ||
d46ce6a4 | 185 | void constraint_overWrite (constraint c1, constraint c2) |
616915dd | 186 | { |
d46ce6a4 | 187 | llassert (constraint_isDefined(c1) ); |
188 | ||
189 | llassert (c1 != c2); | |
190 | ||
191 | DPRINTF((message("OverWriteing constraint %q with %q", constraint_print(c1), | |
192 | constraint_print(c2) ) )); | |
193 | ||
194 | constraintExpr_free(c1->lexpr); | |
195 | constraintExpr_free(c1->expr); | |
196 | ||
616915dd | 197 | c1->lexpr = constraintExpr_copy (c2->lexpr); |
198 | c1->ar = c2->ar; | |
199 | c1->expr = constraintExpr_copy (c2->expr); | |
200 | c1->post = c2->post; | |
d46ce6a4 | 201 | |
202 | if (c1->orig != NULL) | |
203 | constraint_free (c1->orig); | |
204 | ||
616915dd | 205 | if (c2->orig != NULL) |
206 | c1->orig = constraint_copy (c2->orig); | |
207 | else | |
208 | c1->orig = NULL; | |
90bc41f7 | 209 | |
d46ce6a4 | 210 | /*@i33 make sure that the or is freed correctly*/ |
211 | if (c1->or != NULL) | |
212 | constraint_free (c1->or); | |
213 | ||
90bc41f7 | 214 | if (c2->or != NULL) |
215 | c1->or = constraint_copy (c2->or); | |
216 | else | |
217 | c1->or = NULL; | |
4ab867d6 | 218 | |
219 | c1->fcnPre = c2->fcnPre; | |
795e7f34 | 220 | |
221 | /*@-assignexpose@*/ | |
4ab867d6 | 222 | c1->generatingExpr = c2->generatingExpr; |
795e7f34 | 223 | /*@=assignexpose@*/ |
616915dd | 224 | } |
225 | ||
616915dd | 226 | |
227 | ||
d46ce6a4 | 228 | static /*@notnull@*/ /*@special@*/ constraint constraint_makeNew (void) |
ccf0a4a8 | 229 | /*@post:isnull result->or, result->orig, result->generatingExpr, result->fcnPre @*/ |
230 | /*@defines result->or, result->generatingExpr, result->orig, result->fcnPre @*/ | |
616915dd | 231 | { |
232 | constraint ret; | |
233 | ret = dmalloc(sizeof (*ret) ); | |
234 | ret->lexpr = NULL; | |
235 | ret->expr = NULL; | |
236 | ret->ar = LT; | |
237 | ret->post = FALSE; | |
238 | ret->orig = NULL; | |
90bc41f7 | 239 | ret->or = NULL; |
9280addf | 240 | ret->generatingExpr = NULL; |
4ab867d6 | 241 | ret->fcnPre = NULL; |
dc92450f | 242 | return ret; |
616915dd | 243 | } |
244 | ||
b37cf05e | 245 | constraint constraint_addGeneratingExpr (/*@returned@*/ constraint c, /*@exposed@*/ exprNode e) |
9280addf | 246 | { |
247 | ||
248 | if (c->generatingExpr == NULL) | |
249 | { | |
28bf4b0b | 250 | c->generatingExpr = e; |
9280addf | 251 | DPRINTF ((message ("setting generatingExpr for %s to %s", constraint_print(c), exprNode_unparse(e) ) )); |
252 | } | |
253 | else | |
254 | { | |
255 | DPRINTF ((message ("Not setting generatingExpr for %s to %s", constraint_print(c), exprNode_unparse(e) ) )); | |
256 | } | |
257 | return c; | |
258 | } | |
259 | ||
4ab867d6 | 260 | constraint constraint_origAddGeneratingExpr (/*@returned@*/ constraint c, exprNode e) |
261 | { | |
262 | ||
263 | if (c->orig != constraint_undefined) | |
264 | { | |
265 | c->orig = constraint_addGeneratingExpr(c->orig, e); | |
266 | } | |
267 | else | |
268 | { | |
269 | DPRINTF ((message ("constraint_origAddGeneratingExpr: Not setting generatingExpr for %s to %s", constraint_print(c), exprNode_unparse(e) ) )); | |
270 | } | |
271 | return c; | |
272 | } | |
273 | ||
4ab867d6 | 274 | constraint constraint_setFcnPre (/*@returned@*/ constraint c ) |
275 | { | |
276 | ||
277 | if (c->orig != constraint_undefined) | |
278 | { | |
279 | c->orig->fcnPre = TRUE; | |
280 | } | |
281 | else | |
282 | { | |
283 | c->fcnPre = TRUE; | |
28bf4b0b | 284 | // DPRINTF(( message("Warning Setting fcnPre directly") )); |
4ab867d6 | 285 | } |
286 | return c; | |
287 | } | |
288 | ||
289 | ||
290 | ||
291 | ||
616915dd | 292 | fileloc constraint_getFileloc (constraint c) |
293 | { | |
c3e695ff | 294 | if (exprNode_isDefined(c->generatingExpr) ) |
d46ce6a4 | 295 | return (fileloc_copy (exprNode_getfileloc (c->generatingExpr) ) ); |
9280addf | 296 | |
616915dd | 297 | return (constraintExpr_getFileloc (c->lexpr) ); |
298 | ||
299 | ||
300 | } | |
301 | ||
9280addf | 302 | static bool checkForMaxSet (constraint c) |
303 | { | |
304 | if (constraintExpr_hasMaxSet(c->lexpr) || constraintExpr_hasMaxSet(c->expr) ) | |
305 | return TRUE; | |
306 | ||
307 | return FALSE; | |
308 | } | |
309 | ||
310 | bool constraint_hasMaxSet(constraint c) | |
311 | { | |
03d670b6 | 312 | if (checkForMaxSet(c) ) |
313 | return TRUE; | |
314 | ||
dc92450f | 315 | if (c->orig != NULL) |
9280addf | 316 | { |
317 | if (checkForMaxSet(c->orig) ) | |
318 | return TRUE; | |
319 | } | |
320 | ||
03d670b6 | 321 | return FALSE; |
9280addf | 322 | } |
323 | ||
28bf4b0b | 324 | constraint constraint_makeReadSafeExprNode ( exprNode po, exprNode ind) |
616915dd | 325 | { |
326 | constraint ret = constraint_makeNew(); | |
327 | // constraintTerm term; | |
28bf4b0b | 328 | po = po; |
329 | ind = ind; | |
616915dd | 330 | ret->lexpr = constraintExpr_makeMaxReadExpr(po); |
331 | ret->ar = GTE; | |
332 | ret->expr = constraintExpr_makeValueExpr (ind); | |
d46ce6a4 | 333 | ret->post = FALSE; |
616915dd | 334 | return ret; |
335 | } | |
336 | ||
28bf4b0b | 337 | constraint constraint_makeWriteSafeInt ( exprNode po, int ind) |
616915dd | 338 | { |
339 | constraint ret = constraint_makeNew(); | |
340 | ||
341 | ||
342 | ret->lexpr =constraintExpr_makeMaxSetExpr(po); | |
343 | ret->ar = GTE; | |
c3e695ff | 344 | ret->expr = constraintExpr_makeIntLiteral (ind); |
616915dd | 345 | /*@i1*/return ret; |
346 | } | |
347 | ||
84c9ffbf | 348 | constraint constraint_makeSRefSetBufferSize (sRef s, long int size) |
616915dd | 349 | { |
350 | constraint ret = constraint_makeNew(); | |
4ab867d6 | 351 | ret->lexpr = constraintExpr_makeSRefMaxset (s); |
616915dd | 352 | ret->ar = EQ; |
84c9ffbf | 353 | ret->expr = constraintExpr_makeIntLiteral ((int)size); |
616915dd | 354 | ret->post = TRUE; |
355 | /*@i1*/return ret; | |
356 | } | |
357 | ||
358 | constraint constraint_makeSRefWriteSafeInt (sRef s, int ind) | |
359 | { | |
360 | constraint ret = constraint_makeNew(); | |
361 | ||
362 | ||
4ab867d6 | 363 | ret->lexpr = constraintExpr_makeSRefMaxset ( s ); |
616915dd | 364 | ret->ar = GTE; |
c3e695ff | 365 | ret->expr = constraintExpr_makeIntLiteral (ind); |
616915dd | 366 | ret->post = TRUE; |
367 | /*@i1*/return ret; | |
368 | } | |
369 | ||
370 | /* drl added 01/12/2000 | |
371 | ||
372 | makes the constraint: Ensures index <= MaxRead(buffer) */ | |
373 | ||
374 | constraint constraint_makeEnsureLteMaxRead(exprNode index, exprNode buffer) | |
375 | { | |
376 | constraint ret = constraint_makeNew(); | |
377 | ||
378 | ret->lexpr = constraintExpr_makeValueExpr (index); | |
379 | ret->ar = LTE; | |
380 | ret->expr = constraintExpr_makeMaxReadExpr(buffer); | |
381 | ret->post = TRUE; | |
382 | return ret; | |
383 | } | |
384 | ||
385 | constraint constraint_makeWriteSafeExprNode (exprNode po, exprNode ind) | |
386 | { | |
387 | constraint ret = constraint_makeNew(); | |
388 | ||
389 | ||
390 | ret->lexpr =constraintExpr_makeMaxSetExpr(po); | |
391 | ret->ar = GTE; | |
392 | ret->expr = constraintExpr_makeValueExpr (ind); | |
393 | /*@i1*/return ret; | |
394 | } | |
395 | ||
396 | ||
28bf4b0b | 397 | constraint constraint_makeReadSafeInt ( exprNode t1, int index) |
616915dd | 398 | { |
399 | constraint ret = constraint_makeNew(); | |
400 | ||
28bf4b0b | 401 | ret->lexpr = constraintExpr_makeMaxReadExpr(t1); |
616915dd | 402 | ret->ar = GTE; |
28bf4b0b | 403 | ret->expr = constraintExpr_makeIntLiteral (index); |
d46ce6a4 | 404 | ret->post = FALSE; |
616915dd | 405 | return ret; |
406 | } | |
407 | ||
470b7798 | 408 | constraint constraint_makeSRefReadSafeInt (sRef s, int ind) |
409 | { | |
410 | constraint ret = constraint_makeNew(); | |
411 | ||
412 | ||
4ab867d6 | 413 | ret->lexpr = constraintExpr_makeSRefMaxRead (s ); |
470b7798 | 414 | ret->ar = GTE; |
c3e695ff | 415 | ret->expr = constraintExpr_makeIntLiteral (ind); |
470b7798 | 416 | ret->post = TRUE; |
417 | /*@i1*/return ret; | |
418 | } | |
419 | ||
28bf4b0b | 420 | constraint constraint_makeEnsureMaxReadAtLeast (exprNode t1, exprNode t2, fileloc sequencePoint) |
616915dd | 421 | { |
d46ce6a4 | 422 | constraint ret; |
616915dd | 423 | |
28bf4b0b | 424 | ret = constraint_makeReadSafeExprNode(t1, t2); |
616915dd | 425 | |
426 | ret->lexpr = constraintExpr_setFileloc (ret->lexpr, sequencePoint); | |
427 | ||
428 | ret->post = TRUE; | |
429 | ||
430 | // fileloc_incColumn (ret->lexpr->term->loc); | |
431 | return ret; | |
432 | } | |
433 | ||
d46ce6a4 | 434 | static constraint constraint_makeEnsuresOpConstraintExpr (/*@only@*/ constraintExpr c1, /*@only@*/ constraintExpr c2, fileloc sequencePoint, arithType ar) |
470b7798 | 435 | { |
436 | ||
437 | constraint ret; | |
438 | ||
28bf4b0b | 439 | llassert(constraintExpr_isDefined(c1) && constraintExpr_isDefined(c2) ); |
470b7798 | 440 | // llassert(sequencePoint); |
441 | ||
442 | ret = constraint_makeNew(); | |
443 | ||
444 | ret->lexpr = c1; | |
445 | ret->ar = ar; | |
446 | ret->post = TRUE; | |
447 | ret->expr = c2; | |
448 | ret->lexpr = constraintExpr_setFileloc (ret->lexpr, sequencePoint); | |
449 | return ret; | |
450 | } | |
616915dd | 451 | |
28bf4b0b | 452 | static constraint constraint_makeEnsuresOp (/*@dependent@*/ exprNode e1, /*@dependent@*/ exprNode e2, fileloc sequencePoint, arithType ar) |
616915dd | 453 | { |
470b7798 | 454 | constraintExpr c1, c2; |
455 | constraint ret; | |
616915dd | 456 | exprNode e; |
470b7798 | 457 | |
28bf4b0b | 458 | if (! (exprNode_isDefined(e1) && exprNode_isDefined(e2) ) ) |
616915dd | 459 | { |
460 | llcontbug((message("null exprNode, Exprnodes are %s and %s", | |
461 | exprNode_unparse(e1), exprNode_unparse(e2) ) | |
462 | )); | |
463 | } | |
470b7798 | 464 | |
465 | // llassert (sequencePoint); | |
466 | ||
28bf4b0b | 467 | e = e1; |
470b7798 | 468 | c1 = constraintExpr_makeValueExpr (e); |
469 | ||
28bf4b0b | 470 | e = e2; |
470b7798 | 471 | c2 = constraintExpr_makeValueExpr (e); |
472 | ||
473 | ret = constraint_makeEnsuresOpConstraintExpr (c1, c2, sequencePoint, ar); | |
616915dd | 474 | |
616915dd | 475 | return ret; |
476 | } | |
477 | ||
478 | ||
479 | /* make constraint ensures e1 == e2 */ | |
480 | ||
481 | constraint constraint_makeEnsureEqual (exprNode e1, exprNode e2, fileloc sequencePoint) | |
482 | { | |
483 | return ( constraint_makeEnsuresOp (e1, e2, sequencePoint, EQ) ); | |
484 | } | |
485 | ||
486 | /*make constraint ensures e1 < e2 */ | |
487 | constraint constraint_makeEnsureLessThan (exprNode e1, exprNode e2, fileloc sequencePoint) | |
488 | { | |
470b7798 | 489 | constraintExpr t1, t2; |
490 | ||
491 | t1 = constraintExpr_makeValueExpr (e1); | |
492 | t2 = constraintExpr_makeValueExpr (e2); | |
493 | ||
494 | /*change this to e1 <= (e2 -1) */ | |
495 | ||
496 | t2 = constraintExpr_makeDecConstraintExpr (t2); | |
497 | ||
498 | return ( constraint_makeEnsuresOpConstraintExpr (t1, t2, sequencePoint, LTE) ); | |
616915dd | 499 | } |
500 | ||
501 | constraint constraint_makeEnsureLessThanEqual (exprNode e1, exprNode e2, fileloc sequencePoint) | |
502 | { | |
503 | return ( constraint_makeEnsuresOp (e1, e2, sequencePoint, LTE) ); | |
504 | } | |
505 | ||
506 | constraint constraint_makeEnsureGreaterThan (exprNode e1, exprNode e2, fileloc sequencePoint) | |
507 | { | |
470b7798 | 508 | constraintExpr t1, t2; |
509 | ||
510 | t1 = constraintExpr_makeValueExpr (e1); | |
511 | t2 = constraintExpr_makeValueExpr (e2); | |
512 | ||
513 | ||
514 | /* change this to e1 >= (e2 + 1) */ | |
515 | t2 = constraintExpr_makeIncConstraintExpr (t2); | |
516 | ||
517 | ||
518 | return ( constraint_makeEnsuresOpConstraintExpr (t1, t2, sequencePoint, GTE) ); | |
616915dd | 519 | } |
520 | ||
521 | constraint constraint_makeEnsureGreaterThanEqual (exprNode e1, exprNode e2, fileloc sequencePoint) | |
522 | { | |
523 | return ( constraint_makeEnsuresOp (e1, e2, sequencePoint, GTE) ); | |
524 | } | |
525 | ||
526 | ||
527 | exprNode exprNode_copyConstraints (/*@returned@*/ exprNode dst, exprNode src) | |
528 | { | |
d46ce6a4 | 529 | constraintList_free(dst->ensuresConstraints); |
530 | constraintList_free(dst->requiresConstraints); | |
531 | constraintList_free(dst->trueEnsuresConstraints); | |
532 | constraintList_free(dst->falseEnsuresConstraints); | |
533 | ||
616915dd | 534 | dst->ensuresConstraints = constraintList_copy (src->ensuresConstraints ); |
535 | dst->requiresConstraints = constraintList_copy (src->requiresConstraints ); | |
536 | dst->trueEnsuresConstraints = constraintList_copy (src->trueEnsuresConstraints ); | |
537 | dst->falseEnsuresConstraints = constraintList_copy (src->falseEnsuresConstraints ); | |
538 | return dst; | |
539 | } | |
540 | ||
2934b455 | 541 | /* Makes the constraint e = e + f */ |
542 | constraint constraint_makeAddAssign (exprNode e, exprNode f, fileloc sequencePoint) | |
543 | { | |
544 | constraintExpr x1, x2, y; | |
545 | constraint ret; | |
546 | ||
547 | ret = constraint_makeNew(); | |
548 | ||
549 | x1 = constraintExpr_makeValueExpr (e); | |
550 | x2 = constraintExpr_copy(x1); | |
551 | y = constraintExpr_makeValueExpr (f); | |
552 | ||
553 | ret->lexpr = x1; | |
554 | ret->ar = EQ; | |
555 | ret->post = TRUE; | |
556 | ret->expr = constraintExpr_makeAddExpr (x2, y); | |
557 | ||
558 | ret->lexpr = constraintExpr_setFileloc (ret->lexpr, sequencePoint); | |
559 | ||
560 | return ret; | |
561 | } | |
562 | ||
563 | ||
564 | /* Makes the constraint e = e - f */ | |
565 | constraint constraint_makeSubtractAssign (exprNode e, exprNode f, fileloc sequencePoint) | |
566 | { | |
567 | constraintExpr x1, x2, y; | |
568 | constraint ret; | |
569 | ||
570 | ret = constraint_makeNew(); | |
571 | ||
572 | x1 = constraintExpr_makeValueExpr (e); | |
573 | x2 = constraintExpr_copy(x1); | |
574 | y = constraintExpr_makeValueExpr (f); | |
575 | ||
576 | ret->lexpr = x1; | |
577 | ret->ar = EQ; | |
578 | ret->post = TRUE; | |
579 | ret->expr = constraintExpr_makeSubtractExpr (x2, y); | |
580 | ||
581 | ret->lexpr = constraintExpr_setFileloc (ret->lexpr, sequencePoint); | |
582 | ||
583 | return ret; | |
584 | } | |
585 | ||
616915dd | 586 | constraint constraint_makeMaxSetSideEffectPostDecrement (exprNode e, fileloc sequencePoint) |
587 | { | |
588 | constraint ret = constraint_makeNew(); | |
589 | //constraintTerm term; | |
590 | ||
28bf4b0b | 591 | // e = exprNode_fakeCopy(e); |
616915dd | 592 | ret->lexpr = constraintExpr_makeValueExpr (e); |
593 | ret->ar = EQ; | |
594 | ret->post = TRUE; | |
595 | ret->expr = constraintExpr_makeValueExpr (e); | |
596 | ret->expr = constraintExpr_makeDecConstraintExpr (ret->expr); | |
597 | ||
598 | ret->lexpr = constraintExpr_setFileloc (ret->lexpr, sequencePoint); | |
599 | // fileloc_incColumn ( ret->lexpr->term->loc); | |
600 | // fileloc_incColumn ( ret->lexpr->term->loc); | |
601 | return ret; | |
602 | } | |
603 | constraint constraint_makeMaxSetSideEffectPostIncrement (exprNode e, fileloc sequencePoint) | |
604 | { | |
605 | constraint ret = constraint_makeNew(); | |
606 | //constraintTerm term; | |
607 | ||
28bf4b0b | 608 | // e = exprNode_fakeCopy(e); |
616915dd | 609 | ret->lexpr = constraintExpr_makeValueExpr (e); |
610 | ret->ar = EQ; | |
611 | ret->post = TRUE; | |
612 | ret->expr = constraintExpr_makeValueExpr (e); | |
613 | ret->expr = constraintExpr_makeIncConstraintExpr (ret->expr); | |
614 | ||
615 | ret->lexpr = constraintExpr_setFileloc (ret->lexpr, sequencePoint); | |
616 | // fileloc_incColumn ( ret->lexpr->term->loc); | |
617 | // fileloc_incColumn ( ret->lexpr->term->loc); | |
618 | return ret; | |
619 | } | |
620 | ||
621 | ||
920a3797 | 622 | void constraint_free (/*@only@*/ constraint c) |
d46ce6a4 | 623 | { |
624 | llassert(constraint_isDefined (c) ); | |
625 | ||
626 | ||
627 | if (constraint_isDefined(c->orig) ) | |
628 | constraint_free (c->orig); | |
629 | if ( constraint_isDefined(c->or) ) | |
630 | constraint_free (c->or); | |
631 | ||
bb25bea6 | 632 | |
d46ce6a4 | 633 | constraintExpr_free(c->lexpr); |
634 | constraintExpr_free(c->expr); | |
bb25bea6 | 635 | |
636 | c->orig = NULL; | |
637 | c->or = NULL; | |
638 | c->lexpr = NULL; | |
639 | c->expr = NULL; | |
640 | ||
d46ce6a4 | 641 | free (c); |
642 | ||
643 | } | |
644 | ||
616915dd | 645 | |
646 | // constraint constraint_makeMaxReadSideEffectPostIncrement (exprNode e, fileloc sequencePoint) | |
647 | // { | |
648 | // constraint ret = constraint_makeNew(); | |
649 | // //constraintTerm term; | |
650 | ||
651 | // e = exprNode_fakeCopy(e); | |
652 | // ret->lexpr = constraintExpr_makeMaxReadExpr(e); | |
653 | // ret->ar = EQ; | |
654 | // ret->post = TRUE; | |
655 | // ret->expr = constraintExpr_makeIncConstraintExpr (e); | |
656 | // ret->lexpr = constraintExpr_setFileLoc (ret->lexpr, sequencePoint); | |
657 | // return ret; | |
658 | // } | |
659 | ||
660 | ||
dc92450f | 661 | cstring arithType_print (arithType ar) /*@*/ |
616915dd | 662 | { |
663 | cstring st = cstring_undefined; | |
664 | switch (ar) | |
665 | { | |
666 | case LT: | |
667 | st = cstring_makeLiteral (" < "); | |
668 | break; | |
669 | case LTE: | |
670 | st = cstring_makeLiteral (" <= "); | |
671 | break; | |
672 | case GT: | |
673 | st = cstring_makeLiteral (" > "); | |
674 | break; | |
675 | case GTE: | |
676 | st = cstring_makeLiteral (" >= "); | |
677 | break; | |
678 | case EQ: | |
679 | st = cstring_makeLiteral (" == "); | |
680 | break; | |
681 | case NONNEGATIVE: | |
682 | st = cstring_makeLiteral (" NONNEGATIVE "); | |
683 | break; | |
684 | case POSITIVE: | |
685 | st = cstring_makeLiteral (" POSITIVE "); | |
686 | break; | |
687 | default: | |
688 | llassert(FALSE); | |
689 | break; | |
690 | } | |
691 | return st; | |
692 | } | |
693 | ||
8f299805 | 694 | void constraint_printErrorPostCondition (constraint c, fileloc loc) |
695 | { | |
696 | cstring string; | |
697 | fileloc errorLoc, temp; | |
698 | ||
699 | string = constraint_printDetailedPostCondition (c); | |
700 | ||
701 | errorLoc = loc; | |
702 | ||
703 | loc = NULL; | |
704 | ||
705 | temp = constraint_getFileloc(c); | |
706 | ||
707 | if (fileloc_isDefined(temp) ) | |
708 | { | |
709 | errorLoc = temp; | |
710 | voptgenerror ( FLG_CHECKPOST, string, errorLoc); | |
711 | fileloc_free(temp); | |
712 | } | |
713 | else | |
714 | { | |
715 | voptgenerror ( FLG_CHECKPOST, string, errorLoc); | |
716 | } | |
717 | } | |
718 | ||
719 | ||
720 | ||
721 | ||
616915dd | 722 | void constraint_printError (constraint c, fileloc loc) |
723 | { | |
724 | cstring string; | |
4ab867d6 | 725 | fileloc errorLoc, temp; |
9280addf | 726 | |
616915dd | 727 | string = constraint_printDetailed (c); |
9280addf | 728 | |
729 | errorLoc = loc; | |
730 | ||
4ab867d6 | 731 | loc = NULL; |
732 | ||
733 | temp = constraint_getFileloc(c); | |
734 | ||
735 | if (fileloc_isDefined(temp) ) | |
616915dd | 736 | { |
4ab867d6 | 737 | errorLoc = temp; |
738 | ||
739 | if (c->post) | |
740 | { | |
741 | voptgenerror (FLG_FUNCTIONPOST, string, errorLoc); | |
742 | } | |
743 | else | |
744 | { | |
03d670b6 | 745 | if (constraint_hasMaxSet (c) ) |
746 | voptgenerror (FLG_ARRAYBOUNDS, string, errorLoc); | |
747 | else | |
748 | voptgenerror (FLG_ARRAYBOUNDSREAD, string, errorLoc); | |
4ab867d6 | 749 | } |
750 | fileloc_free(temp); | |
28bf4b0b | 751 | errorLoc = NULL; |
616915dd | 752 | } |
753 | else | |
754 | { | |
4ab867d6 | 755 | if (c->post) |
756 | { | |
757 | voptgenerror (FLG_FUNCTIONPOST, string, errorLoc); | |
758 | } | |
759 | else | |
760 | { | |
761 | voptgenerror (FLG_FUNCTIONCONSTRAINT, string, errorLoc); | |
762 | } | |
28bf4b0b | 763 | errorLoc = NULL; |
616915dd | 764 | } |
616915dd | 765 | } |
766 | ||
4ab867d6 | 767 | |
28bf4b0b | 768 | static cstring constraint_printDeep (constraint c) |
616915dd | 769 | { |
28bf4b0b | 770 | cstring genExpr; |
616915dd | 771 | cstring st = cstring_undefined; |
772 | ||
4ab867d6 | 773 | st = constraint_print(c); |
774 | ||
28bf4b0b | 775 | |
4ab867d6 | 776 | if (c->orig != constraint_undefined) |
777 | { | |
03d670b6 | 778 | st = cstring_appendChar(st, '\n'); |
28bf4b0b | 779 | genExpr = exprNode_unparse(c->orig->generatingExpr); |
4ab867d6 | 780 | if (!c->post) |
781 | { | |
782 | if (c->orig->fcnPre) | |
28bf4b0b | 783 | st = cstring_concatFree(st, (message(" derived from %s precondition: %q", genExpr, constraint_printDeep(c->orig) ) |
4ab867d6 | 784 | ) ); |
785 | else | |
03d670b6 | 786 | st = cstring_concatFree(st,(message(" needed to satisfy precondition:\n%q", |
4ab867d6 | 787 | constraint_printDeep(c->orig) ) |
788 | ) ); | |
789 | ||
790 | } | |
791 | else | |
792 | { | |
793 | st = cstring_concatFree(st,(message("derived from: %q", | |
794 | constraint_printDeep(c->orig) ) | |
795 | ) ); | |
796 | } | |
797 | } | |
798 | ||
799 | return st; | |
800 | ||
801 | } | |
802 | ||
2934b455 | 803 | |
804 | static /*@only@*/ cstring constraint_printDetailedPostCondition (/*@observer@*/ /*@temp@*/ constraint c) | |
8f299805 | 805 | { |
806 | cstring st = cstring_undefined; | |
28bf4b0b | 807 | cstring genExpr; |
808 | ||
8f299805 | 809 | st = message ("Unsatisfied ensures constraint condition:\nLCLint is unable to verify the constraint %q", constraint_printDeep (c) ); |
28bf4b0b | 810 | |
811 | genExpr = exprNode_unparse (c->generatingExpr); | |
812 | ||
8f299805 | 813 | if (context_getFlag (FLG_CONSTRAINTLOCATION) ) |
814 | { | |
815 | cstring temp; | |
816 | // llassert (c->generatingExpr); | |
817 | temp = message ("\nOriginal Generating expression %q: %s\n", fileloc_unparse( exprNode_getfileloc (c->generatingExpr) ), | |
28bf4b0b | 818 | genExpr ); |
8f299805 | 819 | st = cstring_concatFree (st, temp); |
820 | ||
821 | if (constraint_hasMaxSet(c) ) | |
822 | { | |
823 | temp = message ("Has MaxSet\n"); | |
824 | st = cstring_concatFree (st, temp); | |
825 | } | |
826 | } | |
827 | return st; | |
828 | } | |
829 | ||
4ab867d6 | 830 | cstring constraint_printDetailed (constraint c) |
831 | { | |
832 | cstring st = cstring_undefined; | |
03d670b6 | 833 | cstring temp = cstring_undefined; |
834 | cstring genExpr; | |
28bf4b0b | 835 | |
616915dd | 836 | if (!c->post) |
837 | { | |
03d670b6 | 838 | st = message ("Unable to resolve constraint:\n%q", constraint_printDeep (c) ); |
616915dd | 839 | } |
840 | else | |
841 | { | |
4ab867d6 | 842 | st = message ("Block Post condition:\nThis function block has the post condition %q", constraint_printDeep (c) ); |
616915dd | 843 | } |
9280addf | 844 | |
03d670b6 | 845 | if (constraint_hasMaxSet(c) ) |
846 | { | |
847 | temp = cstring_makeLiteral("Possible out-of-bounds store. "); | |
848 | } | |
849 | else | |
850 | { | |
851 | temp = cstring_makeLiteral("Possible out-of-bounds read. "); | |
852 | } | |
853 | ||
854 | st = cstring_concatFree(temp,st); | |
855 | ||
28bf4b0b | 856 | genExpr = exprNode_unparse (c->generatingExpr); |
857 | ||
9280addf | 858 | if (context_getFlag (FLG_CONSTRAINTLOCATION) ) |
859 | { | |
03d670b6 | 860 | temp = message ("\nConstraint generated from expression: %s at %q\n", |
861 | genExpr, | |
862 | fileloc_unparse( exprNode_getfileloc (c->generatingExpr) ) | |
863 | ); | |
d46ce6a4 | 864 | st = cstring_concatFree (st, temp); |
9280addf | 865 | } |
616915dd | 866 | return st; |
867 | } | |
868 | ||
d46ce6a4 | 869 | /*@only@*/ cstring constraint_print (constraint c) /*@*/ |
616915dd | 870 | { |
871 | cstring st = cstring_undefined; | |
872 | cstring type = cstring_undefined; | |
dc92450f | 873 | llassert (c !=NULL); |
616915dd | 874 | if (c->post) |
875 | { | |
03d670b6 | 876 | type = cstring_makeLiteral ("ensures: "); |
616915dd | 877 | } |
878 | else | |
879 | { | |
03d670b6 | 880 | type = cstring_makeLiteral ("requires: "); |
616915dd | 881 | } |
d46ce6a4 | 882 | st = message ("%q: %q %q %q", |
616915dd | 883 | type, |
884 | constraintExpr_print (c->lexpr), | |
885 | arithType_print(c->ar), | |
886 | constraintExpr_print(c->expr) | |
887 | ); | |
888 | return st; | |
889 | } | |
890 | ||
90bc41f7 | 891 | cstring constraint_printOr (constraint c) /*@*/ |
892 | { | |
893 | cstring ret; | |
894 | constraint temp; | |
895 | ||
896 | ret = cstring_undefined; | |
897 | temp = c; | |
898 | ||
d46ce6a4 | 899 | ret = cstring_concatFree (ret, constraint_print(temp) ); |
90bc41f7 | 900 | |
901 | temp = temp->or; | |
902 | ||
c3e695ff | 903 | while ( constraint_isDefined(temp) ) |
90bc41f7 | 904 | { |
d46ce6a4 | 905 | ret = cstring_concatFree (ret, cstring_makeLiteral (" OR ") ); |
906 | ret = cstring_concatFree (ret, constraint_print(temp) ); | |
90bc41f7 | 907 | temp = temp->or; |
908 | } | |
909 | ||
910 | return ret; | |
911 | ||
912 | } | |
913 | ||
dc92450f | 914 | /*@only@*/ constraint constraint_doSRefFixBaseParam (/*@returned@*/ /*@only@*/ constraint precondition, |
616915dd | 915 | exprNodeList arglist) |
916 | { | |
917 | precondition->lexpr = constraintExpr_doSRefFixBaseParam (precondition->lexpr, | |
918 | arglist); | |
919 | precondition->expr = constraintExpr_doSRefFixBaseParam (precondition->expr, | |
920 | arglist); | |
921 | ||
922 | return precondition; | |
923 | } | |
924 | ||
925 | ||
28bf4b0b | 926 | constraint constraint_doFixResult (constraint postcondition, /*@dependent@*/ exprNode fcnCall) |
616915dd | 927 | { |
928 | postcondition = constraint_copy (postcondition); | |
929 | postcondition->lexpr = constraintExpr_doFixResult (postcondition->lexpr, fcnCall); | |
930 | postcondition->expr = constraintExpr_doFixResult (postcondition->expr, fcnCall); | |
931 | ||
932 | return postcondition; | |
933 | } | |
934 | ||
d46ce6a4 | 935 | /*@only@*/ constraint constraint_doSRefFixConstraintParam (constraint precondition, |
616915dd | 936 | exprNodeList arglist) |
937 | { | |
938 | ||
939 | precondition = constraint_copy (precondition); | |
940 | precondition->lexpr = constraintExpr_doSRefFixConstraintParam (precondition->lexpr, arglist); | |
941 | precondition->expr = constraintExpr_doSRefFixConstraintParam (precondition->expr, arglist); | |
942 | ||
4ab867d6 | 943 | precondition->fcnPre = FALSE; |
616915dd | 944 | return precondition; |
945 | } | |
946 | ||
947 | // bool constraint_hasTerm (constraint c, constraintTerm term) | |
948 | // { | |
949 | // DPRINTF((message ("Constraint %s", constraint_print (c) ) ) ); | |
950 | ||
951 | // if (constraintExpr_includesTerm (c->lexpr, term) ) | |
952 | // return TRUE; | |
953 | ||
954 | // if (constraintExpr_includesTerm (c->expr, term) ) | |
955 | // return TRUE; | |
956 | ||
957 | // return FALSE; | |
958 | // } | |
959 | ||
d46ce6a4 | 960 | constraint constraint_preserveOrig (/*@returned@*/ constraint c) /*@modifies c @*/ |
616915dd | 961 | { |
4ab867d6 | 962 | |
963 | DPRINTF( (message("Doing constraint_preserverOrig for %q ", constraint_printDetailed(c) ) )); | |
964 | ||
d46ce6a4 | 965 | if (c->orig == constraint_undefined) |
966 | c->orig = constraint_copy (c); | |
4ab867d6 | 967 | |
968 | else if (c->orig->fcnPre) | |
969 | { | |
970 | constraint temp; | |
971 | ||
972 | temp = c->orig; | |
973 | ||
974 | /* avoid infinite loop */ | |
975 | c->orig = NULL; | |
976 | c->orig = constraint_copy (c); | |
977 | if (c->orig->orig == NULL) | |
920a3797 | 978 | { |
979 | c->orig->orig = temp; | |
980 | temp = NULL; | |
981 | } | |
4ab867d6 | 982 | else |
920a3797 | 983 | { |
984 | llcontbug((message("Expected c->orig->orig to be null" ) )); | |
985 | constraint_free(c->orig->orig); | |
986 | c->orig->orig = temp; | |
987 | temp = NULL; | |
988 | } | |
4ab867d6 | 989 | } |
990 | else | |
991 | { | |
992 | DPRINTF( (message("Not changing constraint") )); | |
993 | } | |
d46ce6a4 | 994 | |
4ab867d6 | 995 | DPRINTF( (message("After Doing constraint_preserverOrig for %q ", constraint_printDetailed(c) ) )); |
996 | ||
616915dd | 997 | return c; |
998 | } | |
999 | /*@=fcnuse*/ | |
1000 | /*@=assignexpose*/ | |
1001 | /*@=czechfcns@*/ | |
84c9ffbf | 1002 | |
2934b455 | 1003 | |
84c9ffbf | 1004 | constraint constraint_togglePost (/*@returned@*/ constraint c) |
1005 | { | |
1006 | c->post = !c->post; | |
1007 | return c; | |
1008 | } | |
2934b455 | 1009 | |
1010 | constraint constraint_togglePostOrig (/*@returned@*/ constraint c) | |
1011 | { | |
1012 | if (c->orig != NULL) | |
1013 | c->orig = constraint_togglePost(c->orig); | |
1014 | return c; | |
1015 | } | |
1016 | ||
1017 | bool constraint_hasOrig( /*@observer@*/ /*@temp@*/ constraint c) | |
1018 | { | |
1019 | if (c->orig == NULL) | |
1020 | return FALSE; | |
1021 | else | |
1022 | return TRUE; | |
1023 | } | |
920a3797 | 1024 | |
1025 | ||
1026 | constraint constraint_undump (FILE *f) | |
1027 | { | |
1028 | constraint c; | |
1029 | bool fcnPre; | |
1030 | bool post; | |
1031 | arithType ar; | |
1032 | ||
1033 | constraintExpr lexpr; | |
1034 | constraintExpr expr; | |
28bf4b0b | 1035 | |
920a3797 | 1036 | |
1037 | char * s; | |
1038 | ||
1039 | char *os; | |
1040 | ||
1041 | s = mstring_create (MAX_DUMP_LINE_LENGTH); | |
1042 | ||
1043 | os = s; | |
1044 | ||
1045 | s = fgets(os, MAX_DUMP_LINE_LENGTH, f); | |
1046 | ||
1047 | /*@i33*/ /*this should probably be wrappered...*/ | |
1048 | ||
28bf4b0b | 1049 | fcnPre = (bool) reader_getInt (&s); |
920a3797 | 1050 | advanceField(&s); |
28bf4b0b | 1051 | post = (bool) reader_getInt (&s); |
920a3797 | 1052 | advanceField(&s); |
28bf4b0b | 1053 | ar = (arithType) reader_getInt (&s); |
920a3797 | 1054 | |
1055 | s = fgets(os, MAX_DUMP_LINE_LENGTH, f); | |
1056 | ||
28bf4b0b | 1057 | reader_checkChar (&s, 'l'); |
920a3797 | 1058 | |
1059 | lexpr = constraintExpr_undump (f); | |
1060 | ||
1061 | s = fgets(os, MAX_DUMP_LINE_LENGTH, f); | |
1062 | ||
28bf4b0b | 1063 | reader_checkChar (&s, 'r'); |
920a3797 | 1064 | expr = constraintExpr_undump (f); |
1065 | ||
1066 | c = constraint_makeNew(); | |
1067 | ||
1068 | c->fcnPre = fcnPre; | |
1069 | c->post = post; | |
1070 | c->ar = ar; | |
1071 | ||
1072 | c->lexpr = lexpr; | |
1073 | c->expr = expr; | |
1074 | ||
1075 | free(os); | |
1076 | return c; | |
1077 | } | |
1078 | ||
1079 | ||
1080 | void constraint_dump (/*@observer@*/ constraint c, FILE *f) | |
1081 | { | |
1082 | bool fcnPre; | |
1083 | bool post; | |
1084 | arithType ar; | |
1085 | ||
1086 | constraintExpr lexpr; | |
1087 | constraintExpr expr; | |
28bf4b0b | 1088 | |
920a3797 | 1089 | |
1090 | fcnPre = c->fcnPre; | |
1091 | post = c->post; | |
1092 | ar = c->ar; | |
1093 | lexpr = c->lexpr; | |
1094 | expr = c->expr; | |
1095 | ||
1096 | fprintf(f, "%d@%d@%d\n", (int) fcnPre, (int) post, (int) ar); | |
1097 | fprintf(f,"l\n"); | |
1098 | constraintExpr_dump (lexpr, f); | |
1099 | fprintf(f,"r\n"); | |
1100 | constraintExpr_dump (expr, f); | |
1101 | } | |
1102 | ||
1103 | ||
02984642 | 1104 | int constraint_compare (/*@observer@*/ /*@temp@*/ constraint * c1, /*@observer@*/ /*@temp@*/ constraint * c2) /*@*/ |
1105 | { | |
1106 | fileloc loc1, loc2; | |
1107 | ||
1108 | int ret; | |
1109 | ||
1110 | llassert(constraint_isDefined(*c1) ); | |
1111 | llassert(constraint_isDefined(*c2) ); | |
1112 | ||
1113 | if (constraint_isUndefined(*c1) ) | |
1114 | { | |
1115 | if (constraint_isUndefined(*c2) ) | |
1116 | return 0; | |
1117 | else | |
1118 | return 1; | |
1119 | } | |
1120 | ||
1121 | if (constraint_isUndefined(*c2) ) | |
1122 | { | |
1123 | return -1; | |
1124 | } | |
1125 | ||
1126 | loc1 = constraint_getFileloc(*c1); | |
1127 | loc2 = constraint_getFileloc(*c2); | |
1128 | ||
1129 | ret = fileloc_compare(loc1, loc2); | |
1130 | ||
1131 | fileloc_free(loc1); | |
1132 | fileloc_free(loc2); | |
1133 | ||
1134 | return ret; | |
1135 | } | |
1136 | ||
1137 |