summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-11-30 01:00:34 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-12-01 02:15:21 +0100
commita0f34e0fd2a44016ef668e19187a342c5f4edf45 (patch)
tree2d093ada46ae6aaf57a79b5cd15f3d0f329d73c4
parenteb35b2e8aa79552fe0ccd7a4e7a7753b230cbdd4 (diff)
downloadsparse-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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/parse.c b/parse.c
index ec145601..eaa3ac2e 100644
--- a/parse.c
+++ b/parse.c
@@ -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'",