Actually, this version is better because it handle semicolon
as the first member as well.

Fix double semicolon in struct declare

Pavel discover this test case:
#include <string.h>
void test(void)
{
       struct { int foo;; } val;
       memset(&val, 0, sizeof(val));
}

Sparse ends up create a node with empty ctype in the member list.
Skip that seems fix it.

Signed-Off-By: Christopher Li<[EMAIL PROTECTED]>

Index: sparse/parse.c
===================================================================
--- sparse.orig/parse.c 2007-01-30 23:28:24.000000000 -0800
+++ sparse/parse.c      2007-01-30 23:34:21.000000000 -0800
@@ -1034,7 +1034,8 @@ static struct token *declaration_list(st
 static struct token *struct_declaration_list(struct token *token, struct 
symbol_list **list)
 {
        while (!match_op(token, '}')) {
-               token = declaration_list(token, list);
+               if (!match_op(token, ';'))
+                       token = declaration_list(token, list);
                if (!match_op(token, ';')) {
                        sparse_error(token->pos, "expected ; at end of 
declaration");
                        break;
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to