From: Rob Taylor <rob.taylor@codethink.co.uk>
To: Thomas Schmid <Thomas.Schmid@br-automation.com>
Cc: linux-sparse@vger.kernel.org, Pavel Roskin <proski@gnu.org>,
Josh Triplett <josht@linux.vnet.ibm.com>
Subject: Re: Antwort: Re: Finding all typedefs
Date: Fri, 03 Aug 2007 01:49:19 +0100 [thread overview]
Message-ID: <46B27B8F.2040008@codethink.co.uk> (raw)
In-Reply-To: <OF8B0579A2.47A003A7-ONC125732B.00280B65-C125732B.00295803@br-automation.com>
[-- Attachment #1: Type: text/plain, Size: 1069 bytes --]
Thomas Schmid wrote:
> linux-sparse-owner@vger.kernel.org schrieb am 02.08.2007 02:15:34:
>
>> Another annoying thing is that the types are always resolved for
>> typedefs. i.e. for
>>
>> typedef int foo;
>> foo bar;
>>
>> the symbol for bar has a base type of int.
>
> ...and a base_type->ident named "foo". But if you add another typedef on
> "int", i.e.
>
> typedef int DINT;
>
> base_type->ident changes to "DINT", now there's no way to get out, that
> symbol "bar" was declared with "foo".
> Tell me if I'm wrong, but a solution for this would also help me on that:
> http://marc.info/?l=linux-sparse&m=118171213001092&w=2
>
>> Any suggestions for how to solve this would be greatly appreciated :)
> I agree! ;-)
Ok, I've hacked up a little patch that does a small bit of the job
(attached), but this breaks comparisons to abstract types (and probably
a whole load more besides). I'll carry on hacking this some more and see
if I can sort those issues, but I'd greatly appreciate some input from
anyone with deeper knowledge!
Thanks,
Rob Taylor
[-- Attachment #2: 0001-cracked-ideas-to-track-user-types.patch --]
[-- Type: text/x-patch, Size: 1595 bytes --]
From 06cae878ce87d71bb5c827c4e8df7f3e5a1df40f Mon Sep 17 00:00:00 2001
From: Rob Taylor <rob.taylor@codethink.co.uk>
Date: Fri, 3 Aug 2007 01:37:58 +0100
Subject: [PATCH] cracked ideas to track user types.
---
c2xml.c | 6 ++++--
parse.c | 7 +++++--
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/c2xml.c b/c2xml.c
index 37f29cf..42f059e 100644
--- a/c2xml.c
+++ b/c2xml.c
@@ -166,8 +166,6 @@ static void examine_symbol(struct symbol *sym, xmlNodePtr node)
return;
child = new_sym_node(sym, get_type_name(sym->type), node);
- examine_modifiers(sym, child);
- examine_layout(sym, child);
if (sym->ctype.base_type) {
if ((base = builtin_typename(sym->ctype.base_type)) == NULL) {
@@ -199,6 +197,10 @@ static void examine_symbol(struct symbol *sym, xmlNodePtr node)
newProp(child, "base-type-builtin", builtin_typename(sym));
break;
}
+
+ examine_modifiers(sym, child);
+ examine_layout(sym, child);
+
return;
}
diff --git a/parse.c b/parse.c
index f452042..1ac7586 100644
--- a/parse.c
+++ b/parse.c
@@ -1101,12 +1101,15 @@ static struct token *declaration_specifiers(struct token *next, struct ctype *ct
break;
if (ctype->base_type)
break;
- /* User types only mix with qualifiers */
if (mod & MOD_USERTYPE) {
+ /* User types only mix with qualifiers */
if (ctype->modifiers & MOD_SPECIFIER)
break;
+ /* Point to the user type */
+ ctype->base_type = s;
}
- ctype->base_type = type;
+ else
+ ctype->base_type = type;
}
check_modifiers(&token->pos, s, ctype->modifiers);
--
1.5.3.GIT
prev parent reply other threads:[~2007-08-03 0:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-27 22:08 Finding all typedefs Pavel Roskin
2007-07-27 23:01 ` Randy Dunlap
2007-08-01 15:45 ` Pavel Roskin
2007-08-01 17:01 ` Josh Triplett
2007-08-02 0:15 ` Rob Taylor
2007-08-02 7:31 ` Antwort: " Thomas Schmid
2007-08-03 0:49 ` Rob Taylor [this message]
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=46B27B8F.2040008@codethink.co.uk \
--to=rob.taylor@codethink.co.uk \
--cc=Thomas.Schmid@br-automation.com \
--cc=josht@linux.vnet.ibm.com \
--cc=linux-sparse@vger.kernel.org \
--cc=proski@gnu.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.