diff options
author | Martynas Venckus <martynas@cvs.openbsd.org> | 2011-05-31 22:35:20 +0000 |
---|---|---|
committer | Martynas Venckus <martynas@cvs.openbsd.org> | 2011-05-31 22:35:20 +0000 |
commit | 347df2901b522b14e3fa773bcae3f3d3bcd561dc (patch) | |
tree | 1f94d97760d25fca33b174af7c92bffcd98b1231 | |
parent | fbdb0066ca2efc44c949f444a4858cd780121e11 (diff) |
Test lint warnings about empty non-compound selection statements.
-rw-r--r-- | regress/usr.bin/xlint/Makefile | 4 | ||||
-rw-r--r-- | regress/usr.bin/xlint/test-26.c | 22 | ||||
-rw-r--r-- | regress/usr.bin/xlint/test-26.c.exp | 5 |
3 files changed, 29 insertions, 2 deletions
diff --git a/regress/usr.bin/xlint/Makefile b/regress/usr.bin/xlint/Makefile index 9a7767091a6..07acc15a398 100644 --- a/regress/usr.bin/xlint/Makefile +++ b/regress/usr.bin/xlint/Makefile @@ -1,7 +1,7 @@ -# $OpenBSD: Makefile,v 1.28 2010/07/25 23:00:05 guenther Exp $ +# $OpenBSD: Makefile,v 1.29 2011/05/31 22:35:19 martynas Exp $ TEST_MODULES= 1 2 3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 21 22 \ - 23 24 25 + 23 24 25 26 LINT= lint .for i in ${TEST_MODULES} diff --git a/regress/usr.bin/xlint/test-26.c b/regress/usr.bin/xlint/test-26.c new file mode 100644 index 00000000000..95f36cd2d7f --- /dev/null +++ b/regress/usr.bin/xlint/test-26.c @@ -0,0 +1,22 @@ +/* $OpenBSD: test-26.c,v 1.1 2011/05/31 22:35:19 martynas Exp $ */ + +/* + * Placed in the public domain by Martynas Venckus <martynas@openbsd.org>. + * + * Test lint warnings about empty non-compound selection statements. + */ + +/* ARGSUSED */ +int +main(void) +{ + if (0); + if (0) 0; + if (0) {} + + if (0) {} else; + if (0) {} else 0; + if (0) {} else {} + + return (0); +} diff --git a/regress/usr.bin/xlint/test-26.c.exp b/regress/usr.bin/xlint/test-26.c.exp new file mode 100644 index 00000000000..602bf1052ea --- /dev/null +++ b/regress/usr.bin/xlint/test-26.c.exp @@ -0,0 +1,5 @@ +test-26.c:13: warning: empty body of the if statement +test-26.c:14: warning: expression has null effect +test-26.c:17: warning: empty body of the else statement +test-26.c:18: warning: expression has null effect +Lint pass2: |