xref: /illumos-gate/usr/src/tools/smatch/src/validation/kill-pure-call.c (revision 1f5207b7604fb44407eb4342aff613f7c4508508)
1*1f5207b7SJohn Levon int side(int a);
2*1f5207b7SJohn Levon int pure(int a) __attribute__((pure));
3*1f5207b7SJohn Levon 
keep(int a)4*1f5207b7SJohn Levon int keep(int a) { return side(a) && 0; }
kill(int a)5*1f5207b7SJohn Levon int kill(int a) { return pure(a) && 0; }
6*1f5207b7SJohn Levon 
7*1f5207b7SJohn Levon /*
8*1f5207b7SJohn Levon  * check-name: kill-pure-call
9*1f5207b7SJohn Levon  * check-command: test-linearize -Wno-decl $file
10*1f5207b7SJohn Levon  * check-description:
11*1f5207b7SJohn Levon  *	See that the call is optimized away but only
12*1f5207b7SJohn Levon  *	when the function is "pure".
13*1f5207b7SJohn Levon  *
14*1f5207b7SJohn Levon  * check-output-ignore
15*1f5207b7SJohn Levon  * check-output-contains: call\\..* side
16*1f5207b7SJohn Levon  * check-output-excludes: call\\..* pure
17*1f5207b7SJohn Levon  */
18