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: test trying to define ...



details:   https://anonhg.NetBSD.org/src/rev/424bc8651950
branches:  trunk
changeset: 984590:424bc8651950
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Jul 12 18:00:36 2021 +0000

description:
tests/lint: test trying to define a ()-less function

diffstat:

 tests/usr.bin/xlint/lint1/msg_064.c   |  15 ++++++++++++---
 tests/usr.bin/xlint/lint1/msg_064.exp |   2 +-
 2 files changed, 13 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 5331ce94e6e3 -r 424bc8651950 tests/usr.bin/xlint/lint1/msg_064.c
--- a/tests/usr.bin/xlint/lint1/msg_064.c       Mon Jul 12 16:44:52 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_064.c       Mon Jul 12 18:00:36 2021 +0000
@@ -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] */
+}
diff -r 5331ce94e6e3 -r 424bc8651950 tests/usr.bin/xlint/lint1/msg_064.exp
--- a/tests/usr.bin/xlint/lint1/msg_064.exp     Mon Jul 12 16:44:52 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_064.exp     Mon Jul 12 18:00:36 2021 +0000
@@ -1,1 +1,1 @@
-msg_064.c(6): error: syntax error ':' [249]
+msg_064.c(14): error: ()-less function definition [64]



Home | Main Index | Thread Index | Old Index