Skip to content

Commit 82fe59f

Browse files
author
nitrocaster
committed
Move compiler-specific definitions to Compiler.inl.
1 parent 5a49463 commit 82fe59f

File tree

2 files changed

+28
-23
lines changed

2 files changed

+28
-23
lines changed

src/Common/Compiler.inl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
11
#if !defined(__GNUC__) && !defined(_MSC_VER)
22
#error Unsupported compiler
33
#endif
4+
5+
#if defined(__GNUC__)
6+
#define XR_EXPORT __attribute__ ((visibility("default")))
7+
#define XR_IMPORT __attribute__ ((visibility("default")))
8+
#elif defined(_MSC_VER)
9+
#define XR_EXPORT __declspec(dllexport)
10+
#define XR_IMPORT __declspec(dllimport)
11+
#endif
12+
13+
#if defined(__GNUC__)
14+
#define NO_INLINE __attribute__((noinline))
15+
#define FORCE_INLINE __attribute__((always_inline)) inline
16+
#define ALIGN(a) __attribute__((aligned(a)))
17+
#elif defined(_MSC_VER)
18+
#define NO_INLINE __declspec(noinline)
19+
#define FORCE_INLINE __forceinline
20+
#define ALIGN(a) __declspec(align(a))
21+
#define __thread __declspec(thread)
22+
#endif
23+
24+
// XXX: remove
25+
#define _inline inline
26+
#define __inline inline
27+
28+
// XXX: remove IC/ICF/ICN
29+
#define IC inline
30+
#define ICF FORCE_INLINE
31+
#define ICN NO_INLINE

src/Common/Platform.hpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,6 @@
1717

1818
#include "Common/Compiler.inl"
1919

20-
#ifdef __GNUC__
21-
#define XR_EXPORT __attribute__ ((visibility("default")))
22-
#define XR_IMPORT __attribute__ ((visibility("default")))
23-
#else // _MSC_VER
24-
#define XR_EXPORT __declspec(dllexport)
25-
#define XR_IMPORT __declspec(dllimport)
26-
#endif
27-
28-
// inline control - redefine to use compiler's heuristics ONLY
29-
// it seems "IC" is misused in many places which cause code-bloat
30-
// ...and VC7.1 really don't miss opportunities for inline :)
31-
#define _inline inline
32-
#define __inline inline
33-
#define IC inline
34-
#ifdef _EDITOR
35-
# define ICF inline
36-
# define ICN
37-
#else
38-
# define ICF __forceinline // !!! this should be used only in critical places found by PROFILER
39-
# define ICN __declspec (noinline)
40-
#endif
41-
#define ALIGN(a) __declspec(align(a))
42-
4320
#include <ctime>
4421
#include <sys\utime.h>
4522

0 commit comments

Comments
 (0)