aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2009-02-14 12:25:55 +0000
committerChristopher Li <sparse@chrisli.org>2009-07-17 23:06:23 +0000
commitef5501aa2a87a5f02b426ff4150048c46048d829 (patch)
tree6cb7ec69d7b4ad0c916fdd6108a6ca3c322f0ba3 /parse.c
parentmore direct_declarator() sanitizing (diff)
downloadsparse-ef5501aa2a87a5f02b426ff4150048c46048d829.tar.gz
sparse-ef5501aa2a87a5f02b426ff4150048c46048d829.tar.bz2
sparse-ef5501aa2a87a5f02b426ff4150048c46048d829.zip
Warn about non-empty identifier list outside of definition
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Christopher Li <sparse@chrisli.org>
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/parse.c b/parse.c
index 483e835..d5ea0bd 100644
--- a/parse.c
+++ b/parse.c
@@ -1196,8 +1196,16 @@ static enum kind which_kind(struct token *token, struct token **p,
if (token_type(next) == TOKEN_IDENT) {
if (lookup_type(next))
return (dont_nest || prefer_abstract) ? Proto : Nested;
- if (dont_nest)
- return (next == token->next) ? K_R : Bad_Func;
+ if (dont_nest) {
+ /* attributes in the K&R identifier list */
+ if (next != token->next)
+ return Bad_Func;
+ /* identifier list not in definition; complain */
+ if (prefer_abstract)
+ warning(token->pos,
+ "identifier list not in definition");
+ return K_R;
+ }
return Nested;
}