Skip to content

Commit

Permalink
[flang] Replace ATTRIBUTE_UNUSED with LLVM_ATTRIBUTE_UNUSED
Browse files Browse the repository at this point in the history
ATTRIBUTE_UNUSED wasn't defined with MSVC.

Patch by: Mehdi Chinoune <chinoune.mehdi@hotmail.com>

Differential Revision: https://reviews.llvm.org/D78356
  • Loading branch information
MehdiChinoune authored and RichBarton-Arm committed Jun 25, 2020
1 parent b68904d commit 4198874
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions flang/include/flang/Common/idioms.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#error g++ >= 7.2 is required
#endif

#include "llvm/Support/Compiler.h"
#include <functional>
#include <list>
#include <optional>
Expand Down Expand Up @@ -108,10 +109,6 @@ template <typename... LAMBDAS> visitors(LAMBDAS... x) -> visitors<LAMBDAS...>;
} \
template <typename A> constexpr bool T{class_trait_ns_##T::trait_value<A>()};

#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
Expand All @@ -126,11 +123,11 @@ template <typename A> struct ListItemCount {

#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<int>(e), #__VA_ARGS__); \
}
Expand Down

0 comments on commit 4198874

Please sign in to comment.