Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin/xlint/lint1 tests/lint: add test for __attribu...



details:   https://anonhg.NetBSD.org/src/rev/4e8b5e1a784f
branches:  trunk
changeset: 378962:4e8b5e1a784f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat May 01 07:56:20 2021 +0000

description:
tests/lint: add test for __attribute__((nonnull()))

diffstat:

 tests/usr.bin/xlint/lint1/gcc_attribute.c   |  10 +++++++++-
 tests/usr.bin/xlint/lint1/gcc_attribute.exp |   2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r b301ac03c1e2 -r 4e8b5e1a784f tests/usr.bin/xlint/lint1/gcc_attribute.c
--- a/tests/usr.bin/xlint/lint1/gcc_attribute.c Sat May 01 07:41:24 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/gcc_attribute.c Sat May 01 07:56:20 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gcc_attribute.c,v 1.2 2021/05/01 07:25:07 rillig Exp $ */
+/*     $NetBSD: gcc_attribute.c,v 1.3 2021/05/01 07:56:20 rillig Exp $ */
 # 3 "gcc_attribute.c"
 
 /*
@@ -23,6 +23,14 @@ do_not_inline(void)
 void __attribute__((nonnull))
 function_nonnull(void *, const void *, int);
 
+/*
+ * The documentation suggests that the argument list of nonnull be nonempty,
+ * but GCC 9.3.0 accepts an empty list as well, treating all parameters as
+ * nonnull.
+ */
+void __attribute__((nonnull()))
+function_nonnull_list(void *, const void *, int);
+
 /* Arguments 1 and 2 must be nonnull. */
 void __attribute__((nonnull(1, 2)))
 function_nonnull_list(void *, const void *, int);
diff -r b301ac03c1e2 -r 4e8b5e1a784f tests/usr.bin/xlint/lint1/gcc_attribute.exp
--- a/tests/usr.bin/xlint/lint1/gcc_attribute.exp       Sat May 01 07:41:24 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/gcc_attribute.exp       Sat May 01 07:56:20 2021 +0000
@@ -1,1 +1,1 @@
-gcc_attribute.c(31): error: syntax error 'unknown_attribute' [249]
+gcc_attribute.c(39): error: syntax error 'unknown_attribute' [249]



Home | Main Index | Thread Index | Old Index