Some consistency changes to library & headers flags.
[splint-patched.git] / test / numabstract.c
blob1345a2f13c32931b5084492f929d8dc15743a534
1 typedef /*@numabstract@*/ int apples;
2 typedef /*@numabstract@*/ int oranges;
4 /*@noaccess apples@*/
5 /*@noaccess oranges@*/
7 int adding (apples a, oranges o)
9 int i;
10 apples a2;
11 a++; /* Okay */
12 a2 = 13; /* error (unless +numabstractlit) ? */
13 a2 = 'a'; /* error */
14 i = 'c'; /* error */
15 a2 = (apples) 13; /* warning if +numabstractcast */
16 a2 = a + 5; /* okay */
17 a2 = o; /* error */
18 a2 = a2 - a; /* okay */
19 i = o; /* error */
20 i = a2 + a; /* error */
21 return a + o; /* error */
24 int comparing (apples a, oranges o, apples a2)
26 if (a < 3) { /* error unless +numabstractlit */
27 return 3;
30 if (a < o) { /* error */
31 return 5;
34 if (a == o) { /* error */
35 return 6;
38 if (a == a2) { /* okay */
39 return 23;
42 --a2;
44 if (a >= a2) {
45 return 523;
48 return 7;