From: Yedidya Feldblum Date: Wed, 9 Aug 2017 21:55:17 +0000 (-0700) Subject: Explicitly handle gcc in FOLLY_MAYBE_UNUSED X-Git-Tag: v2017.08.14.00~2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=eb8f3c3c266b76adc3b6ad52c042a2de0e75b9e8;p=folly.git 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 --- 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