aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Threading.cpp
diff options
context:
space:
mode:
authorTim Northover <t.p.northover@gmail.com>2021-07-09 09:51:57 +0100
committerTim Northover <t.p.northover@gmail.com>2021-07-09 10:39:52 +0100
commit0c39f82f0b3e9268f7699e62f59f960a1bff89fa (patch)
tree1af3ce9b3ca80072939f787c098645f1acb61b3b /llvm/lib/Support/Threading.cpp
parent375694a07bcba3be66864c42a5932be1a22831e2 (diff)
downloadllvm-0c39f82f0b3e9268f7699e62f59f960a1bff89fa.zip
llvm-0c39f82f0b3e9268f7699e62f59f960a1bff89fa.tar.gz
llvm-0c39f82f0b3e9268f7699e62f59f960a1bff89fa.tar.bz2
[Support] reorder Threading includes to avoid conflict with FreeBSD headers
FreeBSD's condvar.h (included by user.h in Threading.inc) uses a "struct thread" that conflicts with llvm::thread if both are visible when it's included. So this moves our #include after the FreeBSD code.
Diffstat (limited to 'llvm/lib/Support/Threading.cpp')
-rw-r--r--llvm/lib/Support/Threading.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
index ba92a3e..04a1a9e 100644
--- a/llvm/lib/Support/Threading.cpp
+++ b/llvm/lib/Support/Threading.cpp
@@ -15,7 +15,6 @@
#include "llvm/ADT/Optional.h"
#include "llvm/Config/config.h"
#include "llvm/Support/Host.h"
-#include "llvm/Support/thread.h"
#include <cassert>
#include <errno.h>
@@ -78,6 +77,11 @@ unsigned llvm::ThreadPoolStrategy::compute_thread_count() const {
#include "Windows/Threading.inc"
#endif
+// Must be included after Threading.inc to provide definition for llvm::thread
+// because FreeBSD's condvar.h (included by user.h) misuses the "thread"
+// keyword.
+#include "llvm/Support/thread.h"
+
#if defined(__APPLE__)
// Darwin's default stack size for threads except the main one is only 512KB,
// which is not enough for some/many normal LLVM compilations. This implements