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: demonstrate parse erro...



details:   https://anonhg.NetBSD.org/src/rev/0b880798c37c
branches:  trunk
changeset: 1023534:0b880798c37c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Sep 12 16:08:14 2021 +0000

description:
tests/lint: demonstrate parse error for function-type parameters

Seen in sbin/fsck_lfs/vnode.c(104), where lint wrongly complains:

        error: redeclaration of register_vget [27]

diffstat:

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

diffs (35 lines):

diff -r c47cb4b8c099 -r 0b880798c37c tests/usr.bin/xlint/lint1/msg_027.c
--- a/tests/usr.bin/xlint/lint1/msg_027.c       Sun Sep 12 16:07:16 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_027.c       Sun Sep 12 16:08:14 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_027.c,v 1.3 2021/01/31 11:12:07 rillig Exp $       */
+/*     $NetBSD: msg_027.c,v 1.4 2021/09/12 16:08:14 rillig Exp $       */
 # 3 "msg_027.c"
 
 // Test for message: redeclaration of %s [27]
@@ -6,3 +6,19 @@
 extern int identifier(void);
 
 extern double identifier(void);                /* expect: 27 */
+
+/*
+ * As of 2021-09-12, lint complains about mismatched types.
+ * GCC and Clang accept this.
+ *
+ * Above:
+ *     function(pointer to void, int) returning void
+ *
+ * Below: function(
+ *     pointer to void,
+ *     pointer to function(pointer to void, int) returning pointer to double
+ * ) returning void
+ */
+void function_parameter(void *, double *(void *, int));
+/* expect+1: error: redeclaration of function_parameter [27] */
+void function_parameter(void *fs, double *func(void *, int));
diff -r c47cb4b8c099 -r 0b880798c37c tests/usr.bin/xlint/lint1/msg_027.exp
--- a/tests/usr.bin/xlint/lint1/msg_027.exp     Sun Sep 12 16:07:16 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_027.exp     Sun Sep 12 16:08:14 2021 +0000
@@ -1,1 +1,2 @@
 msg_027.c(8): error: redeclaration of identifier [27]
+msg_027.c(24): error: redeclaration of function_parameter [27]



Home | Main Index | Thread Index | Old Index