bpo-40102: Improve XLC support for attributes

This commit is contained in:
Batuhan Taskaya 2020-03-29 19:33:16 +03:00
parent 0003c2dc1d
commit 5c5b98a2a9
2 changed files with 7 additions and 5 deletions

View File

@ -16,7 +16,8 @@
#define __has_attribute(x) 0 // Compatibility with non-clang compilers.
#endif
#if (defined(__GNUC__) && (__GNUC__ >= 4)) ||\
(defined(__clang__) && __has_attribute(visibility))
(defined(__clang__) && __has_attribute(visibility)) ||\
defined(__xlc__)
#define Py_IMPORTED_SYMBOL __attribute__ ((visibility ("default")))
#define Py_EXPORTED_SYMBOL __attribute__ ((visibility ("default")))
#define Py_LOCAL_SYMBOL __attribute__ ((visibility ("hidden")))

View File

@ -503,8 +503,9 @@ extern "C" {
* Py_DEPRECATED(3.4) typedef int T1;
* Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);
*/
#if defined(__GNUC__) \
&& ((__GNUC__ >= 4) || (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))
#if (defined(__GNUC__) \
&& ((__GNUC__ >= 4) || (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) ||\
defined(__xlc__)
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
#elif defined(_MSC_VER)
#define Py_DEPRECATED(VERSION) __declspec(deprecated( \
@ -545,7 +546,7 @@ extern "C" {
*/
#if defined(_MSC_VER)
# define _Py_NO_INLINE __declspec(noinline)
#elif defined(__GNUC__) || defined(__clang__)
#elif defined(__GNUC__) || defined(__clang__) || defined(__xlc__)
# define _Py_NO_INLINE __attribute__ ((noinline))
#else
# define _Py_NO_INLINE
@ -738,7 +739,7 @@ extern char * _getpty(int *, int, mode_t, int);
/*
* Specify alignment on compilers that support it.
*/
#if defined(__GNUC__) && __GNUC__ >= 3
#if (defined(__GNUC__) && __GNUC__ >= 3) || defined(__xlc__)
#define Py_ALIGNED(x) __attribute__((aligned(x)))
#else
#define Py_ALIGNED(x)