diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-02-11 15:52:03 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-02-11 18:44:03 +0100 |
commit | aa3b01a556a60ce09123e93263642193da86982b (patch) | |
tree | 37c89d7e9350c2cb2d8fc48792966af790df0e29 | |
parent | 1f17378532c24e2442b9fff8ccb5ea0b0936a2c0 (diff) |
compat/macros: remove prefix
Let's not be concerned about global namespace pollution. These
identifiers aren't exposed in the api/ directory.
-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 | ||||
-rw-r--r-- | filter-accela/ftnoir_filter_accela.cpp | 2 | ||||
-rw-r--r-- | logic/pipeline.cpp | 6 | ||||
-rw-r--r-- | options/globals.hpp | 6 | ||||
-rw-r--r-- | options/group.hpp | 2 | ||||
-rw-r--r-- | options/value.hpp | 12 | ||||
-rw-r--r-- | proto-ft/ftnoir_protocol_ft.cpp | 2 | ||||
-rw-r--r-- | tracker-steamvr/steamvr.hpp | 2 |
13 files changed, 37 insertions, 50 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; } }; diff --git a/filter-accela/ftnoir_filter_accela.cpp b/filter-accela/ftnoir_filter_accela.cpp index 3795a8f0..5fa1676f 100644 --- a/filter-accela/ftnoir_filter_accela.cpp +++ b/filter-accela/ftnoir_filter_accela.cpp @@ -21,7 +21,7 @@ accela::accela() } template<typename F> -cc_noinline +never_inline static void do_deltas(const double* deltas, double* output, F&& fun) { constexpr unsigned N = 3; diff --git a/logic/pipeline.cpp b/logic/pipeline.cpp index 81ee05b2..bc8026ed 100644 --- a/logic/pipeline.cpp +++ b/logic/pipeline.cpp @@ -217,7 +217,7 @@ static inline bool is_nan(const dmat<u,w>& r) return false; } -static cc_noinline +static never_inline void emit_nan_check_msg(const char* text, const char* fun, int line) { eval_once( @@ -229,7 +229,7 @@ void emit_nan_check_msg(const char* text, const char* fun, int line) } template<typename... xs> -static cc_noinline +static never_inline bool maybe_nan(const char* text, const char* fun, int line, const xs&... vals) { bool ret = (is_nan(vals) || ... || false); @@ -243,7 +243,7 @@ bool maybe_nan(const char* text, const char* fun, int line, const xs&... vals) #define nan_check(...) \ do \ { \ - if (likely(!maybe_nan(#__VA_ARGS__, cc_function_name, __LINE__, __VA_ARGS__))) \ + if (likely(!maybe_nan(#__VA_ARGS__, function_name, __LINE__, __VA_ARGS__))) \ (void)0; \ else \ goto error; \ diff --git a/options/globals.hpp b/options/globals.hpp index 5b392055..ae7f8e4d 100644 --- a/options/globals.hpp +++ b/options/globals.hpp @@ -29,12 +29,12 @@ struct OTR_OPTIONS_EXPORT saver_ final { ini_ctx& ctx; - cc_noinline ~saver_(); - explicit cc_noinline saver_(ini_ctx& ini); + never_inline ~saver_(); + explicit never_inline saver_(ini_ctx& ini); }; template<typename F> -cc_noinline +never_inline auto with_settings_object_(ini_ctx& ini, F&& fun) { saver_ saver { ini }; diff --git a/options/group.hpp b/options/group.hpp index 76bb939b..45e9353c 100644 --- a/options/group.hpp +++ b/options/group.hpp @@ -31,7 +31,7 @@ namespace options::detail { void put(const QString& s, const QVariant& d); bool contains(const QString& s) const; - cc_noinline QVariant get_variant(const QString& name) const; + never_inline QVariant get_variant(const QString& name) const; }; } // ns options::detail diff --git a/options/value.hpp b/options/value.hpp index 3478e842..18a5ae9b 100644 --- a/options/value.hpp +++ b/options/value.hpp @@ -42,7 +42,7 @@ class value final : public value_ const t def; using traits = detail::value_traits<t>; - cc_noinline + never_inline auto get() const noexcept { if (!b->contains(self_name)) @@ -56,7 +56,7 @@ class value final : public value_ return traits::pass_value(traits::value_with_default(traits::value_from_qvariant(variant), def)); } - cc_noinline + never_inline void store_variant(QVariant&& value) noexcept override { if (traits::is_equal(get(), traits::value_from_qvariant(value))) @@ -68,7 +68,7 @@ class value final : public value_ b->store_kv(self_name, traits::qvariant_from_value(def)); } - cc_noinline + never_inline void store_variant(const QVariant& value) noexcept override { QVariant copy{value}; @@ -136,15 +136,15 @@ public: operator t() const { return get(); } template<typename u> - explicit cc_forceinline operator u() const { return to<u>(); } + explicit force_inline operator u() const { return to<u>(); } auto operator->() const noexcept { return detail::dereference_wrapper{get()}; } - cc_forceinline auto operator()() const noexcept { return get(); } - cc_forceinline auto operator*() const noexcept { return get(); } + force_inline auto operator()() const noexcept { return get(); } + force_inline auto operator*() const noexcept { return get(); } template<typename u> u to() const noexcept diff --git a/proto-ft/ftnoir_protocol_ft.cpp b/proto-ft/ftnoir_protocol_ft.cpp index 874f83da..46879475 100644 --- a/proto-ft/ftnoir_protocol_ft.cpp +++ b/proto-ft/ftnoir_protocol_ft.cpp @@ -23,7 +23,7 @@ freetrack::~freetrack() static_assert(sizeof(LONG) == sizeof(std::int32_t)); static_assert(sizeof(LONG) == 4u); -cc_noinline void store(float volatile& place, const float value) +never_inline void store(float volatile& place, const float value) { union { diff --git a/tracker-steamvr/steamvr.hpp b/tracker-steamvr/steamvr.hpp index c6f31fa9..61da2e05 100644 --- a/tracker-steamvr/steamvr.hpp +++ b/tracker-steamvr/steamvr.hpp @@ -48,7 +48,7 @@ struct device_list final void refresh_device_list(); const QList<device_spec>& devices() const { return device_specs; } - static cc_noinline maybe_pose get_pose(int k); + static never_inline maybe_pose get_pose(int k); static QString error_string(vr_error_t error); static constexpr unsigned max_devices = vr::k_unMaxTrackedDeviceCount; |