All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
To: Josh Triplett <josh@freedesktop.org>
Cc: Sparse Mailing-list <linux-sparse@vger.kernel.org>
Subject: [PATCH 4/5] Fix an __attribute__() parsing error
Date: Tue, 22 May 2007 19:11:47 +0100	[thread overview]
Message-ID: <46533263.3010108@ramsay1.demon.co.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 1120 bytes --]



Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---

When updating this patch from the 0.3 version, I made the (new) third parameter
KW_ATTRIBUTE only, rather than (KW_ATTRIBUTE | KW_ASM), since it did not seem
correct to allow an asm there; is that correct?

The test case for this was abstracted from an example in the "expat.h" header file.

$cat ape.c

typedef void (__attribute__((__cdecl__)) *FP)(void *u, const char *n);

void set_FP(void *cb, FP f);

$

  parse.c |    5 ++++-
  1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/parse.c b/parse.c
index db5c9e6..16a6dce 100644
--- a/parse.c
+++ b/parse.c
@@ -1149,7 +1149,10 @@ static struct token *direct_declarator(struct token *token, struct symbol *decl,
  		if (token->special == '(') {
  			struct symbol *sym;
  			struct token *next = token->next;
-			int fn = (p && *p) || match_op(next, ')') || lookup_type(next);
+			int fn;
+
+			next = handle_attributes(next, ctype, KW_ATTRIBUTE);
+			fn = (p && *p) || match_op(next, ')') || lookup_type(next);

  			if (!fn) {
  				struct symbol *base_type = ctype->base_type;
-- 
1.5.1


[-- Attachment #2: ape.c --]
[-- Type: text/plain, Size: 103 bytes --]


typedef void (__attribute__((__cdecl__)) *FP)(void *u, const char *n);

void set_FP(void *cb, FP f);


             reply	other threads:[~2007-05-22 19:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-22 18:11 Ramsay Jones [this message]
2007-05-22 22:37 ` [PATCH 4/5] Fix an __attribute__() parsing error Josh Triplett
2007-05-22 23:17   ` Michael Stefaniuc
2007-05-24 17:07     ` Ramsay Jones
2007-05-24 15:27   ` Ramsay Jones

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=46533263.3010108@ramsay1.demon.co.uk \
    --to=ramsay@ramsay1.demon.co.uk \
    --cc=josh@freedesktop.org \
    --cc=linux-sparse@vger.kernel.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.