tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] gcc/tcc nested macros difference


From: Edmund Grimley Evans
Subject: Re: [Tinycc-devel] gcc/tcc nested macros difference
Date: Sun, 24 Apr 2016 17:05:14 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

> then tcc output is OK. I used gcc 3.4.6 and 4.1.2 to test. May be new
> versions of the gcc behave like tcc.

The C standard has a somewhat unclear description of how the
preprocessor should work, but there is general agreement about what
was intended, and the general agreement leaves no real option for
alternative behaviour. Therefore, if two modern C compilers preprocess
differently, then one of them is buggy... I think it's TCC that is
buggy in this case. Has TCC always had this bug, or was it introduced
recently?

Simplified test case:

#define Y(x) Z(x)
#define X Y
X(X(foo))

Or:

#include <stdio.h>
int Z(int x) { return x + 1; }
#define Y(x) Z(x)
#define X Y
int main() { printf("%d\n", X(X(1))); return 0; }

Edmund



reply via email to

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