diff options
Diffstat (limited to 'compat')
-rw-r--r-- | compat/base-path.hpp | 2 | ||||
-rw-r--r-- | compat/check-visible.hpp | 2 | ||||
-rw-r--r-- | compat/macros1.h | 37 | ||||
-rw-r--r-- | compat/math.hpp | 2 | ||||
-rw-r--r-- | compat/run-in-thread.hpp | 2 | ||||
-rw-r--r-- | compat/shm.h | 10 |
6 files changed, 21 insertions, 34 deletions
diff --git a/compat/base-path.hpp b/compat/base-path.hpp index e80f541f..54e094f4 100644 --- a/compat/base-path.hpp +++ b/compat/base-path.hpp @@ -5,7 +5,7 @@ #include <QString> -OTR_COMPAT_EXPORT cc_noinline +OTR_COMPAT_EXPORT never_inline const QString& application_base_path(); #define OPENTRACK_BASE_PATH (application_base_path()) diff --git a/compat/check-visible.hpp b/compat/check-visible.hpp index 40ec27bb..e24260ab 100644 --- a/compat/check-visible.hpp +++ b/compat/check-visible.hpp @@ -5,7 +5,7 @@ class QWidget; -cc_noinline OTR_COMPAT_EXPORT +never_inline OTR_COMPAT_EXPORT void set_is_visible(QWidget const& w, bool force = false); OTR_COMPAT_EXPORT diff --git a/compat/macros1.h b/compat/macros1.h index 148e1a77..96c09af4 100644 --- a/compat/macros1.h +++ b/compat/macros1.h @@ -1,15 +1,15 @@ #pragma once #if defined _MSC_VER -# define cc_noinline __declspec(noinline) +# define never_inline __declspec(noinline) #else -# define cc_noinline __attribute__((noinline)) +# define never_inline __attribute__((noinline)) #endif #if defined _MSC_VER -# define cc_forceinline __forceinline +# define force_inline __forceinline #else -# define cc_forceinline __attribute__((always_inline)) +# define force_inline __attribute__((always_inline)) #endif #if !defined likely @@ -23,31 +23,18 @@ #endif #if defined _MSC_VER -# define cc_function_name __FUNCSIG__ +# define function_name __FUNCSIG__ #else -# define cc_function_name __PRETTY_FUNCTION__ +# define function_name __PRETTY_FUNCTION__ #endif -#if !defined PP_CAT -# define PP_CAT(x,y) PP_CAT1(x,y) -# define PP_CAT1(x,y) PP_CAT2(x,y) -# define PP_CAT2(x,y) x ## y -#endif - -#ifndef PP_EXPAND -# define PP_EXPAND(x) PP_EXPAND2(x) -# define PP_EXPAND2(x) PP_EXPAND3(x) x -# define PP_EXPAND3(x) x -#endif +#define PP_CAT(x,y) PP_CAT1(x,y) +#define PP_CAT1(x,y) PP_CAT2(x,y) +#define PP_CAT2(x,y) x ## y -#ifdef _MSC_VER -//# include <windows.h> -//# define FULL_BARRIER MemoryBarrier() -# define COMPILER_BARRIER() _ReadWriteBarrier() -#else -//# define FULL_BARRIER() __sync_synchronize() -# define COMPILER_BARRIER() asm volatile("" ::: "memory") -#endif +#define PP_EXPAND(x) PP_EXPAND2(x) +#define PP_EXPAND2(x) PP_EXPAND3(x) x +#define PP_EXPAND3(x) x #ifdef _MSC_VER # define unreachable() __assume(0) diff --git a/compat/math.hpp b/compat/math.hpp index fa4ff4a6..b8cba8f2 100644 --- a/compat/math.hpp +++ b/compat/math.hpp @@ -66,7 +66,7 @@ inline auto uround(t val) -> std::enable_if_t<std::is_floating_point_v<remove_cv } template <typename t> -static cc_forceinline constexpr int signum(const t& x) +static force_inline constexpr int signum(const t& x) { return x < t{0} ? -1 : 1; } diff --git a/compat/run-in-thread.hpp b/compat/run-in-thread.hpp index 6aadab45..b8ffc179 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 cc_noinline +auto never_inline 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 814ce90c..5ea6c80a 100644 --- a/compat/shm.h +++ b/compat/shm.h @@ -32,10 +32,10 @@ class OTR_COMPAT_EXPORT shm_wrapper final #endif public: - 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(); + 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(); inline void* ptr() { return mem; } }; |