[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] Macro substitution woes
From: |
Peter \"Firefly\" Lund |
Subject: |
[Tinycc-devel] Macro substitution woes |
Date: |
Fri, 7 Mar 2003 02:48:45 +0100 (MET) |
I haven't written any code yet to dump the symbol tables. Instead I read
the code -- it builds even more character than writing debug code.
/* return next token with macro substitution */
static void next(void)
{
Sym *nested_list, *s;
TokenString str;
redo:
next_nomacro();
if (!macro_ptr) {
/* if not reading from macro substituted string, then try
to substitute macros */
...
this is what goes wrong with the short program I posted a couple of hours
ago (originally discovered by Philippe Ribet).
We probably don't want anything like this to loop:
#define a b
#define b a
a
I'll have to think about what the proper patch would be -- and also look
at the (draft) ISO C99 spec. Sigh.
-Peter
PS: I like your "token string" thing for macro expansion, Fabrice :)
Wish I had thought of that. Would you mind a lot if I renamed some of
the functions, though, to make it clear which ones use a CValue and
which don't?
"Of course, I'm not unbiased, but in my humble opinion, I've
gotten close to something that I can be really proud of."
-- Knuth on The Art of Computer Programming.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Tinycc-devel] Macro substitution woes,
Peter \"Firefly\" Lund <=