[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [Tinycc-devel] macro expansion bug

**From**: |
Vincent Lefevre |

**Subject**: |
Re: [Tinycc-devel] macro expansion bug |

**Date**: |
Wed, 2 Apr 2014 16:58:21 +0200 |

**User-agent**: |
Mutt/1.5.21-6305-vl-r59709 (2013-04-16) |

On 2014-04-02 14:46:36 +0100, Jay Foad wrote:
>* With tcc I get:*
>* *
>* $ cat cat.c*
>* #define CAT2(a,b) a##b*
>* #define CAT(a,b) CAT2(a,b)*
>* #define AB(x) CAT(x,y)*
>* CAT(A,B)(x)*
>* $ ./tcc -E cat.c*
>* # 2 "cat.c"*
>* *
>* *
>* CAT(x,y)*
>* *
>* But I think this is wrong, because gcc -E and clang -E both expand the*
>* last line further to give just:*
>* *
>* xy*
For future testcases, this means that this wouldn't be equivalent to:
#define CAT2(a,b) a##b(x)
#define CAT(a,b) CAT2(a,b)
#define AB(x) CAT(x,y)
CAT(A,B)
and
#define CAT2(a,b) a##b
#define CAT(a,b) CAT2(a,b)(x)
#define AB(x) CAT(x,y)
CAT(A,B)
which both give:
CAT(x,y)
for the last line.
FYI, icc (ICC) 13.1.0 20130121 behaves like gcc.
--
Vincent LefĂ¨vre <address@hidden> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)