[Top][All Lists]

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

Re: [Tinycc-devel] Preprocessor bug prevents macro expansion

From: grischka
Subject: Re: [Tinycc-devel] Preprocessor bug prevents macro expansion
Date: Fri, 29 Jan 2010 23:53:41 +0100
User-agent: Thunderbird (Windows/20090812)

Alexandre Becoulet wrote:
Current implementation relies on a single nested tokens list to prevent recursive expansion. It appears some bugs can not be fixed without storing some context for each expanded token.

Yeah, basically the macro expansion behavior is designed by the
interaction of these five macro_xxx_xxx functions, but I once came
to the conclusion that this (more or less implicit) design is
probably not really suited to produce correct behavior under any

That does not mean that it needs to be more complex necessarily,
but it seems that it needs to be different, somehow.  Looking
into other preprocessor implementations (gcc, pcc, lcc, ...) might
give some ideas.

While trying to feed tcc with output from the GNU preprocessor I fixed this trivial bug:

Please push patches on our "mob" branch ;)

--- grischka

--- a/tccpp.c
+++ b/tccpp.c
@@ -1620,7 +1620,7 @@ include_done:
-        if (tok == TOK_LINEFEED || tok == '!' || tok == TOK_CINT) {
+        if (tok == TOK_LINEFEED || tok == '!' || tok == TOK_PPNUM) {
             /* '!' is ignored to allow C scripts. numbers are ignored
                to emulate cpp behaviour */
         } else {

reply via email to

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