aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/expression.c
diff options
authorLinus Torvalds <torvalds@penguin.transmeta.com>2003-05-23 17:41:39 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:00:45 -0700
commita10932174ca47672bc8f62a5b98fbcfb34ee534b (patch)
tree7365f1793fd1f1f23db7de1704aeb0dbce372da1 /expression.c
parente5b62a635d5a9d7b5da58922086bb3c9570eb36c (diff)
downloadsparse-dev-a10932174ca47672bc8f62a5b98fbcfb34ee534b.tar.gz
Parse and evaluate gcc computed goto extensions: label addressing
(&&label) and computed goto (goto *expr). Add label ctype for __label__ identifier. This is still quite broken (it should create a block-symbol in the NS_LABEL namespace, right now it creates a regular symbol).
Diffstat (limited to 'expression.c')
-rw-r--r--expression.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/expression.c b/expression.c
index 6e8cddf7..149eb992 100644
--- a/expression.c
+++ b/expression.c
@@ -326,6 +326,16 @@ static struct token *unary_expression(struct token *token, struct expression **t
*tree = unary;
return cast_expression(token->next, &unary->unop);
}
+
+ /* Gcc extension: &&label gives the address of a label */
+ if (match_op(token, SPECIAL_LOGICAL_AND) &&
+ token_type(token->next) == TOKEN_IDENT) {
+ struct expression *label = alloc_expression(token->pos, EXPR_LABEL);
+ label->label_symbol = label_symbol(token->next);
+ *tree = label;
+ return token->next->next;
+ }
+
}
return postfix_expression(token, tree);