linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christopher Li <sparse@chrisli.org>
To: Thomas Schmid <Thomas.Schmid@br-automation.com>
Cc: linux-sparse@vger.kernel.org
Subject: Re: Re: Getting info from used typedef
Date: Tue, 1 Dec 2009 10:49:18 -0800	[thread overview]
Message-ID: <70318cbf0912011049w4cab5e4qa74a15371511c8a4@mail.gmail.com> (raw)
In-Reply-To: <OFBC143B24.B977DCC6-ONC125767F.0037DE90-C125767F.0044B96C@br-automation.com>

[-- Attachment #1: Type: text/plain, Size: 907 bytes --]

On Tue, Dec 1, 2009 at 4:30 AM, Thomas Schmid
<Thomas.Schmid@br-automation.com> wrote:
> Of course: I wrote a tool, which converts C-declarations into another
> format (IEC61131).
> These generated declarations are used as a interface to communicate to
> programs of different languages.
> This IEC-format uses datatypes, which are not known in ANSI C, such as the
> following:
>
> typedef signed long    DINT;
> typedef unsigned long  UDINT;
> typedef signed long    TIME;
> typedef unsigned long  DATE_AND_TIME;
> typedef unsigned short UINT;
> typedef unsigned short WSTRING;
>

So you only use sparse as a C source code processing tool. You don't
care about the back end part of the sparse right?

In that case, you can try this one line patch. It should preserve the typedef
symbol as the base type. I will not commit that to main line though.

Will that work for you?

Chris

[-- Attachment #2: 0001-hacking-preserve-typedef-name.patch --]
[-- Type: application/octet-stream, Size: 710 bytes --]

From 6f1a577af7d9fa23c9070f278bdab02dbf8fb068 Mon Sep 17 00:00:00 2001
From: Christopher Li <sparse@chrisli.org>
Date: Tue, 1 Dec 2009 10:38:02 -0800
Subject: [PATCH] hacking preserve typedef name.

---
 parse.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/parse.c b/parse.c
index 66b8112..249135b 100644
--- a/parse.c
+++ b/parse.c
@@ -1429,7 +1429,7 @@ static struct token *declaration_specifiers(struct token *token, struct decl_sta
 			if (seen & Set_Any)
 				break;
 			seen |= Set_S | Set_T;
-			ctx->ctype.base_type = s->ctype.base_type;
+			ctx->ctype.base_type = s;
 			apply_ctype(token->pos, &s->ctype, &ctx->ctype);
 			token = token->next;
 			continue;
-- 
1.6.0.6


  reply	other threads:[~2009-12-01 18:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-30 21:34 Handle __builtin_ms_va_list Michael Stefaniuc
2009-10-01 18:41 ` Christopher Li
2009-11-25 14:15   ` Getting info from used typedef Thomas Schmid
2009-11-30 23:41     ` Christopher Li
2009-12-01 12:30       ` Antwort: " Thomas Schmid
2009-12-01 18:49         ` Christopher Li [this message]
2009-12-02 14:05           ` Thomas Schmid
2010-01-21  0:38             ` Christopher Li
2010-01-26 15:28               ` Thomas Schmid
2010-01-29  1:21                 ` Christopher Li
2010-02-02  8:52                   ` Thomas Schmid

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=70318cbf0912011049w4cab5e4qa74a15371511c8a4@mail.gmail.com \
    --to=sparse@chrisli.org \
    --cc=Thomas.Schmid@br-automation.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 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).