linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christopher Li <sparse@chrisli.org>
To: Pavel Roskin <proski@gnu.org>
Cc: linux-sparse@vger.kernel.org, Josh Triplett <josh@freedesktop.org>
Subject: Re: [PATCH](take II) Sparse fooled by double semicolon
Date: Tue, 30 Jan 2007 23:17:17 -0800	[thread overview]
Message-ID: <20070131071717.GA23495@chrisli.org> (raw)
In-Reply-To: <20070131065838.GA23326@chrisli.org>

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<spase@chrisli.org>

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;

  reply	other threads:[~2007-01-31  7:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-31  4:50 Sparse fooled by double semicolon Pavel Roskin
2007-01-31  6:58 ` [PATCH] " Christopher Li
2007-01-31  7:17   ` Christopher Li [this message]
2007-01-31  7:46     ` [PATCH](take II) " Pavel Roskin
2007-02-23  3:43     ` Josh Triplett
2007-01-31  7:43   ` [PATCH] " Pavel Roskin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070131071717.GA23495@chrisli.org \
    --to=sparse@chrisli.org \
    --cc=josh@freedesktop.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=proski@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).