Module Name: src
Committed By: rillig
Date: Mon Jul 12 18:00:36 UTC 2021
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_064.c msg_064.exp
Log Message:
tests/lint: test trying to define a ()-less function
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_064.c \
src/tests/usr.bin/xlint/lint1/msg_064.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_064.c
diff -u src/tests/usr.bin/xlint/lint1/msg_064.c:1.2 src/tests/usr.bin/xlint/lint1/msg_064.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_064.c:1.2 Sun Feb 21 09:07:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_064.c Mon Jul 12 18:00:36 2021
@@ -1,7 +1,16 @@
-/* $NetBSD: msg_064.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */
+/* $NetBSD: msg_064.c,v 1.3 2021/07/12 18:00:36 rillig Exp $ */
# 3 "msg_064.c"
// Test for message: ()-less function definition [64]
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+typedef int (function)(void);
+
+/*
+ * Even though typedef_function has type function, this construction is not
+ * allowed. A function definition must always look like a function
+ * definition, and that includes the parentheses for the arguments or
+ * parameters.
+ */
+function typedef_function {
+ /* expect-1: error: ()-less function definition [64] */
+}
Index: src/tests/usr.bin/xlint/lint1/msg_064.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_064.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_064.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_064.exp:1.2 Sun Mar 21 20:44:59 2021
+++ src/tests/usr.bin/xlint/lint1/msg_064.exp Mon Jul 12 18:00:36 2021
@@ -1 +1 @@
-msg_064.c(6): error: syntax error ':' [249]
+msg_064.c(14): error: ()-less function definition [64]