-
-
Notifications
You must be signed in to change notification settings - Fork 219
Description
Per the discussion in #537, I was able to incorporate the techniques demonstrated in this SO answer to avoid the use of GNU extensions. The relevant changes can be seen here on my fork.
There are a couple of minor caveats:
-
Using this technique constrains us to a predefined number of arguments. Currently, I have this as 24, but if desired, this could be extended trivially by modifying these lines:
#define RCPP_MACRO_NUM(...) \ RCPP_MACRO_SELECT_25TH(__VA_ARGS__, TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, \ TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, \ TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, \ TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, \ TWOORMORE, TWOORMORE, TWOORMORE, TWOORMORE, ONE, throwaway) #define RCPP_MACRO_SELECT_25TH(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, \ a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, ...) a25
-
It will introduce some additional macro definitions, and as far as I can tell this is unavoidable. As some consolation, I appended these with
RCPP_MACRO_
, e.g.RCPP_MACRO_REST
,RCPP_MACRO_REST_HELPER
, etc., so I don't think that should cause anyone much grief.
This is not urgent, but if anyone has a few minutes to spare at some point (particularly OS X users, to which I don't have access to), would you mind building my fork and testing the changes? I have put together a couple of test files that worked correctly and compiled without warning on my machine (CentOS 7, clang 3.4, -Wall -pedantic
).