summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorAlexander von Gernler <grunk@cvs.openbsd.org>2005-12-02 21:24:10 +0000
committerAlexander von Gernler <grunk@cvs.openbsd.org>2005-12-02 21:24:10 +0000
commit8165936575226edd6232478843c6055032599390 (patch)
tree72c6c82d97d3c3829a2e7728da8af6214b779c92 /regress
parent83727cf7aa7d5e3047914b2039eff2337a6b909c (diff)
add test that lint gets keywords from comments out of #define macros
ok cloder@
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.bin/xlint/Makefile4
-rw-r--r--regress/usr.bin/xlint/test-10.c27
-rw-r--r--regress/usr.bin/xlint/test-10.c.exp3
3 files changed, 32 insertions, 2 deletions
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 <grunk@openbsd.org>
+ *
+ * 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: