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

Bug#590008: cpp-4.4: incorrect macro expansion when a macro call results in the same macro being called



I guess what I'm trying to say is that a global replacement macro (like abc)
shouldn't depend on how the tokens came into existence, whether they were
typed in or the result of preprocessing.

Here's a variant of my original sample that works as expected:

   #define append_c(X) X##c
   #define prepend_a(X) a##X
   #define invoke1(a,b) a(b)
   #define aXc(X) invoke1(prepend_a,append_c(X))
   #define abc append_c(abb)

   int aXc(b) = 0; // appendc(ab) -> abc -> appendc(abb) -> abbc

   int main(int argc, char *argv[])
   {
           return abbc;
   }

$ gcc -E cppbug.c

   # 1 "cppbug.c"
   # 1 "<built-in>"
   # 1 "<command-line>"
   # 1 "cppbug.c"






   int abbc = 0;

   int main(int argc, char *argv[])
   {
    return abbc;
   }





Reply to: