[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Get a token from char *

From: grischka
Subject: Re: [Tinycc-devel] Get a token from char *
Date: Tue, 08 Feb 2011 14:29:04 +0100
User-agent: Thunderbird (Windows/20090812)

Thomas Preud'homme wrote:
Hello all,

Is there a function to get the token from a supplied string, something whose prototype would be: int get_tok_from_str(char *str)? I made an improvement of my commit about assembly function label (commit 9b09fc3) but when I wanted to push it a conflict made me realize another attempt has been made which handle more pattern but just ignore label for the moment (cf commit 264a1036). This commit parse the asm label as 2 distincts string: one user defined and one "API". So I'd need to create a token for the concatenation in order to merge both code and do the redirection.

This might be a misunderstanding.  String concatenation is nothing
special with asm labels.  It is part of the normal C parsing rules:
    puts("1" "2" "3");
   int bar() asm ("foo_" "bar" "_9");
is eqivalent to
   int bar() asm ("foo_bar_9");

parse_asm_str already does that.

However I'm not sure that converting the asm label into a C token is
the right thing.  For example, tcc already can use "__bound_malloc"
instead of "malloc",  where "malloc" is the C token and "__bound_malloc"
is the elf-symbol name.

Btw. gnu asm labels can be used not only with functions but with data
as well:  http://gcc.gnu.org/onlinedocs/gcc-4.5.2/gcc/Asm-Labels.html

--- grischka

I looked at tccpp.c but no function is used to get a token, it's done inside a rather big function. Would it make sense to create a function for this? If so, I don't feel confortable to do it myself, could someone who knows this code well do it if it doesn't take too much time?

Best regards,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]