From c3e9659bfaac4b9718543a73ba8b64ec8cd7ea43 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 21 Nov 2005 17:08:47 -0500 Subject: [PATCH] [PATCH] new flag - -Wdecl Make "should it be static?" warnings conditional on a new flag (-Wdecl); default is to be quiet. Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- evaluate.c | 2 ++ lib.c | 2 ++ lib.h | 1 + 3 files changed, 5 insertions(+) diff --git a/evaluate.c b/evaluate.c index 272a4197..63e7d1bc 100644 --- a/evaluate.c +++ b/evaluate.c @@ -2395,6 +2395,8 @@ static void check_duplicates(struct symbol *sym) return; if (!(mod & MOD_TOPLEVEL)) return; + if (!Wdecl) + return; if (sym->ident == &main_ident) return; warning(sym->pos, "symbol '%s' was not declared. Should it be static?", show_ident(sym->ident)); diff --git a/lib.c b/lib.c index 8828e37c..afec1e6a 100644 --- a/lib.c +++ b/lib.c @@ -174,6 +174,7 @@ int Wcontext = 0; int Wundefined_preprocessor = 0; int Wptr_subtraction_blows = 0; int Wcast_to_address_space = 0; +int Wdecl = 0; int Wtransparent_union = 1; int preprocess_only; char *include; @@ -310,6 +311,7 @@ static const struct warning { int *flag; } warnings[] = { { "cast-to-as", &Wcast_to_address_space }, + { "decl", &Wdecl }, { "ptr-subtraction-blows", &Wptr_subtraction_blows }, { "default-bitfield-sign", &Wdefault_bitfield_sign }, { "undef", &Wundefined_preprocessor }, diff --git a/lib.h b/lib.h index 92cfdc41..e583d08f 100644 --- a/lib.h +++ b/lib.h @@ -78,6 +78,7 @@ extern int Wundefined_preprocessor; extern int Wbitwise, Wtypesign, Wcontext; extern int Wtransparent_union; extern int Wcast_to_address_space; +extern int Wdecl; extern void declare_builtin_functions(void); extern void create_builtin_stream(void); -- 2.11.4.GIT