1 /* platform/compiler adjustments */ 2 #ifndef PG_PLATFORM_H 3 #define PG_PLATFORM_H 4 5 #if defined(HAVE_SNPRINTF) /* defined in python.h (pyerrors.h) and SDL.h \ 6 (SDL_config.h) */ 7 #undef HAVE_SNPRINTF /* remove GCC redefine warning */ 8 #endif /* HAVE_SNPRINTF */ 9 10 #ifndef PG_INLINE 11 #if defined(__clang__) 12 #define PG_INLINE __inline__ __attribute__((__unused__)) 13 #elif defined(__GNUC__) 14 #define PG_INLINE __inline__ 15 #elif defined(_MSC_VER) 16 #define PG_INLINE __inline 17 #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 18 #define PG_INLINE inline 19 #else 20 #define PG_INLINE 21 #endif 22 #endif /* ~PG_INLINE */ 23 24 // Worth trying this on MSVC/win32 builds to see if provides any speed up 25 #ifndef PG_FORCEINLINE 26 #if defined(__clang__) 27 #define PG_FORCEINLINE __inline__ __attribute__((__unused__)) 28 #elif defined(__GNUC__) 29 #define PG_FORCEINLINE __inline__ 30 #elif defined(_MSC_VER) 31 #define PG_FORCEINLINE __forceinline 32 #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 33 #define PG_FORCEINLINE inline 34 #else 35 #define PG_FORCEINLINE 36 #endif 37 #endif /* ~PG_FORCEINLINE */ 38 39 /* This is unconditionally defined in Python.h */ 40 #if defined(_POSIX_C_SOURCE) 41 #undef _POSIX_C_SOURCE 42 #endif 43 44 /* No signal() */ 45 #if defined(__SYMBIAN32__) && defined(HAVE_SIGNAL_H) 46 #undef HAVE_SIGNAL_H 47 #endif 48 49 #if defined(HAVE_SNPRINTF) 50 #undef HAVE_SNPRINTF 51 #endif 52 53 /* SDL needs WIN32 */ 54 #if !defined(WIN32) && \ 55 (defined(MS_WIN32) || defined(_WIN32) || \ 56 defined(__WIN32) || defined(__WIN32__) || defined(_WINDOWS)) 57 #define WIN32 58 #endif 59 60 /* Commenting out SSE4_2 stuff because it does not do runtime detection. 61 #ifndef PG_TARGET_SSE4_2 62 #if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 9) || __GNUC__ >= 5 )) 63 //The old gcc 4.8 on centos used by manylinux1 does not seem to get sse4.2 intrinsics 64 #define PG_FUNCTION_TARGET_SSE4_2 __attribute__((target("sse4.2"))) 65 // No else; we define the fallback later 66 #endif 67 #endif 68 */ 69 /* ~PG_TARGET_SSE4_2 */ 70 71 /* 72 #ifdef PG_FUNCTION_TARGET_SSE4_2 73 #if !defined(__SSE4_2__) && !defined(PG_COMPILE_SSE4_2) 74 #if defined(__x86_64__) || defined(__i386__) 75 #define PG_COMPILE_SSE4_2 1 76 #endif 77 #endif 78 #endif 79 */ 80 /* ~PG_TARGET_SSE4_2 */ 81 82 /* Fallback definition of target attribute */ 83 #ifndef PG_FUNCTION_TARGET_SSE4_2 84 #define PG_FUNCTION_TARGET_SSE4_2 85 #endif 86 87 #ifndef PG_COMPILE_SSE4_2 88 #define PG_COMPILE_SSE4_2 0 89 #endif 90 91 #endif /* ~PG_PLATFORM_H */ 92