[OpenMP] Fix build with `LIBOMP_OMPT_OPTIONAL=OFF` (#235734)
Since #95602, `__kmp_barrier_template` and `__kmp_join_barrier` compute
the barrier kind and wait state inside an `OMPT_OPTIONAL` block to
provide tools with specific information about the encountered kind of
barrier. However, both the kind and wait state are used in non-optional
OpenMP builds as well. This breaks the build when OMPT support is
enabled but optional OMPT support is disabled.
To fix this, move the computation out of the `OMPT_OPTIONAL` block, so
it is guarded only by `OMPT_SUPPORT`. OpenMP 6.0 Section 33.31 requires
an implementation to maintain an approximate thread state information
for each thread while the OMPT interface is active. As such, updating
the flag is not optional, unlike the `sync_region[_wait]` callbacks.
Fixes #234164
Signed-off-by: Jan Andre Reuter <jan@zyten.de>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
GitOrigin-RevId: 10e0aabfab95d63ca155fc938e5b310e31847939
1 file changed