Module Name:    src
Committed By:   rillig
Date:           Sun Jan  3 15:44:36 UTC 2021

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

Log Message:
lint: add test for message 124 "illegal pointer combination"

The message may be correct, but it is not helpful in any way.  There are
just too many function pointers that may differ in a very small detail.

Before tyname.c 1.20 from 2021-01-02, the string representation of type
names was often limited to only 63 characters.  Because of this, it made
sense to omit any detail that could need more space than this.  Now that
this limitation is gone, it's reasonable to add more detail to the type
information, especially since that information is readily available.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_124.c \
    src/tests/usr.bin/xlint/lint1/msg_124.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/msg_124.c
diff -u src/tests/usr.bin/xlint/lint1/msg_124.c:1.1 src/tests/usr.bin/xlint/lint1/msg_124.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_124.c:1.1	Sat Jan  2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_124.c	Sun Jan  3 15:44:35 2021
@@ -1,7 +1,19 @@
-/*	$NetBSD: msg_124.c,v 1.1 2021/01/02 10:22:43 rillig Exp $	*/
+/*	$NetBSD: msg_124.c,v 1.2 2021/01/03 15:44:35 rillig Exp $	*/
 # 3 "msg_124.c"
 
 // Test for message: illegal pointer combination, op %s [124]
 
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+typedef void(*signal_handler)(int);
+
+typedef signal_handler(*sys_signal)(signal_handler);
+
+typedef int(*printflike)(const char *, ...)
+    __attribute__((format(printf, 1, 2)));
+
+void
+example(int *ptr)
+{
+	signal_handler handler = ptr;
+	sys_signal signal = ptr;
+	printflike printf = ptr;
+}
Index: src/tests/usr.bin/xlint/lint1/msg_124.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_124.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_124.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_124.exp:1.1	Sat Jan  2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_124.exp	Sun Jan  3 15:44:35 2021
@@ -1 +1,3 @@
-msg_124.c(6): syntax error ':' [249]
+msg_124.c(16): warning: illegal pointer combination, op p = p [124]
+msg_124.c(17): warning: illegal pointer combination, op p = p [124]
+msg_124.c(18): warning: illegal pointer combination, op p = p [124]

Reply via email to