From 9996a3eb72611304ae26f97729a92e99d07cfda2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 12 Apr 2017 01:39:50 +0200 Subject: compat/util: add few attribute macros --- compat/util.hpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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 using qshared = QSharedPointer; #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 -- cgit v1.2.3