From: Christopher Li <sparse@chrisli.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Yura Pakhuchiy <pakhuchiy@gmail.com>,
Josh Triplett <josh@freedesktop.org>,
linux-sparse@vger.kernel.org
Subject: [PATCH][RFC] Re: sparse handles int64_t type wrong
Date: Tue, 12 Dec 2006 21:18:27 -0800 [thread overview]
Message-ID: <20061213051827.GA13748@chrisli.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0612121155450.3535@woody.osdl.org>
I took a stab at it. It seems that direct_declarator() does handle
attributes, but it does not change the ctype to the declarator.
It is kind of awkward that the type is already build when it hit
the attribute in the end. It need to go back to overwrite
the already parsed type.
I have this patch seems make the test case happy. I am not sure
this is correct or not.
Chris
Index: sparse/parse.c
===================================================================
--- sparse.orig/parse.c 2006-12-12 21:12:29.000000000 -0800
+++ sparse/parse.c 2006-12-12 21:12:47.000000000 -0800
@@ -837,6 +837,10 @@ static struct token *handle_attributes(s
struct ctype thistype = { 0, };
token = attribute_specifier(token->next, &thistype);
apply_ctype(token->pos, &thistype, ctype);
+ if (is_int_type(ctype->base_type) && ctype->modifiers & MOD_SPECIFIER) {
+ ctype->base_type = ctype_integer(ctype->modifiers);
+ ctype->modifiers &= ~MOD_SPECIFIER;
+ }
continue;
}
if (match_idents(token, &asm_ident, &__asm_ident, &__asm___ident)) {
Index: sparse/show-parse.c
===================================================================
--- sparse.orig/show-parse.c 2006-12-12 21:12:29.000000000 -0800
+++ sparse/show-parse.c 2006-12-12 21:12:47.000000000 -0800
@@ -98,7 +98,7 @@ const char *modifier_string(unsigned lon
const char *res,**ptr, *names[] = {
"auto", "register", "static", "extern",
"const", "volatile", "[signed]", "[unsigned]",
- "[char]", "[short]", "[long]", "[long]",
+ "[char]", "[short]", "[long]", "[long long]",
"[typdef]", "[structof]", "[unionof]", "[enum]",
"[typeof]", "[attribute]", "inline", "[addressable]",
"[nocast]", "[noderef]", "[accessed]", "[toplevel]",
Index: sparse/test-parsing.c
===================================================================
next prev parent reply other threads:[~2006-12-13 5:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-12 19:34 sparse handles int64_t type wrong Yura Pakhuchiy
2006-12-12 19:44 ` Linus Torvalds
2006-12-12 19:50 ` Yura Pakhuchiy
2006-12-12 20:02 ` Linus Torvalds
2006-12-12 20:25 ` Yura Pakhuchiy
2006-12-13 5:18 ` Christopher Li [this message]
2006-12-13 15:36 ` [PATCH][RFC] " Linus Torvalds
2006-12-14 0:13 ` Christopher Li
2006-12-14 0:57 ` Linus Torvalds
2006-12-14 4:21 ` 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=20061213051827.GA13748@chrisli.org \
--to=sparse@chrisli.org \
--cc=josh@freedesktop.org \
--cc=linux-sparse@vger.kernel.org \
--cc=pakhuchiy@gmail.com \
--cc=torvalds@osdl.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).