From 30b42a9617f5047cbaee13860b3f8b6ddf14a968 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sun, 3 Nov 2019 09:38:02 +0200 Subject: Fix gcc compile errors and warnings --- lib/configuration/configuration.h | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'lib/configuration') diff --git a/lib/configuration/configuration.h b/lib/configuration/configuration.h index bc8f52e..b77685a 100644 --- a/lib/configuration/configuration.h +++ b/lib/configuration/configuration.h @@ -19,27 +19,39 @@ #include #include +#if defined (__clang__) +#define consumable(X) [[clang::consumable(X)]] +#define return_typestate(X) [[clang::return_typestate(X)]] +#define callable_when(X) [[clang::callable_when(X)]] +#define param_typestate(X) [[clang::param_typestate(X)]] +#else +#define consumable(X) +#define return_typestate(X) +#define callable_when(X) +#define param_typestate(X) +#endif + typedef std::variant conf_value_t; -class [[clang::consumable(unconsumed)]] Configuration : private std::unordered_map +class consumable(unconsumed) Configuration : private std::unordered_map { public: - [[clang::return_typestate(unconsumed)]] + return_typestate(unconsumed) explicit Configuration(); - [[clang::return_typestate(unconsumed)]] + return_typestate(unconsumed) explicit Configuration(std::initializer_list> l) noexcept; - explicit Configuration(Configuration &&other [[clang::param_typestate(unconsumed)]]) = default; + explicit Configuration(Configuration &&other param_typestate(unconsumed)) = default; ~Configuration() = default; - [[clang::callable_when(unconsumed)]] + callable_when(unconsumed) void read(std::basic_istream &input); template - [[clang::callable_when(unconsumed)]] std::optional value(const char *path) const + callable_when(unconsumed) std::optional value(const char *path) const { if(use_global) return instance()->value(path); -- cgit v1.2.1