From: Nicolai Stange <nicstange@gmail.com>
To: linux-sparse@vger.kernel.org
Subject: [PATCH RFC 08/13] expression: recognize references to labels as address constants
Date: Thu, 23 Jul 2015 01:20:04 +0200 [thread overview]
Message-ID: <87wpxrixuj.fsf@gmail.com> (raw)
As an extension, GCC allows labels to be referenced a la
label1:
...
void *ptr = &&label1;
Tag these label references as being address constants allowing them
to be used as initializers for objects of static storage duration.
Signed-off-by: Nicolai Stange <nicstange@gmail.com>
---
expression.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/expression.c b/expression.c
index 4d5edc8..19786e8 100644
--- a/expression.c
+++ b/expression.c
@@ -684,6 +684,8 @@ static struct token *unary_expression(struct token *token, struct expression **t
sym->ctype.modifiers |= MOD_ADDRESSABLE;
add_symbol(&function_computed_target_list, sym);
}
+ label->flags |=
+ expr_set_flag_mask(EXPR_FLAG_ADDR_CONST_EXPR);
label->label_symbol = sym;
*tree = label;
return token->next->next;
--
2.4.5
reply other threads:[~2015-07-22 23:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wpxrixuj.fsf@gmail.com \
--to=nicstange@gmail.com \
--cc=linux-sparse@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.