I've made some macro to help me design a dialog's widget, in a gcc project. But I'm getting compilation errors, so I made the following test :
#define XPOS_ISAFTER(obj) (obj##_XPOS + obj##_XSIZE)
#define PMD_TUTU_XPOS 10
#define PMD_TUTU_XSIZE 10
#define PMD_TUTU2_XPOS XPOS_ISAFTER(PMD_TUTU)
#define PMD_TUTU2_XSIZE 20
#define PMD_TUTU3_XPOS XPOS_ISAFTER(PMD_TUTU2)
int main(void){
int i = 0;
printf("Hello World!\n");
fflush(stdout);
/* Infinite loop */
while (1)
{
i += PMD_TUTU2_XPOS;
i += PMD_TUTU3_XPOS;
}
return 0;
}
When asking for preprocessor output I get the following :
839 int main(void){
840 int i = 0;
841 printf("Hello World!\n");
842 fflush(stdout);
843
844
845 while (1)
846 {
847 i += (10 + 10);
848 i += (XPOS_ISAFTER(PMD_TUTU) + 20);
849 }
850
851 return 0;
I have search some advices tricks to force rescan, without any result. So the pre-processor do not expand this recursive macro ?