Stumbled over this issue when i added a define for the Qt macro Q_D(), see Cppcheck ticket https://trac.cppcheck.net/ticket/8479.
For this C code:
#define CONCAT(tok) tok##suffix
CONCAT(Test);
CONCAT(const Test);
gcc outputs:
$ gcc -E token_pasting_with_space.c
# 1 "token_pasting_with_space.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "token_pasting_with_space.c"
Testsuffix;
const Testsuffix;
simplecpp outputs:
$ ./simplecpp token_pasting_with_space.c
Testsuffix ;
constTestsuffix ;
The space between "const" and "Test" is removed.
Not sure what the standard says about such a case but since Qt and gcc are widely used i guess it should work like Qt expects it and gcc handles it to not break things.
Stumbled over this issue when i added a define for the Qt macro Q_D(), see Cppcheck ticket https://trac.cppcheck.net/ticket/8479.
For this C code:
gcc outputs:
simplecpp outputs:
The space between "const" and "Test" is removed.
Not sure what the standard says about such a case but since Qt and gcc are widely used i guess it should work like Qt expects it and gcc handles it to not break things.