summaryrefslogtreecommitdiffhomepage
path: root/compat
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-04-12 01:39:50 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-04-12 01:47:45 +0200
commit9996a3eb72611304ae26f97729a92e99d07cfda2 (patch)
treef7e4a3c7ab5248f290f662af35ce2cd1ed1dedff /compat
parentef76246a9afc12c735ea8e0317d45b9c474a3e5a (diff)
compat/util: add few attribute macros
Diffstat (limited to 'compat')
-rw-r--r--compat/util.hpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/compat/util.hpp b/compat/util.hpp
index ee462d0e..60427b53 100644
--- a/compat/util.hpp
+++ b/compat/util.hpp
@@ -78,3 +78,23 @@ template<typename t> using qshared = QSharedPointer<t>;
#else
# define OTR_NEVER_INLINE
#endif
+
+#if defined _MSC_VER || defined __GNUG__
+# define OTR_RESTRICT __restrict
+#else
+# define OTR_RESTRICT
+#endif
+
+#if defined _MSC_VER
+# define OTR_ALWAYS_INLINE __forceinline
+#elif defined __GNUG__
+# define OTR_ALWAYS_INLINE __attribute__((always_inline))
+#else
+# define OTR_ALWAYS_INLINE inline
+#endif
+
+#if defined __GNUG__
+# define OTR_FLATTEN __attribute__((flatten))
+#else
+# define OTR_FLATTEN OTR_ALWAYS_INLINE
+#endif