Hi, I need to define a portable _Pragma(“omp …”).
This could have be done by
#define STRINGIFy(n) #n
#define STRINGIFY(n) STRINGIFy(n)
#define PRAGMA_OMP(args) _Pragma(STRINGIFY(omp args))
and it works with many compilers, but not with pgcc 13.6.
pgcc complaints on use of the PRAGMA_OMP(parallel) thus:
PGC-S-0269-_Pragma requires one argument which must be a string (x.c: 10)
If instead of preprocessor stringification I use _Pragma(“omp parallel”) in that place, everything works fine.
When I try to see if PRAGMA_OMP is expanded wrong, pgcc -E just complaints with the above error and eats up the expansion of the macro definition.
When I replace _Pragma with X_Pragma I can see that cpp expansion goes correctly.
I therefore conclude that _Pragma is processed before its argument string is formed by the preprocessor.
Could you advise what to do with this issue?