Module Name: src
Committed By: rillig
Date: Sat Nov 30 16:34:27 UTC 2024
Modified Files:
src/tests/usr.bin/xlint/lint2: msg_011.exp msg_011.ln
src/usr.bin/xlint/common: tyname.c
Log Message:
lint: fix type name of prototype function in lint2 messages
Since tyname.c 1.42 from 2021-06-28, when the type names for '(void)'
prototypes was fixed for lint1 but not for lint2.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint2/msg_011.exp
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint2/msg_011.ln
cvs rdiff -u -r1.63 -r1.64 src/usr.bin/xlint/common/tyname.c
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/lint2/msg_011.exp
diff -u src/tests/usr.bin/xlint/lint2/msg_011.exp:1.3 src/tests/usr.bin/xlint/lint2/msg_011.exp:1.4
--- src/tests/usr.bin/xlint/lint2/msg_011.exp:1.3 Sat Nov 30 16:20:42 2024
+++ src/tests/usr.bin/xlint/lint2/msg_011.exp Sat Nov 30 16:34:27 2024
@@ -6,6 +6,6 @@ add, arg 1 declared inconsistently (doub
add, arg 2 declared inconsistently (double != int) msg_011_define.c(2) :: msg_011_call.c(2)
func_param defined( msg_011_call_func.c(11) ), but never used
func_param, arg 1 declared inconsistently (pointer to function(char) returning void != pointer to function() returning void) msg_011_call_func.c(11) :: msg_011_call_func.c(12)
-func_param, arg 1 declared inconsistently (pointer to function(char) returning void != pointer to function() returning void) msg_011_call_func.c(11) :: msg_011_call_func.c(13)
+func_param, arg 1 declared inconsistently (pointer to function(char) returning void != pointer to function(void) returning void) msg_011_call_func.c(11) :: msg_011_call_func.c(13)
func_param, arg 1 declared inconsistently (pointer to function(char) returning void != pointer to function(double) returning void) msg_011_call_func.c(11) :: msg_011_call_func.c(14)
func_param, arg 1 declared inconsistently (pointer to function(char) returning void != pointer to function(double, double) returning void) msg_011_call_func.c(11) :: msg_011_call_func.c(15)
Index: src/tests/usr.bin/xlint/lint2/msg_011.ln
diff -u src/tests/usr.bin/xlint/lint2/msg_011.ln:1.4 src/tests/usr.bin/xlint/lint2/msg_011.ln:1.5
--- src/tests/usr.bin/xlint/lint2/msg_011.ln:1.4 Sat Nov 30 16:20:42 2024
+++ src/tests/usr.bin/xlint/lint2/msg_011.ln Sat Nov 30 16:34:27 2024
@@ -1,4 +1,4 @@
-# $NetBSD: msg_011.ln,v 1.4 2024/11/30 16:20:42 rillig Exp $
+# $NetBSD: msg_011.ln,v 1.5 2024/11/30 16:34:27 rillig Exp $
#
# Test data for message 11 of lint2:
# %s, arg %d declared inconsistently (%s != %s) %s :: %s
@@ -16,10 +16,16 @@ S msg_011_call.c
4 c 0.4 p1 p2 u 3add f2 I I I
4 d 0.4 d r 4main F0 I
-0smsg_011_call_func.c
-Smsg_011_call_func.c
-11d0.11d10func_paramF1PF1CVV
-12d0.12e10func_paramF1PFVV
-13d0.13e10func_paramF1PF0VV
-14d0.14e10func_paramF1PF1DVV
-15d0.15e10func_paramF1PF2DDVV
+# # 11 "msg_011_call_func.c"
+# void func_param(void (*)(char)) {}
+# void func_param(void (*)());
+# void func_param(void (*)(void));
+# void func_param(void (*)(double));
+# void func_param(void (*)(double, double));
+0 s msg_011_call_func.c
+S msg_011_call_func.c
+11 d 0.11 d 10func_param F1 PF1 C V V
+12 d 0.12 e 10func_param F1 PF V V
+13 d 0.13 e 10func_param F1 PF0 V V
+14 d 0.14 e 10func_param F1 PF1 D V V
+15 d 0.15 e 10func_param F1 PF2 D D V V
Index: src/usr.bin/xlint/common/tyname.c
diff -u src/usr.bin/xlint/common/tyname.c:1.63 src/usr.bin/xlint/common/tyname.c:1.64
--- src/usr.bin/xlint/common/tyname.c:1.63 Wed Nov 13 03:43:00 2024
+++ src/usr.bin/xlint/common/tyname.c Sat Nov 30 16:34:26 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: tyname.c,v 1.63 2024/11/13 03:43:00 rillig Exp $ */
+/* $NetBSD: tyname.c,v 1.64 2024/11/30 16:34:26 rillig Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: tyname.c,v 1.63 2024/11/13 03:43:00 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.64 2024/11/30 16:34:26 rillig Exp $");
#endif
#include <assert.h>
@@ -176,7 +176,7 @@ type_name_of_function(buffer *buf, const
type_t **argtype;
argtype = tp->t_args;
- if (argtype == NULL)
+ if (*argtype == NULL)
buf_add(buf, "void");
for (; *argtype != NULL; argtype++) {
buf_add(buf, sep), sep = ", ";