Skip to content

Commit

Permalink
tests/lint: test trying to define a ()-less function
Browse files Browse the repository at this point in the history
  • Loading branch information
rillig committed Jul 12, 2021
1 parent d0daec1 commit 8a128c8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions tests/usr.bin/xlint/lint1/msg_064.c
Original file line number Diff line number Diff line change
@@ -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] */
}
2 changes: 1 addition & 1 deletion tests/usr.bin/xlint/lint1/msg_064.exp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
msg_064.c(6): error: syntax error ':' [249]
msg_064.c(14): error: ()-less function definition [64]

0 comments on commit 8a128c8

Please sign in to comment.