Open msprotz opened 4 months ago
See commit fcc0213 which works around the issue.
Basically, if a struct is used in the loop body, then it generates a compound literal that contains a comma, and then the preprocessor thinks that the macro KRML_MAYBE_UNROLL(..., <>) receives too many arguments.
From https://stackoverflow.com/questions/13842468/comma-in-c-c-macro#19841470, which is moderately useful, two solutions are:
#define LOOP_BODY(...) __VA_ARGS__
KRML_MAYBE_UNROLL(..., LOOP_BODY(...))
#define COMMA ,
COMMA
,
The former seems easier to implement
See commit fcc0213 which works around the issue.
Basically, if a struct is used in the loop body, then it generates a compound literal that contains a comma, and then the preprocessor thinks that the macro KRML_MAYBE_UNROLL(..., <>) receives too many arguments.
From https://stackoverflow.com/questions/13842468/comma-in-c-c-macro#19841470, which is moderately useful, two solutions are:
#define LOOP_BODY(...) __VA_ARGS__
and then have krml emitKRML_MAYBE_UNROLL(..., LOOP_BODY(...))
#define COMMA ,
and then have krml print at the last minute usingCOMMA
instead of,
The former seems easier to implement