All of lore.kernel.org
 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] Sparse fooled by double semicolon
Date: Tue, 30 Jan 2007 22:58:38 -0800	[thread overview]
Message-ID: <20070131065838.GA23326@chrisli.org> (raw)
In-Reply-To: <1170219027.11455.68.camel@dv>

Good catch, can you please try the following patch?

Chris

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 creates a member with empty ctype. We should skip that.

Signed-Off-By: Christopher Li<spase@chrisli.org>

Index: sparse/parse.c
===================================================================
--- sparse.orig/parse.c	2007-01-29 14:46:09.000000000 -0800
+++ sparse/parse.c	2007-01-30 23:11:42.000000000 -0800
@@ -1039,7 +1039,8 @@ static struct token *struct_declaration_
 			sparse_error(token->pos, "expected ; at end of declaration");
 			break;
 		}
-		token = token->next;
+		while(match_op(token, ';'))
+			token = token->next;
 	}
 	return token;
 }

  reply	other threads:[~2007-01-31  7:24 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 ` Christopher Li [this message]
2007-01-31  7:17   ` [PATCH](take II) " Christopher Li
2007-01-31  7:46     ` 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=20070131065838.GA23326@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.