Skip to contentSkip to conversation

Fix an __attribute__() parsing error

PATCH Applied Ramsay Jones 3 participants 5 messages May 22, 2007 – May 24, 2007 Sparse checker

lore
Share & tools
lore
#0 lore raw

PATCH 4/5 Fix an __attribute__() parsing error

---

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(-)
parse.c +4 -1
index db5c9e6..16a6dce 100644
@@ -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;
Signature · 1 line
1.5.1

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

void set_FP(void *cb, FP f);

#1 lore raw
Quoted 4 lines · Ramsay Jones

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?

Correct; I don't think you can have an asm there.

Quoted 7 lines

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

Applied. I think you just made a Wine developer very happy. Michael, this patch fixes the test case you provided for Wine; I applied your patch for the new test case.

Thanks, Ramsay!

- Josh Triplett

#2 lore raw
Quoted 11 lines · Josh Triplett
Quoted 3 lines · Ramsay Jones

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?

Correct; I don't think you can have an asm there.

Quoted 4 lines

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

$cat ape.c

Quoted 7 lines
Quoted 3 lines

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

void set_FP(void *cb, FP f);

Applied. I think you just made a Wine developer very happy. Michael, this patch fixes the test case you provided for Wine; I applied your patch for the new test case.

Cool, thanks. Was just running a Wine build with cgcc when I have seen this so i've stopped it and run it again with the latest git checkout. And indeed it looks definitely better; the "error: too many errors" count went down from 1459 to 7.

Quoted 1 line

Thanks, Ramsay!

Thanks indeed.

bye
michael

Signature · 5 lines
Michael Stefaniuc               Tel.: +49-711-96437-199
Sr. Network Engineer            Fax.: +49-711-96437-111
Red Hat GmbH                    Email: [email protected]
Hauptstaetterstr. 58            http://www.redhat.de/
D-70178 Stuttgart
#3 lore raw
Quoted 6 lines · Michael Stefaniuc
Quoted 5 lines · Josh Triplett

Ramsay Jones wrote:

Applied. I think you just made a Wine developer very happy. Michael, this patch fixes the test case you provided for Wine; I applied your patch for the new test case.

Quoted 7 lines

Cool, thanks. Was just running a Wine build with cgcc when I have seen this so i've stopped it and run it again with the latest git checkout. And indeed it looks definitely better; the "error: too many errors" count went down from 1459 to 7.

Quoted 1 line

Thanks, Ramsay!

Thanks indeed.

My pleasure; glad to be of help.

All the Best,

Ramsay Jones

#4 lore raw
In reply to Josh Triplett
Quoted 7 lines · Josh Triplett
Quoted 3 lines · Ramsay Jones

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?

Correct; I don't think you can have an asm there.

OK, good.

Quoted 6 lines
Quoted 6 lines

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

Quoted 8 lines
Quoted 1 line

void set_FP(void *cb, FP f);

Applied. I think you just made a Wine developer very happy. Michael, this patch fixes the test case you provided for Wine; I applied your patch for the new test case.

Thanks, Ramsay!

My pleasure.

ATB,
Ramsay Jones