From 82fe59f62cbf24707954ee557330218e59672187 Mon Sep 17 00:00:00 2001 From: nitrocaster Date: Sun, 17 Jan 2016 16:34:01 +0300 Subject: [PATCH] Move compiler-specific definitions to Compiler.inl. --- src/Common/Compiler.inl | 28 ++++++++++++++++++++++++++++ src/Common/Platform.hpp | 23 ----------------------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/Common/Compiler.inl b/src/Common/Compiler.inl index e2c9943b864..837f6ebaa2f 100644 --- a/src/Common/Compiler.inl +++ b/src/Common/Compiler.inl @@ -1,3 +1,31 @@ #if !defined(__GNUC__) && !defined(_MSC_VER) #error Unsupported compiler #endif + +#if defined(__GNUC__) +#define XR_EXPORT __attribute__ ((visibility("default"))) +#define XR_IMPORT __attribute__ ((visibility("default"))) +#elif defined(_MSC_VER) +#define XR_EXPORT __declspec(dllexport) +#define XR_IMPORT __declspec(dllimport) +#endif + +#if defined(__GNUC__) +#define NO_INLINE __attribute__((noinline)) +#define FORCE_INLINE __attribute__((always_inline)) inline +#define ALIGN(a) __attribute__((aligned(a))) +#elif defined(_MSC_VER) +#define NO_INLINE __declspec(noinline) +#define FORCE_INLINE __forceinline +#define ALIGN(a) __declspec(align(a)) +#define __thread __declspec(thread) +#endif + +// XXX: remove +#define _inline inline +#define __inline inline + +// XXX: remove IC/ICF/ICN +#define IC inline +#define ICF FORCE_INLINE +#define ICN NO_INLINE diff --git a/src/Common/Platform.hpp b/src/Common/Platform.hpp index 07d865f4f75..75589a8ace4 100644 --- a/src/Common/Platform.hpp +++ b/src/Common/Platform.hpp @@ -17,29 +17,6 @@ #include "Common/Compiler.inl" -#ifdef __GNUC__ -#define XR_EXPORT __attribute__ ((visibility("default"))) -#define XR_IMPORT __attribute__ ((visibility("default"))) -#else // _MSC_VER -#define XR_EXPORT __declspec(dllexport) -#define XR_IMPORT __declspec(dllimport) -#endif - -// inline control - redefine to use compiler's heuristics ONLY -// it seems "IC" is misused in many places which cause code-bloat -// ...and VC7.1 really don't miss opportunities for inline :) -#define _inline inline -#define __inline inline -#define IC inline -#ifdef _EDITOR -# define ICF inline -# define ICN -#else -# define ICF __forceinline // !!! this should be used only in critical places found by PROFILER -# define ICN __declspec (noinline) -#endif -#define ALIGN(a) __declspec(align(a)) - #include #include