diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2006-05-03 18:23:18 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2006-05-03 18:23:18 +0000 |
commit | 4d72b8dd7c70707208d325812c08a89add64aa75 (patch) | |
tree | 38527eec9513f7badd11ed4ab8accf6719834fcc /regress/usr.bin | |
parent | ee0acc8cf3e03c7677bea34d167ee2f11ba3ca03 (diff) |
more test cases
Diffstat (limited to 'regress/usr.bin')
-rw-r--r-- | regress/usr.bin/xlint/test-20.c | 20 | ||||
-rw-r--r-- | regress/usr.bin/xlint/test-20.c.exp | 21 |
2 files changed, 28 insertions, 13 deletions
diff --git a/regress/usr.bin/xlint/test-20.c b/regress/usr.bin/xlint/test-20.c index 25c9d3e53d0..cb3fd7d3f99 100644 --- a/regress/usr.bin/xlint/test-20.c +++ b/regress/usr.bin/xlint/test-20.c @@ -1,4 +1,4 @@ -/* $OpenBSD: test-20.c,v 1.1 2006/04/27 20:41:19 otto Exp $ */ +/* $OpenBSD: test-20.c,v 1.2 2006/05/03 18:23:17 otto Exp $ */ /* * Placed in the public domain by Otto Moerbeek <otto@drijf.net>. @@ -6,13 +6,15 @@ * Test the 'expression has null effect warning' */ +#include <assert.h> int f(int x,...) { int p; + char *q = 0; int i = (1,33), j = (p=0,p), k = (i+j, i=0); - int a = 1, b = 2, t; + int a = i < 1 ? j : i, b = 2, t; t = a, a = b, b = t; @@ -41,5 +43,19 @@ int f(int x,...) a = (1,b,f(a,(a,b),t)); + *q = 0, *q = 0, *q = 0, *q = 0, *q = 0; + + *q + 0, *q = 0, *q = 0, *q = 0, *q = 0; + + q ? q = 0 : q++; + + assert(p == j); + + 0; + + (void)0; + + j = j < 0 ? j + 1 : j + 2; + return k + k, x; } diff --git a/regress/usr.bin/xlint/test-20.c.exp b/regress/usr.bin/xlint/test-20.c.exp index 2df33b63765..cc6a03f14eb 100644 --- a/regress/usr.bin/xlint/test-20.c.exp +++ b/regress/usr.bin/xlint/test-20.c.exp @@ -1,22 +1,21 @@ -test-20.c:13: warning: expression has null effect -test-20.c:13: warning: expression has null effect -test-20.c:19: warning: expression has null effect -test-20.c:19: warning: expression has null effect +test-20.c:15: warning: expression has null effect +test-20.c:15: warning: expression has null effect test-20.c:21: warning: expression has null effect test-20.c:23: warning: expression has null effect test-20.c:25: warning: expression has null effect -test-20.c:29: warning: expression has null effect -test-20.c:31: warning: expression has null effect -test-20.c:31: warning: expression has null effect -test-20.c:31: warning: expression has null effect +test-20.c:27: warning: expression has null effect test-20.c:31: warning: expression has null effect test-20.c:33: warning: expression has null effect test-20.c:33: warning: expression has null effect test-20.c:33: warning: expression has null effect +test-20.c:33: warning: expression has null effect test-20.c:35: warning: expression has null effect -test-20.c:40: warning: expression has null effect -test-20.c:42: warning: expression has null effect -test-20.c:42: warning: expression has null effect +test-20.c:37: warning: expression has null effect test-20.c:42: warning: expression has null effect test-20.c:44: warning: expression has null effect +test-20.c:44: warning: expression has null effect +test-20.c:44: warning: expression has null effect +test-20.c:48: warning: expression has null effect +test-20.c:54: warning: expression has null effect +test-20.c:60: warning: expression has null effect Lint pass2: |