diff options
| author | John Levon <levon@movementarian.org> | 2018-11-29 10:42:51 +0000 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-12-01 02:16:24 +0100 |
| commit | 648380c13ecaaa95c9dfbd500039cd9007ec3c20 (patch) | |
| tree | 3e6d634f8549a13d97bdbe0fba39aed97364eb9c /parse.c | |
| parent | a0f34e0fd2a44016ef668e19187a342c5f4edf45 (diff) | |
| download | sparse-dev-648380c13ecaaa95c9dfbd500039cd9007ec3c20.tar.gz | |
Conditionalize 'warning: non-ANSI function ...'
Sparse unconditionally issues warnings about non-ANSI function
declarations & definitions.
However, some environments have large amounts of legacy headers
that are pre-ANSI, and can't easily be changed. These generate
a lot of useless warnings.
Fix this by using the options flags -Wstrict-prototypes &
-Wold-style-definition to conditionalize these warnings.
Signed-off-by: John Levon <levon@movementarian.org>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'parse.c')
| -rw-r--r-- | parse.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -1752,9 +1752,10 @@ static enum kind which_func(struct token *token, /* don't complain about those */ if (!n || match_op(next->next, ';') || match_op(next->next, ',')) return Empty; - warning(next->pos, - "non-ANSI function declaration of function '%s'", - show_ident(*n)); + if (Wstrict_prototypes) + warning(next->pos, + "non-ANSI function declaration of function '%s'", + show_ident(*n)); return Empty; } @@ -2797,7 +2798,9 @@ static struct token *parse_k_r_arguments(struct token *token, struct symbol *dec { struct symbol_list *args = NULL; - warning(token->pos, "non-ANSI definition of function '%s'", show_ident(decl->ident)); + if (Wold_style_definition) + warning(token->pos, "non-ANSI definition of function '%s'", show_ident(decl->ident)); + do { token = declaration_list(token, &args); if (!match_op(token, ';')) { |
