From: Alberto Bertogli <albertito@blitiri.com.ar>
To: linux-sparse@vger.kernel.org
Cc: sparse@chrisli.org, josh@kernel.org,
Alberto Bertogli <albertito@blitiri.com.ar>
Subject: [PATCH] Support the __thread storage class
Date: Sun, 26 Apr 2009 21:44:56 -0300 [thread overview]
Message-ID: <1240793096-23090-1-git-send-email-albertito@blitiri.com.ar> (raw)
GCC supports a __thread storage class, used to indicate thread-local
storage. It may be used alone, or with extern or static.
This patch makes sparse aware of it, but ignores it completely.
Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
---
parse.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/parse.c b/parse.c
index 14ae25d..e49cb39 100644
--- a/parse.c
+++ b/parse.c
@@ -41,7 +41,7 @@ static declarator_t
attribute_specifier, typeof_specifier, parse_asm_declarator,
typedef_specifier, inline_specifier, auto_specifier,
register_specifier, static_specifier, extern_specifier,
- const_qualifier, volatile_qualifier;
+ thread_specifier, const_qualifier, volatile_qualifier;
static struct token *parse_if_statement(struct token *token, struct statement *stmt);
static struct token *parse_return_statement(struct token *token, struct statement *stmt);
@@ -125,6 +125,11 @@ static struct symbol_op extern_op = {
.declarator = extern_specifier,
};
+static struct symbol_op thread_op = {
+ .type = KW_MODIFIER,
+ .declarator = thread_specifier,
+};
+
static struct symbol_op const_op = {
.type = KW_QUALIFIER,
.declarator = const_qualifier,
@@ -407,6 +412,7 @@ static struct init_keyword {
{ "register", NS_TYPEDEF, .op = ®ister_op },
{ "static", NS_TYPEDEF, .op = &static_op },
{ "extern", NS_TYPEDEF, .op = &extern_op },
+ { "__thread", NS_TYPEDEF, .op = &thread_op },
/* Statement */
{ "if", NS_KEYWORD, .op = &if_op },
@@ -1210,6 +1216,12 @@ static struct token *extern_specifier(struct token *next, struct decl_state *ctx
return next;
}
+static struct token *thread_specifier(struct token *next, struct decl_state *ctx)
+{
+ /* Ignore __thread */
+ return next;
+}
+
static struct token *attribute_force(struct token *token, struct symbol *attr, struct decl_state *ctx)
{
set_storage_class(&token->pos, ctx, SForced);
--
1.6.2.2.646.gb214
next reply other threads:[~2009-04-27 1:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-27 0:44 Alberto Bertogli [this message]
[not found] <70318cbf0904270020v78c98b7awee9ef64a6d60e14b@mail.gmail.com>
2009-05-16 15:36 ` [PATCH] Support the __thread storage class Alberto Bertogli
2009-05-19 10:00 ` Christopher Li
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=1240793096-23090-1-git-send-email-albertito@blitiri.com.ar \
--to=albertito@blitiri.com.ar \
--cc=josh@kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=sparse@chrisli.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).