Don't try calling lsl when file is missing.
[splint-patched.git] / test / observer.c
blob38b13f8943b1b149a31848df2d348e9e2d701b0e
1 typedef struct
3 /*@only@*/ char *name;
4 int val;
5 } *stx;
7 /*@only@*/ char *stx_name (stx x)
9 return (x->name); /* 1. Function returns reference to parameter x: (x->name)
10 ** [2]. Return value exposes rep of stx: (x->name)
11 ** 3. Released storage x->name reachable from parameter
15 /*@observer@*/ char *stx_observeName (stx x)
17 return (x->name);
20 /*@exposed@*/ char *stx_exposeName (stx x)
22 return (x->name); /* okay */
25 char *f (stx x)
27 char *s;
29 s = stx_name (x);
30 free (s); /* okay */
32 s = stx_observeName (x);
33 *s = 'x'; /* 4. Modification of observer */
34 free (s); /* 5. Pass observer as only */
36 s = stx_exposeName (x);
37 *s = 'x'; /* okay */
38 free (s); /* 6. Pass exposed as only */
40 s = stx_observeName (x);
41 return s; /* 7. Observer storage s returned without qualification: s
42 ** 8. Dependent storage s returned as unqualified: s