summaryrefslogtreecommitdiffhomepage
path: root/compat
diff options
context:
space:
mode:
Diffstat (limited to 'compat')
-rw-r--r--compat/base-path.cpp2
-rw-r--r--compat/base-path.hpp2
-rw-r--r--compat/check-visible.cpp8
-rw-r--r--compat/check-visible.hpp4
-rw-r--r--compat/macros.hpp42
-rw-r--r--compat/math.hpp2
-rw-r--r--compat/run-in-thread.hpp2
-rw-r--r--compat/shm.h10
-rw-r--r--compat/warn.hpp6
9 files changed, 38 insertions, 40 deletions
diff --git a/compat/base-path.cpp b/compat/base-path.cpp
index 3285bac8..f207eca0 100644
--- a/compat/base-path.cpp
+++ b/compat/base-path.cpp
@@ -2,7 +2,7 @@
#include <QCoreApplication>
OTR_COMPAT_EXPORT
-never_inline
+cc_noinline
const QString& application_base_path()
{
static QString const& const_path = QCoreApplication::applicationDirPath();
diff --git a/compat/base-path.hpp b/compat/base-path.hpp
index 8e2884fd..06e2c703 100644
--- a/compat/base-path.hpp
+++ b/compat/base-path.hpp
@@ -6,7 +6,7 @@
#include <QString>
OTR_COMPAT_EXPORT
-never_inline
+cc_noinline
const QString& application_base_path();
#define OPENTRACK_BASE_PATH (application_base_path())
diff --git a/compat/check-visible.cpp b/compat/check-visible.cpp
index 84ddd6d9..0f4c6e6d 100644
--- a/compat/check-visible.cpp
+++ b/compat/check-visible.cpp
@@ -15,7 +15,7 @@ static Timer timer;
static QMutex mtx;
static bool visible = true;
-never_inline OTR_COMPAT_EXPORT
+cc_noinline OTR_COMPAT_EXPORT
void set_is_visible(const QWidget& w, bool force)
{
QMutexLocker l(&mtx);
@@ -47,7 +47,7 @@ void set_is_visible(const QWidget& w, bool force)
}
}
-never_inline OTR_COMPAT_EXPORT
+cc_noinline OTR_COMPAT_EXPORT
bool check_is_visible()
{
QMutexLocker l(&mtx);
@@ -57,12 +57,12 @@ bool check_is_visible()
#else
-never_inline OTR_COMPAT_EXPORT
+cc_noinline OTR_COMPAT_EXPORT
void set_is_visible(const QWidget&, bool)
{
}
-never_inline OTR_COMPAT_EXPORT
+cc_noinline OTR_COMPAT_EXPORT
bool check_is_visible()
{
return true;
diff --git a/compat/check-visible.hpp b/compat/check-visible.hpp
index a0211982..65a20d79 100644
--- a/compat/check-visible.hpp
+++ b/compat/check-visible.hpp
@@ -5,5 +5,5 @@
#include <QWidget>
-never_inline OTR_COMPAT_EXPORT void set_is_visible(QWidget const& w, bool force = false);
-never_inline OTR_COMPAT_EXPORT bool check_is_visible();
+cc_noinline OTR_COMPAT_EXPORT void set_is_visible(QWidget const& w, bool force = false);
+cc_noinline OTR_COMPAT_EXPORT bool check_is_visible();
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)>(); \
diff --git a/compat/math.hpp b/compat/math.hpp
index 014604e6..eae1435e 100644
--- a/compat/math.hpp
+++ b/compat/math.hpp
@@ -68,7 +68,7 @@ inline auto uround(const t& val) -> std::enable_if_t<!std::is_integral_v<std::de
#include "macros.hpp"
template <typename T>
-static force_inline constexpr auto signum(T x)
+static cc_forceinline constexpr auto signum(T x)
{
return x < T(0) ? -1 : 1;
}
diff --git a/compat/run-in-thread.hpp b/compat/run-in-thread.hpp
index 4631fb0c..afe279f2 100644
--- a/compat/run-in-thread.hpp
+++ b/compat/run-in-thread.hpp
@@ -53,7 +53,7 @@ struct run_in_thread_traits<void>
}
template<typename F>
-auto never_inline
+auto cc_noinline
run_in_thread_sync(QObject* obj, F&& fun)
-> typename qt_impl_detail::run_in_thread_traits<decltype(fun())>::ret_type
{
diff --git a/compat/shm.h b/compat/shm.h
index 5ea6c80a..814ce90c 100644
--- a/compat/shm.h
+++ b/compat/shm.h
@@ -32,10 +32,10 @@ class OTR_COMPAT_EXPORT shm_wrapper final
#endif
public:
- never_inline shm_wrapper(const char *shm_name, const char *mutex_name, int map_size);
- never_inline ~shm_wrapper();
- never_inline bool lock();
- never_inline bool unlock();
- never_inline bool success();
+ cc_noinline shm_wrapper(const char *shm_name, const char *mutex_name, int map_size);
+ cc_noinline ~shm_wrapper();
+ cc_noinline bool lock();
+ cc_noinline bool unlock();
+ cc_noinline bool success();
inline void* ptr() { return mem; }
};
diff --git a/compat/warn.hpp b/compat/warn.hpp
index 403a3a45..7f3e21d0 100644
--- a/compat/warn.hpp
+++ b/compat/warn.hpp
@@ -13,10 +13,10 @@ namespace warn_detail {
template<typename t> using basic_string_stream = std::basic_ostringstream<t, std::char_traits<t>, std::allocator<t>>;
using string_stream = basic_string_stream<wchar_t>;
-force_inline void do_warn(string_stream&) {}
+cc_forceinline void do_warn(string_stream&) {}
template<typename x, typename... xs>
-force_inline void do_warn(string_stream& acc, const x& datum, const xs&... rest)
+cc_forceinline void do_warn(string_stream& acc, const x& datum, const xs&... rest)
{
acc << datum;
if (sizeof...(rest) > 0u)
@@ -25,7 +25,7 @@ force_inline void do_warn(string_stream& acc, const x& datum, const xs&... rest)
}
template<typename... xs>
-never_inline void warn_(const char* file, int line, const char* level, const xs&... seq)
+cc_noinline void warn_(const char* file, int line, const char* level, const xs&... seq)
{
using namespace warn_detail;
string_stream stream;