diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-11-30 01:00:34 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-12-01 02:15:21 +0100 |
commit | a0f34e0fd2a44016ef668e19187a342c5f4edf45 (patch) | |
tree | 2d093ada46ae6aaf57a79b5cd15f3d0f329d73c4 | |
parent | eb35b2e8aa79552fe0ccd7a4e7a7753b230cbdd4 (diff) | |
download | sparse-a0f34e0fd2a44016ef668e19187a342c5f4edf45.tar.gz |
Accept comma-separated list for function declarations.
The declaration of a function without prototype is currently
silently accepted by sparse but a warning is issued for
'old-style' declarations:
... warning: non-ANSI function declaration ...
However, the difference between these two cases is made by
checking if a ';' directly follow the parentheses. So:
int foo();
is silently accepted, while a warning is issued for:
int foo(a) int a;
but also for:
int foo(), bar();
This last case, while unusual, is not less ANSI than a simple
'int foo();'. It's just detected so because there is no ';'
directly after the first '()'.
Fix this by also using ',' to detect the end of function
declarations and their ANSIness.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | parse.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1750,7 +1750,7 @@ static enum kind which_func(struct token *token, if (next->special == ')') { /* don't complain about those */ - if (!n || match_op(next->next, ';')) + if (!n || match_op(next->next, ';') || match_op(next->next, ',')) return Empty; warning(next->pos, "non-ANSI function declaration of function '%s'", |