diff --git a/flang/include/flang/Common/idioms.h b/flang/include/flang/Common/idioms.h --- a/flang/include/flang/Common/idioms.h +++ b/flang/include/flang/Common/idioms.h @@ -23,6 +23,7 @@ #error g++ >= 7.2 is required #endif +#include "llvm/Support/Compiler.h" #include #include #include @@ -108,10 +109,6 @@ } \ template constexpr bool T{class_trait_ns_##T::trait_value()}; -#if !defined ATTRIBUTE_UNUSED && (__clang__ || __GNUC__) -#define ATTRIBUTE_UNUSED __attribute__((unused)) -#endif - // Define enum class NAME with the given enumerators, a static // function EnumToString() that maps enumerators to std::string, // and a constant NAME_enumSize that captures the number of items @@ -126,11 +123,11 @@ #define ENUM_CLASS(NAME, ...) \ enum class NAME { __VA_ARGS__ }; \ - ATTRIBUTE_UNUSED static constexpr std::size_t NAME##_enumSize{[] { \ + LLVM_ATTRIBUTE_UNUSED static constexpr std::size_t NAME##_enumSize{[] { \ enum { __VA_ARGS__ }; \ return Fortran::common::ListItemCount{__VA_ARGS__}.value; \ }()}; \ - ATTRIBUTE_UNUSED static inline std::string EnumToString(NAME e) { \ + LLVM_ATTRIBUTE_UNUSED static inline std::string EnumToString(NAME e) { \ return Fortran::common::EnumIndexToString( \ static_cast(e), #__VA_ARGS__); \ }