-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Stop using __attribute__((retain)) in GCC builds #133793
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
Conversation
@llvm/pr-subscribers-llvm-support Author: Matthias Braun (MatzeB) ChangesGCC sometimes produces warnings about The amount of users who benefit from the attribute is probably very small compared to the amount of Full diff: https://github.com/llvm/llvm-project/pull/133793.diff 1 Files Affected:
diff --git a/llvm/include/llvm/Support/Compiler.h b/llvm/include/llvm/Support/Compiler.h
index ff6f5e44ae2f1..dd70362455d89 100644
--- a/llvm/include/llvm/Support/Compiler.h
+++ b/llvm/include/llvm/Support/Compiler.h
@@ -231,8 +231,15 @@
#endif
#if __has_attribute(retain)
+#if defined(__clang__) || !defined(__GNUC__)
#define LLVM_ATTRIBUTE_RETAIN __attribute__((__retain__))
#else
+// See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99587
+// GCC may produce "warning: ‘retain’ attribute ignored" (despite
+// __has_attribute(retain) begin 1). For now skip the attribute on GCC.
+#define LLVM_ATTRIBUTE_RETAIN
+#endif
+#else
#define LLVM_ATTRIBUTE_RETAIN
#endif
|
3444de3
to
cf44f47
Compare
@MatzeB is this ready to merge? Would be nice to have this in. |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/17516 Here is the relevant piece of the build log for the reference
|
pick up llvm/llvm-project#133793 to fix #6352 (comment) ~~**NB**: waiting on the PR to `llvm-head` #6360 cc @FindHao
GCC sometimes produces warnings about `__attribute__((retain))` despite `__has_attribute(retain)` being 1. See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99587 The amount of users who benefit from the attribute is probably very small compared to the amount of `-Werror` enabled builds or the desire to keep `-Wattributes` enabled in the LLVM build. So for now drop usage of the `retain` attribute in GCC builds.
GCC sometimes produces warnings about
__attribute__((retain))
despite__has_attribute(retain)
being 1. See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99587The amount of users who benefit from the attribute is probably very small compared to the amount of
-Werror
enabled builds or the desire to keep-Wattributes
enabled in the LLVM build. So for now drop usage of theretain
attribute in GCC builds.