Skip to content

Commit cf44f47

Browse files
committed
Stop using __attribute__((retain)) in GCC builds
1 parent 0b31f08 commit cf44f47

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

llvm/include/llvm/Support/Compiler.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,15 @@
231231
#endif
232232

233233
#if __has_attribute(retain)
234+
#if defined(__clang__) || !defined(__GNUC__)
234235
#define LLVM_ATTRIBUTE_RETAIN __attribute__((__retain__))
235236
#else
237+
// See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99587
238+
// GCC may produce "warning: ‘retain’ attribute ignored" (despite
239+
// __has_attribute(retain) being 1).
240+
#define LLVM_ATTRIBUTE_RETAIN
241+
#endif
242+
#else
236243
#define LLVM_ATTRIBUTE_RETAIN
237244
#endif
238245

0 commit comments

Comments
 (0)