Add unused attribute to free functions

This commit is contained in:
cheparukhin 2016-07-15 17:05:43 +01:00
parent f520b397e3
commit 2d4461fea5

34
enum.h
View File

@ -79,9 +79,9 @@
#endif #endif
#ifdef __GNUC__ #ifdef __GNUC__
# define BETTER_ENUMS_UNUSED(x) x __attribute__((__unused__)) # define BETTER_ENUMS_UNUSED __attribute__((__unused__))
#else #else
# define BETTER_ENUMS_UNUSED(x) x # define BETTER_ENUMS_UNUSED
#endif #endif
@ -344,7 +344,7 @@ BETTER_ENUMS_CONSTEXPR_ static T* _or_null(optional<T*> maybe)
template <typename T, typename U> template <typename T, typename U>
BETTER_ENUMS_CONSTEXPR_ U BETTER_ENUMS_CONSTEXPR_ U
continue_with(T BETTER_ENUMS_UNUSED(ignored), U value) { return value; } continue_with(T ignored BETTER_ENUMS_UNUSED, U value) { return value; }
@ -357,7 +357,7 @@ struct _eat_assign {
template <typename Any> template <typename Any>
BETTER_ENUMS_CONSTEXPR_ const _eat_assign& BETTER_ENUMS_CONSTEXPR_ const _eat_assign&
operator =(Any BETTER_ENUMS_UNUSED(dummy)) const { return *this; } operator =(Any dummy BETTER_ENUMS_UNUSED) const { return *this; }
BETTER_ENUMS_CONSTEXPR_ operator EnumType () const { return _value; } BETTER_ENUMS_CONSTEXPR_ operator EnumType () const { return _value; }
@ -674,7 +674,8 @@ BETTER_ENUMS_ID(GenerateStrings(Enum, __VA_ARGS__)) \
\ \
} \ } \
\ \
BETTER_ENUMS_CONSTEXPR_ inline const Enum \ BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
inline const Enum \
operator +(Enum::_enumerated enumerated) \ operator +(Enum::_enumerated enumerated) \
{ \ { \
return static_cast<Enum>(enumerated); \ return static_cast<Enum>(enumerated); \
@ -819,17 +820,28 @@ ToStringConstexpr inline Enum::_name_iterable Enum::_names() \
\ \
DefineInitialize(Enum) \ DefineInitialize(Enum) \
\ \
BETTER_ENUMS_CONSTEXPR_ inline bool operator ==(const Enum &a, const Enum &b) \ BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
inline bool operator ==(const Enum &a, const Enum &b) \
{ return a._to_integral() == b._to_integral(); } \ { return a._to_integral() == b._to_integral(); } \
BETTER_ENUMS_CONSTEXPR_ inline bool operator !=(const Enum &a, const Enum &b) \ \
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
inline bool operator !=(const Enum &a, const Enum &b) \
{ return a._to_integral() != b._to_integral(); } \ { return a._to_integral() != b._to_integral(); } \
BETTER_ENUMS_CONSTEXPR_ inline bool operator <(const Enum &a, const Enum &b) \ \
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
inline bool operator <(const Enum &a, const Enum &b) \
{ return a._to_integral() < b._to_integral(); } \ { return a._to_integral() < b._to_integral(); } \
BETTER_ENUMS_CONSTEXPR_ inline bool operator <=(const Enum &a, const Enum &b) \ \
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
inline bool operator <=(const Enum &a, const Enum &b) \
{ return a._to_integral() <= b._to_integral(); } \ { return a._to_integral() <= b._to_integral(); } \
BETTER_ENUMS_CONSTEXPR_ inline bool operator >(const Enum &a, const Enum &b) \ \
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
inline bool operator >(const Enum &a, const Enum &b) \
{ return a._to_integral() > b._to_integral(); } \ { return a._to_integral() > b._to_integral(); } \
BETTER_ENUMS_CONSTEXPR_ inline bool operator >=(const Enum &a, const Enum &b) \ \
BETTER_ENUMS_UNUSED BETTER_ENUMS_CONSTEXPR_ \
inline bool operator >=(const Enum &a, const Enum &b) \
{ return a._to_integral() >= b._to_integral(); } \ { return a._to_integral() >= b._to_integral(); } \
\ \
\ \