summaryrefslogtreecommitdiffhomepage
path: root/compat
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-06-05 08:38:13 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-06-13 07:02:53 +0200
commit4a78249614a406694e444565fa74f359f2e3570d (patch)
tree82aeaf10fa7fc30e384e007e7670842c7ea1317f /compat
parent0e6df89fe42105d87ff4b4aebd5ca598c22ff72a (diff)
compat/macros: simplify static_warning
Diffstat (limited to 'compat')
-rw-r--r--compat/macros.hpp33
1 files changed, 7 insertions, 26 deletions
diff --git a/compat/macros.hpp b/compat/macros.hpp
index 01d9cd83..564dcc8d 100644
--- a/compat/macros.hpp
+++ b/compat/macros.hpp
@@ -55,33 +55,14 @@
// from now only C++ macros
-#if defined _MSC_VER
-# define OTR_DEPRECATE(msg, decl, body) __declspec(deprecated(msg)) decl body
-#else
-# define OTR_DEPRECATE(msg, decl, body) decl body __attribute__((deprecated(msg)))
-#endif
-
-namespace static_warning_detail {
- template<bool> struct test___132;
-
- template<>
- struct test___132<true>
- {
- static constexpr inline void check() {}
- };
-} // ns static_warning_detail
+template<bool>
+[[deprecated]] constexpr force_inline void static_warn() {}
-#define static_warning_template(cond, msg) \
- { \
- template<bool> \
- struct ::static_warning_detail::test___132 \
- { \
- OTR_DEPRECATE(msg, static constexpr inline void check(), {}) \
- }; \
- ::static_warning_detail::test___132<(cond)>::check(); \
- }
+template<>
+constexpr force_inline void static_warn<true>() {}
-#define static_warning(cond, msg) \
- static_warning_template(cond, PP_CAT(msg, PP_CAT("\nExpression: ", #cond)))
+#define static_warning(cond) \
+ static_warn<(cond)>(); \
+// end c++-only macros
#endif