aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLinus Torvalds <torvalds@penguin.transmeta.com>2003-04-01 20:09:24 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:00:02 -0700
commit01b7c455c98d5da1bc16b8918225df6901da749d (patch)
tree70296d475073747d29a05c1c890db2732e2148cd
parent2823bff27b1ad4bc42f29163fc0d2711fdb0990f (diff)
downloadsparse-dev-01b7c455c98d5da1bc16b8918225df6901da749d.tar.gz
Get closer to actually looking at type attributes.
-rw-r--r--parse.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/parse.c b/parse.c
index bd158b77..898bd647 100644
--- a/parse.c
+++ b/parse.c
@@ -158,28 +158,36 @@ struct token *typeof_specifier(struct token *token, struct ctype *ctype)
return expect(token, ')', "after typeof");
}
-struct token *attribute_specifier(struct token *token, struct ctype *ctype)
+static void handle_attribute(struct ctype *ctype, struct ident *attribute, struct expression *expr)
{
- int parens = 0;
+ fprintf(stderr, "saw attribute '%s'\n", show_ident(attribute));
+}
+
+struct token *attribute_specifier(struct token *token, struct ctype *ctype)
+{
token = expect(token, '(', "after attribute");
token = expect(token, '(', "after attribute");
- for (;;token = token->next) {
+ for (;;) {
+ struct ident *attribute_name;
+ struct expression *attribute_expr;
+
if (eof_token(token))
break;
if (match_op(token, ';'))
break;
- if (match_op(token, ')')) {
- if (!parens)
- break;
- parens--;
- continue;
- }
- if (match_op(token, '(')) {
- parens++;
- continue;
- }
+ if (token_type(token) != TOKEN_IDENT)
+ break;
+ attribute_name = token->ident;
+ token = token->next;
+ attribute_expr = NULL;
+ if (match_op(token, '('))
+ token = parens_expression(token, &attribute_expr, "in attribute");
+ handle_attribute(ctype, attribute_name, attribute_expr);
+ if (!match_op(token, ','))
+ break;
+ token = token->next;
}
token = expect(token, ')', "after attribute");