#define COUNTER_NAME(NAME, ...) NAME##Count
#define COMMA ,
#define DECLARE_COUNTERS(LIST) unsigned long LIST(COUNTER_NAME, COMMA);
#define ACTUAL_LIST(FUNCTION, SEPARATOR) \
FUNCTION(event1, int, foo) SEPARATOR \
FUNCTION(event2, char, bar)
DECLARE_COUNTERS(ACTUAL_LIST)
#1 "cppcheck-issue-xxxx.cpp"
#1 "<built-in>"
#1 "<command-line>"
#1 "cppcheck-issue-xxxx.cpp"
#10 "cppcheck-issue-xxxx.cpp"
unsigned long event1Count , event2Count;
test.c:4: syntax error: failed to expand 'DECLARE_COUNTERS', Wrong number of parameters for macro 'ACTUAL_LIST'.
Input:
Output of gcc -E:
simplecpp output: