linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/5] Fix an __attribute__() parsing error
@ 2007-05-22 18:11 Ramsay Jones
  2007-05-22 22:37 ` Josh Triplett
  0 siblings, 1 reply; 5+ messages in thread
From: Ramsay Jones @ 2007-05-22 18:11 UTC (permalink / raw)
  To: Josh Triplett; +Cc: Sparse Mailing-list

[-- 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);


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-05-24 17:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-22 18:11 [PATCH 4/5] Fix an __attribute__() parsing error Ramsay Jones
2007-05-22 22:37 ` Josh Triplett
2007-05-22 23:17   ` Michael Stefaniuc
2007-05-24 17:07     ` Ramsay Jones
2007-05-24 15:27   ` Ramsay Jones

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).