From 8165936575226edd6232478843c6055032599390 Mon Sep 17 00:00:00 2001 From: Alexander von Gernler Date: Fri, 2 Dec 2005 21:24:10 +0000 Subject: add test that lint gets keywords from comments out of #define macros ok cloder@ --- regress/usr.bin/xlint/Makefile | 4 ++-- regress/usr.bin/xlint/test-10.c | 27 +++++++++++++++++++++++++++ regress/usr.bin/xlint/test-10.c.exp | 3 +++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 regress/usr.bin/xlint/test-10.c create mode 100644 regress/usr.bin/xlint/test-10.c.exp (limited to 'regress') diff --git a/regress/usr.bin/xlint/Makefile b/regress/usr.bin/xlint/Makefile index 13ed4f55bac..a6b0c8bbeab 100644 --- a/regress/usr.bin/xlint/Makefile +++ b/regress/usr.bin/xlint/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.9 2005/12/01 05:19:25 cloder Exp $ +# $OpenBSD: Makefile,v 1.10 2005/12/02 21:24:09 grunk Exp $ -TEST_MODULES= 1 2 3 4 5 6 7 8 9 +TEST_MODULES= 1 2 3 4 5 6 7 8 9 10 LINT= lint LINTFLAGS?= -chapbx diff --git a/regress/usr.bin/xlint/test-10.c b/regress/usr.bin/xlint/test-10.c new file mode 100644 index 00000000000..803c04f0d23 --- /dev/null +++ b/regress/usr.bin/xlint/test-10.c @@ -0,0 +1,27 @@ +/* $OpenBSD: test-10.c,v 1.1 2005/12/02 21:24:09 grunk Exp $ */ + +/* + * Placed in the public domain by Alexander von Gernler + * + * Test if lint keywords in #define macros are preserved + */ + +/* ARGSUSED */ +void +foo(int bar) { +} + +#define S(x) do { foo(x); } while (/* CONSTCOND */ 0) +#define T(x) do { foo(x); } while (0) + +/* ARGSUSED */ +int +main(int argc, char *argv[]) { + S(1); + T(1); + + do { foo(1); } while (/* CONSTCOND */ 0); + do { foo(1); } while (0); + + return (0); +} diff --git a/regress/usr.bin/xlint/test-10.c.exp b/regress/usr.bin/xlint/test-10.c.exp new file mode 100644 index 00000000000..c739707fc42 --- /dev/null +++ b/regress/usr.bin/xlint/test-10.c.exp @@ -0,0 +1,3 @@ +test-10.c(21): warning: constant in conditional context +test-10.c(24): warning: constant in conditional context +Lint pass2: -- cgit v1.2.3