summaryrefslogtreecommitdiff
path: root/usr.bin/xlint/lint1/cgram.y
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2023-07-07 19:45:22 +0000
committerrillig <rillig@NetBSD.org>2023-07-07 19:45:22 +0000
commit4175df945b048e5aeed932baf36d22ba89310121 (patch)
treeb9af2533f06e958404f3ad74e19b5786aa20dc89 /usr.bin/xlint/lint1/cgram.y
parentf0b07974431e15088bc38f5695ef7c1f9da599f8 (diff)
lint: warn about function definitions without header declaration
The existing warning was only issued for function declarations, not for function definitions. The interesting change in the tests is in msg_351.c. Many other tests use non-static functions due to their syntactic brevity. In these tests, the warning is disabled individually, to allow new functions to be added without generating warning 351.
Diffstat (limited to 'usr.bin/xlint/lint1/cgram.y')
-rw-r--r--usr.bin/xlint/lint1/cgram.y5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/xlint/lint1/cgram.y b/usr.bin/xlint/lint1/cgram.y
index 257de50c2fc..fbc85191f5f 100644
--- a/usr.bin/xlint/lint1/cgram.y
+++ b/usr.bin/xlint/lint1/cgram.y
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: cgram.y,v 1.446 2023/07/02 23:40:23 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.447 2023/07/07 19:45:22 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: cgram.y,v 1.446 2023/07/02 23:40:23 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.447 2023/07/07 19:45:22 rillig Exp $");
#endif
#include <limits.h>
@@ -1970,6 +1970,7 @@ function_definition: /* C99 6.9.1 */
error(64);
YYERROR;
}
+ check_extern_declaration($1);
begin_function($1);
block_level++;
begin_declaration_level(DLK_OLD_STYLE_ARGS);