Module Name:    src
Committed By:   rillig
Date:           Sat May  1 07:56:20 UTC 2021

Modified Files:
        src/tests/usr.bin/xlint/lint1: gcc_attribute.c gcc_attribute.exp

Log Message:
tests/lint: add test for __attribute__((nonnull()))


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/gcc_attribute.c \
    src/tests/usr.bin/xlint/lint1/gcc_attribute.exp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/gcc_attribute.c
diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute.c:1.2 src/tests/usr.bin/xlint/lint1/gcc_attribute.c:1.3
--- src/tests/usr.bin/xlint/lint1/gcc_attribute.c:1.2	Sat May  1 07:25:07 2021
+++ src/tests/usr.bin/xlint/lint1/gcc_attribute.c	Sat May  1 07:56:20 2021
@@ -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);
Index: src/tests/usr.bin/xlint/lint1/gcc_attribute.exp
diff -u src/tests/usr.bin/xlint/lint1/gcc_attribute.exp:1.2 src/tests/usr.bin/xlint/lint1/gcc_attribute.exp:1.3
--- src/tests/usr.bin/xlint/lint1/gcc_attribute.exp:1.2	Sat May  1 07:25:07 2021
+++ src/tests/usr.bin/xlint/lint1/gcc_attribute.exp	Sat May  1 07:56:20 2021
@@ -1 +1 @@
-gcc_attribute.c(31): error: syntax error 'unknown_attribute' [249]
+gcc_attribute.c(39): error: syntax error 'unknown_attribute' [249]

Reply via email to