From eb8f3c3c266b76adc3b6ad52c042a2de0e75b9e8 Mon Sep 17 00:00:00 2001 From: Yedidya Feldblum Date: Wed, 9 Aug 2017 14:55:17 -0700 Subject: [PATCH] Explicitly handle gcc in FOLLY_MAYBE_UNUSED Summary: [Folly] Explicitly handle gcc in `FOLLY_MAYBE_UNUSED`. Fixes build break from {D5562220}. Reviewed By: Orvid Differential Revision: D5594288 fbshipit-source-id: 5aa2dcb6133d53a0eb20d34b67c8e4407dd2b7ca --- folly/CppAttributes.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/folly/CppAttributes.h b/folly/CppAttributes.h index f435212d..7a13f615 100644 --- a/folly/CppAttributes.h +++ b/folly/CppAttributes.h @@ -22,6 +22,12 @@ #pragma once +#ifndef __has_attribute +#define FOLLY_HAS_ATTRIBUTE(x) 0 +#else +#define FOLLY_HAS_ATTRIBUTE(x) __has_attribute(x) +#endif + #ifndef __has_cpp_attribute #define FOLLY_HAS_CPP_ATTRIBUTE(x) 0 #else @@ -65,7 +71,9 @@ * #endif * } */ -#if FOLLY_HAS_CPP_ATTRIBUTE(__unused__) +#if FOLLY_HAS_CPP_ATTRIBUTE(maybe_unused) +#define FOLLY_MAYBE_UNUSED [[maybe_unused]] +#elif FOLLY_HAS_ATTRIBUTE(__unused__) || __GNUC__ #define FOLLY_MAYBE_UNUSED __attribute__((__unused__)) #else #define FOLLY_MAYBE_UNUSED -- 2.34.1