[Bug c/77410] macro reference supplied as macro reference argument is not expanded

jfhart085 at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Aug 30 03:00:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77410

--- Comment #1 from J. Hart <jfhart085 at gmail dot com> ---
If an additional level of macro referencing is added, the result is correct.
It would appear that if an argument is directly used with an concatenation
directive, that argument is not expanded.

example:

#define MDNM utl1
#define m1(mdnm) mdnm##x
#define m2(mdnm) m1(mdnm)
int m2(MDNM)(void);
void utl1x(void);
void MDNMx(void);

gcc utl1.c -o utl1.o

utl1.c:5:6: error: conflicting types for 'utl1x'
 void utl1x(void);
      ^
utl1.c:1:14: note: previous declaration of 'utl1x' was here
 #define MDNM utl1
              ^
utl1.c:2:18: note: in definition of macro 'm1'
 #define m1(mdnm) mdnm##x
                  ^
utl1.c:4:5: note: in expansion of macro 'm2'
 int m2(MDNM)(void);
     ^
utl1.c:4:8: note: in expansion of macro 'MDNM'
 int m2(MDNM)(void);


More information about the Gcc-bugs mailing list