libfirm / cparser

C99 parser and frontend for libfirm
http://pp.ipd.kit.edu/firm
GNU General Public License v2.0
336 stars 38 forks source link

Incorrect double-expansion of renamed macro #53

Open ludocode opened 3 years ago

ludocode commented 3 years ago
#define foo(x) x
#define bar foo

int main(void) {
    return bar(bar(0));
}

This fails under cparser 8ec1a761bf62be1028632e5eceda425d9fbeb039 with warning "implicit declaration of function 'foo'" and linker error "undefined reference to `foo'".

It compiles correctly under GCC 10.2.0, Clang 10.0.1, MSVC 19.27.29111 and TinyCC 0.9.27. It also compiles correctly with cparser if you replace #define bar foo with #define bar(x) foo(x).