How to clear unknown pragma warning for OpenMP?
Jonathan Wakely
jwakely.gcc@gmail.com
Thu Jul 23 17:57:00 GMT 2015
On 23 July 2015 at 18:29, Jeffrey Walton wrote:
>>> g++ -DNDEBUG -g2 -O3 -Wall -fPIC -march=native -pipe -c rw.cpp
>>> rw.cpp:130:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
>>> #pragma omp parallel sections if(CRYPTOPP_RW_USE_OMP)
>>> ^
>>
>> Pretty ugly, but if you want the OpenMP directives to be dependent on
>> whether OpenMP support is actually enabled you could do:
>>
>> #if _OPENMP
>> #pragma omp section
>> #endif
>>
>
> Yeah, we kind of looked at that and rejected it some time ago.
>
> What do you think about some #defines to make them disappear? Can a
> define be crafted that captures multiple lexemes or tokens?
>
> Jeff
You might be able to use _Pragma
#if _OPENMP
#define OMP_PARALLEL _Pragma("omp parallel")
#else
#define OMP_PARALLEL
#endif
And then use that instead of the #pragma omp directive:
OMP_PARALLEL
for (int i = 0; i < 10; ++i)
;
Again, I haven't actually tested whether this still parallelizes
anything, only that it compiles.
More information about the Gcc-help
mailing list