Since C99 we have the _Pragma
operator, that basically allows you to place the contents of #pragma
everywhere, not only on a line of its own, and to have it subject to macro expansion. Something like
#define STRINGIFY_(...) #__VA_ARGS__
#define STRINGIFY(...) STRINGIFY_(__VA_ARGS__)
#define FOO omp
#define PARALLEL(...) _Pragma(STRINGIFY(FOO parallel __VA_ARGS__))
and then
PARALLEL(private(a))
for(size_t i = 0; i < NUM; ++i)
....
should do the trick.
If you are just interested in using such stuff (compared to writing these macros) you could use P99 preprocessor blocks that implements things like P99_PARALLEL_FOR
and P99_PARALLEL_FORALL
with these kind of tricks.