[Openmp-commits] [PATCH] D59451: Fix gettid warnings and one test on FreeBSD

Jonas Hahnfeld via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Apr 2 05:31:15 PDT 2019


Hahnfeld added inline comments.


================
Comment at: cmake/DetectTestCompiler/CMakeLists.txt:17-26
+  # Unfortunately the top-level cmake/config-ix.cmake file mangles CMake's
+  # CMAKE_THREAD_LIBS_INIT variable from the FindThreads package, so work
+  # around that, until it is fixed there.
+  if(${CMAKE_THREAD_LIBS_INIT} STREQUAL "-lpthread")
+    set(OpenMP_THREAD_FLAGS "-pthread")
+  else
+    set(OpenMP_THREAD_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
----------------
I don't think this will currently work, did you test a standalone build?

1. `CMAKE_THREAD_LIBS_INIT` must not depend on `OpenMP_Found`, it should be added in both cases.
2. As this file is configured separately, I think you need to add `find_package(Threads)` (or is this done in `find_package(OpenMP)`?) I guess this also means we shouldn't replace `-lpthread` by `-pthread` because we don't need to workaround anything.


================
Comment at: cmake/OpenMPTesting.cmake:130
+    set(OPENMP_TEST_COMPILER_OPENMP_FLAGS "${OPENMP_TEST_COMPILER_OPENMP_FLAGS} -pthread")
+  else
+    set(OPENMP_TEST_COMPILER_OPENMP_FLAGS "${OPENMP_TEST_COMPILER_OPENMP_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
----------------
`else()`


Repository:
  rOMP OpenMP

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59451/new/

https://reviews.llvm.org/D59451





More information about the Openmp-commits mailing list