Skip to content

Commit

Permalink
Move compiler-specific definitions to Compiler.inl.
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocaster committed Jan 17, 2016
1 parent 5a49463 commit 82fe59f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
28 changes: 28 additions & 0 deletions src/Common/Compiler.inl
Original file line number Diff line number Diff line change
@@ -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
23 changes: 0 additions & 23 deletions src/Common/Platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ctime>
#include <sys\utime.h>

Expand Down

0 comments on commit 82fe59f

Please sign in to comment.