Default arguments are a nice quality-of-life feature in C++. It's annoying if these can't be used in C++ files, just because the header with the function declaration still needs to be C compatible. This macro adds the default argument if the translation unit is compiled in C++. Otherwise, the argument has to be passed explicitly.
Usage looks like this:
void some_func(int required_arg, Something *defaulted_arg CPP_ARG_DEFAULT(nullptr)); /* Or: */ void some_other_func(int required_arg, int defaulted_arg CPP_ARG_DEFAULT(0));
D14653 which uses this compiles on all platforms: https://builder.blender.org/admin/#/builders/18/builds/369
I used this twice in D14653, but I can see this being useful in plenty of other cases. Should the header be C++ only eventually, it's easy to just replace the usages of the macro there. This is easier to clean up than wrapper functions (which have to be identified manually) or explicit arguments littered around the code base. And since wrapper functions are annoying to add anyway, we end up just passing explicit arguments a lot even though there could be a sensible default. Put differently this should encourage default argument use, which might be a good thing. So while this adds a slightly ugly syntax, it should help us move to more readable code eventually.