From 347df2901b522b14e3fa773bcae3f3d3bcd561dc Mon Sep 17 00:00:00 2001 From: Martynas Venckus Date: Tue, 31 May 2011 22:35:20 +0000 Subject: Test lint warnings about empty non-compound selection statements. --- regress/usr.bin/xlint/Makefile | 4 ++-- regress/usr.bin/xlint/test-26.c | 22 ++++++++++++++++++++++ regress/usr.bin/xlint/test-26.c.exp | 5 +++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 regress/usr.bin/xlint/test-26.c create mode 100644 regress/usr.bin/xlint/test-26.c.exp 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 . + * + * 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: -- cgit v1.2.3