diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-20 20:26:44 +0100 | 
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-24 19:32:10 +0100 | 
| commit | 1b1e0f4ef7ae31e2721e6a32a84548e66f4244ef (patch) | |
| tree | 9aac1e1c7553c2b7ae547cbc139e3d1287494786 | |
| parent | 6c2dbc95c317b94c82b909aeddef82c2c33116ff (diff) | |
compat/macros: split off the real macro-only file
| -rw-r--r-- | compat/macros.hpp | 42 | ||||
| -rw-r--r-- | compat/macros1.h | 41 | 
2 files changed, 43 insertions, 40 deletions
| diff --git a/compat/macros.hpp b/compat/macros.hpp index f905ad6c..deb9c9bf 100644 --- a/compat/macros.hpp +++ b/compat/macros.hpp @@ -1,46 +1,8 @@  #pragma once -#if defined _MSC_VER -#   define cc_noinline __declspec(noinline) -#else -#   define cc_noinline __attribute__((noinline)) -#endif - -#if defined _MSC_VER -#   define cc_forceinline __forceinline -#else -#   define cc_forceinline __attribute__((always_inline)) -#endif - -#if !defined likely -#   if defined __GNUC__ -#      define likely(x)       __builtin_expect(!!(x),1) -#      define unlikely(x)     __builtin_expect(!!(x),0) -#   else -#      define likely(x) (x) -#      define unlikely(x) (x) -#   endif -#endif - -#if defined _MSC_VER -#   define cc_function_name __FUNCSIG__ -#else -#   define cc_function_name __PRETTY_FUNCTION__ -#endif - -#if !defined PP_CAT -#   define PP_CAT(x,y) PP_CAT1(x,y) -#   define PP_CAT1(x,y) PP_CAT2(x,y) -#   define PP_CAT2(x,y) x ## y -#endif - -#ifndef PP_EXPAND -#   define PP_EXPAND(x) PP_EXPAND__2(x) -#   define PP_EXPAND__2(x) PP_EXPAND__3(x) x -#   define PP_EXPAND__3(x) x -#endif +#include "macros1.h" -#if defined __cplusplus +#ifdef __cplusplus  // from now only C++ diff --git a/compat/macros1.h b/compat/macros1.h new file mode 100644 index 00000000..fd2d4585 --- /dev/null +++ b/compat/macros1.h @@ -0,0 +1,41 @@ +#pragma once + +#if defined _MSC_VER +#   define cc_noinline __declspec(noinline) +#else +#   define cc_noinline __attribute__((noinline)) +#endif + +#if defined _MSC_VER +#   define cc_forceinline __forceinline +#else +#   define cc_forceinline __attribute__((always_inline)) +#endif + +#if !defined likely +#   if defined __GNUC__ +#      define likely(x)       __builtin_expect(!!(x),1) +#      define unlikely(x)     __builtin_expect(!!(x),0) +#   else +#      define likely(x) (x) +#      define unlikely(x) (x) +#   endif +#endif + +#if defined _MSC_VER +#   define cc_function_name __FUNCSIG__ +#else +#   define cc_function_name __PRETTY_FUNCTION__ +#endif + +#if !defined PP_CAT +#   define PP_CAT(x,y) PP_CAT1(x,y) +#   define PP_CAT1(x,y) PP_CAT2(x,y) +#   define PP_CAT2(x,y) x ## y +#endif + +#ifndef PP_EXPAND +#   define PP_EXPAND(x) PP_EXPAND__2(x) +#   define PP_EXPAND__2(x) PP_EXPAND__3(x) x +#   define PP_EXPAND__3(x) x +#endif | 
