flabberghaster

flabberghaster wrote

OK so this is kind of a pain in the neck to do a lot of times but sometimes you can get the output if the C preprocessor.

Then through careful editing, you can kind of figure out what it's turning in to.

int main(...) {
   WEIRD_MACRO(1, 2);
}

Then you could just put comments above and below it, and run cpp -I/all/include/directories main.c

It will tell you the final output and also have debugging garbage about where each thing expanded from.

Not ideal, and also in a big project that uses a complex build tool it can be incredibly hard to get the cpp args, but it can help.

2