You can't use #pragma
within a macro. But in C99, and therefore OpenCL, you can use the _Pragma()
directive:
# if foo
#define PRAGMA_UNROLL "_Pragma(unroll 8)"
#elif bar
#define PRAGMA_UNROLL "_Pragma(unroll 16)"
#endif
#define macro foobar(...) \
(...) \
PRAGMA_UNROLL \
for (...) \
(...)