From 37d8f987ca939af846a2d29a8f8198f9bf3ac4b7 Mon Sep 17 00:00:00 2001 From: cheparukhin Date: Tue, 19 Jul 2016 00:18:33 +0100 Subject: [PATCH] Add unused attribute to free functions (#27) --- enum.h | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/enum.h b/enum.h index f0e96e5..1bd556f 100644 --- a/enum.h +++ b/enum.h @@ -84,9 +84,9 @@ #endif #ifdef __GNUC__ -# define BETTER_ENUMS_UNUSED(x) x __attribute__((__unused__)) +# define BETTER_ENUMS_UNUSED __attribute__((__unused__)) #else -# define BETTER_ENUMS_UNUSED(x) x +# define BETTER_ENUMS_UNUSED #endif @@ -349,7 +349,7 @@ BETTER_ENUMS_CONSTEXPR_ static T* _or_null(optional maybe) template 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; } @@ -362,7 +362,7 @@ struct _eat_assign { template 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; } @@ -679,7 +679,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) \ { \ return static_cast(enumerated); \ @@ -824,17 +825,28 @@ ToStringConstexpr inline Enum::_name_iterable Enum::_names() \ \ 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(); } \ -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(); } \ -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(); } \ -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(); } \ -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(); } \ -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(); } \ \ \