The accepted answer to the question C++ concatenating __FILE__ and __LINE__ macros? work for FILE and LINE, but I would like to add the func macro too.
#define S1(x) #x
#define S2(x) S1(x)
#define S3(x) x
#define LOCATION __FILE__ " : " S3(__func__) " : " S2(__LINE__)
this gives error
log.cpp|15 col 15 error| note: in definition of macro ‘S3’
Also tried,
#define LOCATION __FILE__ " : " __func__ " : " S2(__LINE__)
gives error
log.cpp|30 col 9 error| note: in expansion of macro ‘LOCATION’
I understand that LINE was a integer hence needed #x, but func is a char array. How do I get this working? Any help?