From 8fb67f8574a6be8c8847d0f858b61ce063713d4e Mon Sep 17 00:00:00 2001 From: Yedidya Feldblum Date: Thu, 9 May 2024 12:09:13 -0700 Subject: [PATCH] FOLLY_ATTR_GNU_USED Summary: ``` [[FOLLY_ATTR_GNU_USED]] void foo() {} ``` Differential Revision: D57165728 fbshipit-source-id: 5c492c7ccc890ebdb56db8c2cc5acbdd0fad8c71 --- folly/CppAttributes.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/folly/CppAttributes.h b/folly/CppAttributes.h index 9358a1bd56d..d2d48af1de2 100644 --- a/folly/CppAttributes.h +++ b/folly/CppAttributes.h @@ -145,3 +145,9 @@ #else #define FOLLY_ATTR_CLANG_PRESERVE_ALL #endif + +#if FOLLY_HAS_CPP_ATTRIBUTE(gnu::used) +#define FOLLY_ATTR_GNU_USED gnu::used +#else +#define FOLLY_ATTR_GNU_USED +#endif