Although not testing the annotations feature, the test still needs guarding for thread-safety otherwise it will not compile at all.
Diff Detail
Event Timeline
I don't actually understand this change. This test should compile with or without "-Wthread-safety" warning. This test doesn't actually turn the annotations on, that's the point. If annotations were actually enabled this test would fail to compile.
Could you explain the error your seeing here?
Hi Eric
Sorry for the delay - I originally detected the failure while not running in a totally clean environment with clean sources, but I can reproduce on clean code.
I can reproduce by building with clean clang and libcxx sources:
cmake -DLLVM_PATH=/work/ricbar01/llvm_oss/ -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_CXX_ABI_INCLUDE_PATHS=../../libcxxabi_oss/include -DCMAKE_C_COMPILER=/work/ricbar01/llvm_oss/build/bin/clang -DCMAKE_CXX_COMPILER=/work/ricbar01/llvm_oss/build/bin/clang++ -DLIBCXX_ENABLE_THREADS=OFF -DLIBCXX_ENABLE_SHARED=OFF -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF ..
I get errors like:
/work/ricbar01/libcxx_oss/test/libcxx/thread/thread.mutex/thread_safety_annotations_not_enabled.pass.cpp:21:8: error: no type named 'mutex' in namespace 'std'
std::mutex m;
From eyeballing the include/mutex it looks like the mutex class is #ifdeffec out when _LIBCPP_HAS_NO_THREADS is unset.
And looking at the current state of the single-threaded test suite this isn't the only test that needs this fix applied.
http://lab.llvm.org:8011/builders/libcxx-libcxxabi-singlethreaded-x86_64-linux-debian/builds/869
Thanks for the help Eric. I'm just running a new patch now will put the new patch up when I get back in to office tomorrow.
Indeed! I assumed by reading other nearby tests that there was some mechanism that disabled the thread/ tests when threads were disabled, but didn't verify this. Sorry about the breakage.
LGTM! Thanks for the complete patch! The "no-threads" bot should now be green so future breakage will be detected immediately!