-
Notifications
You must be signed in to change notification settings - Fork 12.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Support] Include Support/thread.h before api implementations #111175
Conversation
This header was included after the implementations to work around an issue with FreeBSD, however, this causes some issues when dllexport\explicit visibility attributes will be added to the headers on Windows, since the definitions need to see the declarations for the attributes to apply. This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and plugins on windows.
@llvm/pr-subscribers-llvm-support @llvm/pr-subscribers-platform-windows Author: Thomas Fransham (fsfod) ChangesThis header was included after the implementations to work around an issue with FreeBSD, however, , this causes some issues when dllexport\explicit visibility This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and plugins on windows. Full diff: https://github.com/llvm/llvm-project/pull/111175.diff 2 Files Affected:
diff --git a/llvm/lib/Support/Unix/Threading.inc b/llvm/lib/Support/Unix/Threading.inc
index a354984cabb1ef..ca855eb1160c73 100644
--- a/llvm/lib/Support/Unix/Threading.inc
+++ b/llvm/lib/Support/Unix/Threading.inc
@@ -33,6 +33,14 @@
#include <pthread_np.h> // For pthread_getthreadid_np() / pthread_set_name_np()
#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.
+#ifndef __FreeBSD__
+#include "llvm/Support/thread.h"
+#endif
+
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include <errno.h>
#include <sys/cpuset.h>
diff --git a/llvm/lib/Support/Windows/Threading.inc b/llvm/lib/Support/Windows/Threading.inc
index 4baf8b8cb82aed..d862dbd7f71c9d 100644
--- a/llvm/lib/Support/Windows/Threading.inc
+++ b/llvm/lib/Support/Windows/Threading.inc
@@ -12,6 +12,7 @@
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/Support/thread.h"
#include "llvm/Support/Windows/WindowsSupport.h"
#include <process.h>
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
// 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. | ||
#ifndef __FreeBSD__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should just undef thread instead on FreeBSD. I think that we can just do this for now, it is more conservative.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/66/builds/4728 Here is the relevant piece of the build log for the reference
|
Looks like the next build succeeded: https://lab.llvm.org/buildbot/#/builders/66/builds/4729 |
…11175) This header was included after the implementations to work around an issue with FreeBSD, however, , this causes some issues when dllexport\explicit visibility attributes will be added to the headers on Windows, since the definitions need to see the declarations for the attributes to apply. This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and plugins on windows. --------- Co-authored-by: Tom Stellard <[email protected]>
This header was included after the implementations to work around an issue with FreeBSD, however, , this causes some issues when dllexport\explicit visibility
attributes will be added to the headers on Windows, since the definitions need to see the declarations for the attributes to apply.
This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and plugins on windows.