tianshilei1992 added a comment. In D116637#3294498 <https://reviews.llvm.org/D116637#3294498>, @ABataev wrote:
> In D116637#3294490 <https://reviews.llvm.org/D116637#3294490>, > @tianshilei1992 wrote: > >> In D116637#3294474 <https://reviews.llvm.org/D116637#3294474>, @ABataev >> wrote: >> >>> In D116637#3294466 <https://reviews.llvm.org/D116637#3294466>, >>> @tianshilei1992 wrote: >>> >>>> In D116637#3294390 <https://reviews.llvm.org/D116637#3294390>, @ABataev >>>> wrote: >>>> >>>>> In D116637#3294361 <https://reviews.llvm.org/D116637#3294361>, >>>>> @tianshilei1992 wrote: >>>>> >>>>>> @ABataev @jdoerfert I got a question about writing the test. `atomic >>>>>> compare` is supported from 5.1. Basically we have three ways to guard >>>>>> those `atomic compare` code: >>>>>> >>>>>> 1. Use macro `_OPENMP`. This pretty much works with one exception: we >>>>>> don't set the macro for `-fopenmp-simd`. Then we cannot test >>>>>> `-fopenmp-simd`. >>>>>> 2. Use those `omp50-error` and `omp50-note` which are shown in this >>>>>> patch. `-fopenmp-simd` can be tested now. However, it doesn't work with >>>>>> `-emit-pch`. The compiler emits errors that `unexpected OpenMP clause >>>>>> 'compare' in directive '#pragma omp atomic'` for the lower version >>>>>> tests. If we add `-verify` to the `-emit-pch` line, then the pch will >>>>>> not be generated. >>>>>> 3. Put `atomic compare` tests in another file. >>>>>> >>>>>> For now only the 3rd method could work, but I'm not sure if there are >>>>>> ways to work around the limitation in the first two approaches. >>>>> >>>>> The second or the 3rd approach. >>>>> The tests should work with emit pch and include pch options, otherwise >>>>> precompiled modules are broken. Need to test it too. >>>> >>>> For the 2nd method, `-verify` doesn't work with `-emit-pch`. Any way to >>>> work around it? >>> >>> Do not use it with emit-pch, just like in the test you modified >> >> Then those tests w/o `-fopenmp-version=51`, `clang` emits error "unexpected >> OpenMP clause 'compare' in directive '#pragma omp atomic'" and exits w/ >> error code, and the test fails. > > You can define your own macro for OpenMP51 tests and guard the new code with > `#ifdef value` Oh yeah, that is a good way. Thanks. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116637/new/ https://reviews.llvm.org/D116637 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits