1 /* platform/compiler adjustments */
5 #if defined(HAVE_SNPRINTF) /* defined in python.h (pyerrors.h) and SDL.h \
7 #undef HAVE_SNPRINTF /* remove GCC redefine warning */
8 #endif /* HAVE_SNPRINTF */
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
22 #endif /* ~PG_INLINE */
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
35 #define PG_FORCEINLINE
37 #endif /* ~PG_FORCEINLINE */
39 /* This is unconditionally defined in Python.h */
40 #if defined(_POSIX_C_SOURCE)
41 #undef _POSIX_C_SOURCE
45 #if defined(__SYMBIAN32__) && defined(HAVE_SIGNAL_H)
49 #if defined(HAVE_SNPRINTF)
54 #if !defined(WIN32) && \
55 (defined(MS_WIN32) || defined(_WIN32) || \
56 defined(__WIN32) || defined(__WIN32__) || defined(_WINDOWS))
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
69 /* ~PG_TARGET_SSE4_2 */
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
80 /* ~PG_TARGET_SSE4_2 */
82 /* Fallback definition of target attribute */
83 #ifndef PG_FUNCTION_TARGET_SSE4_2
84 #define PG_FUNCTION_TARGET_SSE4_2
87 #ifndef PG_COMPILE_SSE4_2
88 #define PG_COMPILE_SSE4_2 0
91 #endif /* ~PG_PLATFORM_H */