[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] [PATCH] GNU __attribute__ extension handling with parenth
From: |
Marc Andre Tanner |
Subject: |
[Tinycc-devel] [PATCH] GNU __attribute__ extension handling with parenthesis |
Date: |
Tue, 25 Sep 2007 12:15:05 +0200 |
User-agent: |
Thunderbird 2.0.0.6 (Windows/20070728) |
Hi,
Attached is another patch which tries to improve the __attribute__
handling. Currently tcc is confused by parenthesis within the attribute
definition.
cat > bug.c << EOF
void warn ( const char * format , ... )
__attribute__ ( ( format ( printf , ( 1 ) , ( 2 ) ) ) ) ;
EOF
$ tcc -c bug.c
bug-attribute.c:2: attribute name expected
$ gcc -c bug.c
Thanks,
Marc
--
Marc Andre Tanner >< http://www.brain-dump.org/ >< GPG key: CF7D56C0
diff -r a62ad123624a tcc.c
--- a/tcc.c Sat Sep 22 04:39:52 2007 -0500
+++ b/tcc.c Mon Sep 24 23:35:01 2007 +0200
@@ -5661,12 +5661,16 @@ static void parse_attribute(AttributeDef
if (tcc_state->warn_unsupported)
warning("'%s' attribute ignored", get_tok_str(t, NULL));
/* skip parameters */
- /* XXX: skip parenthesis too */
if (tok == '(') {
next();
- while (tok != ')' && tok != -1)
+ int parenthesis; parenthesis = 1;
+ while (parenthesis > 0 && tok != -1) {
+ if(tok == '(')
+ parenthesis++;
+ else if(tok == ')')
+ parenthesis--;
next();
- next();
+ }
}
break;
}
- [Tinycc-devel] [PATCH] GNU __attribute__ extension handling with parenthesis,
Marc Andre Tanner <=