summaryrefslogtreecommitdiffhomepage
path: root/compat/macros.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-06-22 13:21:52 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-06-26 23:01:53 +0200
commit519b4a3ae10c96951db917f2439982c7d2391874 (patch)
treeec55d8a12fa740803e6da2074eec04f465e98ede /compat/macros.hpp
parent0f182b791622ad4491c8aabf8edce21a63839bdc (diff)
compat/macros: rename portability macros
use `cc_xx' rather than awkward synonyms.
Diffstat (limited to 'compat/macros.hpp')
-rw-r--r--compat/macros.hpp42
1 files changed, 20 insertions, 22 deletions
diff --git a/compat/macros.hpp b/compat/macros.hpp
index 8b635201..57883827 100644
--- a/compat/macros.hpp
+++ b/compat/macros.hpp
@@ -7,43 +7,41 @@
#endif
#if defined _MSC_VER
-# define never_inline __declspec(noinline)
+# define cc_noinline __declspec(noinline)
#elif defined __GNUG__
-# define never_inline __attribute__((noinline))
+# define cc_noinline __attribute__((noinline))
#else
-# define never_inline
-#endif
-
-#if defined __cplusplus
-# define restrict_ptr __restrict
+# define cc_noinline
#endif
#if defined _MSC_VER
-# define force_inline __forceinline
+# define cc_forceinline __forceinline
#else
-# define force_inline __attribute__((always_inline, gnu_inline)) inline
+# define cc_forceinline __attribute__((always_inline, gnu_inline)) inline
#endif
#ifdef Q_CREATOR_RUN
-# define warn_result_unused
+# define cc_warn_unused_result
#elif defined _MSC_VER
-# define warn_result_unused _Check_return_
+# define cc_warn_unused_result _Check_return_
#else
-# define warn_result_unused __attribute__((warn_unused_result))
+# define cc_warn_unused_result __attribute__((warn_unused_result))
#endif
-#if defined __GNUC__
-# define likely(x) __builtin_expect(!!(x),1)
-# define unlikely(x) __builtin_expect(!!(x),0)
-#else
-# define likely(x) (x)
-# define unlikely(x) (x)
+#if !defined likely
+# if defined __GNUC__
+# define likely(x) __builtin_expect(!!(x),1)
+# define unlikely(x) __builtin_expect(!!(x),0)
+# else
+# define likely(x) (x)
+# define unlikely(x) (x)
+# endif
#endif
#if defined _MSC_VER
-# define OTR_FUNNAME (__FUNCSIG__)
+# define cc_function_name (__FUNCSIG__)
#else
-# define OTR_FUNNAME (__PRETTY_FUNCTION__)
+# define cc_function_name (__PRETTY_FUNCTION__)
#endif
#if !defined PP_CAT
@@ -65,10 +63,10 @@ using cv_qualified = std::conditional_t<std::is_fundamental_v<std::decay_t<t>>,
std::add_lvalue_reference_t<std::add_const_t<std::remove_reference_t<t>>>>;
template<bool>
-[[deprecated]] constexpr force_inline void static_warn() {}
+[[deprecated]] constexpr cc_forceinline void static_warn() {}
template<>
-constexpr force_inline void static_warn<true>() {}
+constexpr cc_forceinline void static_warn<true>() {}
#define static_warning(cond) \
static_warn<(cond)>(); \