Skip to content

Commit ad65f4d

Browse files
committed
Only use statement expression on GCC and clang
1 parent 21764e4 commit ad65f4d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Include/pymacro.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,12 @@
107107
# endif
108108
#endif
109109

110-
#if defined(_Py_TYPEOF) && !defined(__cplusplus)
110+
#if ((defined(__GNUC__) || defined(__clang__)) \
111+
&& defined(_Py_TYPEOF) && !defined(__cplusplus))
111112
// Implement Py_MIN(), Py_MAX() and Py_ABS() using _Py_TYPEOF() and
112113
// statement expression to only evaluate each argument only once.
113114
// It cannot be used in C++: ISO C++ forbids braced-groups within
114-
// expressions.
115+
// expressions. Statement expression is a GNU extension.
115116

116117
/* Minimum value between x and y */
117118
# define Py_MIN(x, y) \

0 commit comments

Comments
 (0)