43 #ifndef __BASE_COMPILER_HH__ 44 #define __BASE_COMPILER_HH__ 50 #if defined(__GNUC__) // clang or gcc 51 # define M5_ATTR_NORETURN __attribute__((noreturn)) 52 # define M5_DUMMY_RETURN 53 # define M5_VAR_USED __attribute__((unused)) 54 # define M5_ATTR_PACKED __attribute__ ((__packed__)) 55 # define M5_NO_INLINE __attribute__ ((__noinline__)) 56 # define M5_DEPRECATED __attribute__((deprecated)) 57 # define M5_DEPRECATED_MSG(MSG) __attribute__((deprecated(MSG))) 58 # define M5_UNREACHABLE __builtin_unreachable() 59 # define M5_PUBLIC __attribute__ ((visibility ("default"))) 60 # define M5_LOCAL __attribute__ ((visibility ("hidden"))) 63 #if defined(__clang__) 64 # define M5_CLASS_VAR_USED M5_VAR_USED 66 # define M5_CLASS_VAR_USED 70 #if defined __has_cpp_attribute 73 #if __has_cpp_attribute(fallthrough) 74 #define M5_FALLTHROUGH [[fallthrough]] 76 #define M5_FALLTHROUGH 79 #if __has_cpp_attribute(nodiscard) 80 #define M5_NODISCARD [[nodiscard]] 86 #define M5_FALLTHROUGH 95 #if __cplusplus >= 201402L // C++14 102 template<
typename T,
typename... Args>
106 return std::unique_ptr<T>(
107 new T( std::forward<Args>(constructor_args)... )
111 #endif // __cplusplus >= 201402L 115 #endif // __BASE_COMPILER_HH__ std::unique_ptr< T > make_unique(Args &&... constructor_args)
Defining custom version of make_unique: m5::make_unique<>()