Created attachment 33379 [details] Header and C file used to reproduce this issue I have attached the header file and c-code (t.c and t.h) used to reproduce this issue. # make t cc t.c -o t t.c: In function 'main': t.c:8: error: expected identifier before numeric constant make: *** [t] Error 1 Error is due to this piece of code in multi-line macro. #define LOG(module, level, msg) \ if ( (module)->level ) \ msg_log(msg) While verifying the pre-processed output of the c-code: # gcc -E t.c ... int main() { struct logger module; if ( (&module)->0 ) msg_log("Ooops\n"); return 0; } # cat t.c #include <stdio.h> #include "t.h" int main() { struct logger module; LOG(&module, 0, "Ooops\n"); return 0; } Here we can see the Macro LOG is wrongly getting interpreted. LOG(&module, 0, "Ooops\n"); ==> if ( (&module)->0 ) msg_log("Ooops\n"); This is happening as "level" in macro is getting replaced with a value "0". Leading to the issue: expected identifier before numeric constant
Huh? Why do you think it is a bug?
Why do you think its not a bug? It would be better if you can explain me the reason why level should be replaced with a "0". In the same macro if I replace "level" with "_level", #define LOG(module, level, msg) \ if ( (module)->_level ) \ msg_log(msg) I get the pre-processed code as : if ( (&module)->_level ) msg_log("Ooops\n");
(In reply to Marek Polacek from comment #1) > Huh? Why do you think it is a bug? Got it ... Yup .. its not a bug. I would mark it resolved.