summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regress/usr.bin/xlint/Makefile4
-rw-r--r--regress/usr.bin/xlint/test-5.c39
-rw-r--r--regress/usr.bin/xlint/test-5.c.exp6
3 files changed, 47 insertions, 2 deletions
diff --git a/regress/usr.bin/xlint/Makefile b/regress/usr.bin/xlint/Makefile
index 77c17e98627..752bbdf111a 100644
--- a/regress/usr.bin/xlint/Makefile
+++ b/regress/usr.bin/xlint/Makefile
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile,v 1.4 2005/11/26 20:45:30 cloder Exp $
+# $OpenBSD: Makefile,v 1.5 2005/11/28 01:05:08 cloder Exp $
-TEST_MODULES= 1 2 3 4
+TEST_MODULES= 1 2 3 4 5
LINT= lint
LINTFLAGS?= -chapbx
diff --git a/regress/usr.bin/xlint/test-5.c b/regress/usr.bin/xlint/test-5.c
new file mode 100644
index 00000000000..42a7787f52c
--- /dev/null
+++ b/regress/usr.bin/xlint/test-5.c
@@ -0,0 +1,39 @@
+/* $OpenBSD: test-5.c,v 1.1 2005/11/28 01:05:08 cloder Exp $ */
+
+/*
+ * Placed in the public domain by Chad Loder <cloder@openbsd.org>.
+ *
+ * Test warning of promotion of function arguments.
+ */
+
+#include <limits.h>
+
+void
+foo(unsigned long long a)
+{
+ a++;
+}
+
+void foobar(int a)
+{
+ a++;
+}
+
+void bar(unsigned int a)
+{
+ a++;
+}
+
+/* ARGSUSED */
+int
+main(int argc, char* argv[])
+{
+ int a = 0;
+
+ foo(0); /* ok, promotion of in-range constant */
+ foo(a); /* warning: promotion of non-constant */
+ foobar(QUAD_MAX); /* warning: promotion of out-of-range constant */
+ bar(-1); /* warning: promotion of out-of-range constant */
+ bar(0); /* ok, promotion of in-range constant */
+ return 0;
+}
diff --git a/regress/usr.bin/xlint/test-5.c.exp b/regress/usr.bin/xlint/test-5.c.exp
new file mode 100644
index 00000000000..f42ee906c23
--- /dev/null
+++ b/regress/usr.bin/xlint/test-5.c.exp
@@ -0,0 +1,6 @@
+test-5.c(34): warning: conversion to 'unsigned long long' due to prototype, arg #1
+test-5.c(35): warning: conversion of 'long long' to 'int' is out of range, arg #1
+dammit2
+test-5.c(36): warning: conversion to 'unsigned int' due to prototype, arg #1
+test-5.c(36): warning: conversion of negative constant to unsigned type, arg #1
+Lint pass2: