[flang-commits] [flang] 4198874 - [flang] Replace ATTRIBUTE_UNUSED with LLVM_ATTRIBUTE_UNUSED

Richard Barton via flang-commits flang-commits at lists.llvm.org
Thu Jun 25 11:53:41 PDT 2020


Author: Mehdi Chinoune
Date: 2020-06-25T19:53:19+01:00
New Revision: 4198874630be5c6126d78944f8a2d89dea90c7c4

URL: https://github.com/llvm/llvm-project/commit/4198874630be5c6126d78944f8a2d89dea90c7c4
DIFF: https://github.com/llvm/llvm-project/commit/4198874630be5c6126d78944f8a2d89dea90c7c4.diff

LOG: [flang] Replace ATTRIBUTE_UNUSED with LLVM_ATTRIBUTE_UNUSED

ATTRIBUTE_UNUSED wasn't defined with MSVC.

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

Differential Revision: https://reviews.llvm.org/D78356

Added: 
    

Modified: 
    flang/include/flang/Common/idioms.h

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Common/idioms.h b/flang/include/flang/Common/idioms.h
index 3f4f8f2eec6b..6e499eb04f36 100644
--- 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 <functional>
 #include <list>
 #include <optional>
@@ -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
@@ -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__); \
   }


        


More information about the flang-commits mailing list