File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 112112 // Implement Py_MIN(), Py_MAX() and Py_ABS() using _Py_TYPEOF() and
113113 // statement expression to only evaluate each argument only once.
114114 // It cannot be used in C++: ISO C++ forbids braced-groups within
115- // expressions. Statement expression is a GNU extension.
115+ // expressions. Statement expression is a GNU extension. Use __extension__
116+ // to avoid compiler warning in pedantic mode.
116117
117118 /* Minimum value between x and y */
118119# define Py_MIN (x, y ) \
120+ __extension__ \
119121 ({ _Py_TYPEOF (x) _x = (x); \
120122 _Py_TYPEOF (y) _y = (y); \
121123 _x < _y ? _x : _y; })
122124 /* Maximum value between x and y */
123125# define Py_MAX (x, y ) \
126+ __extension__ \
124127 ({ _Py_TYPEOF (x) _x = (x); \
125128 _Py_TYPEOF (y) _y = (y); \
126129 _x > _y ? _x : _y; })
127130 /* Absolute value of the number x */
128131# define Py_ABS (x ) \
132+ __extension__ \
129133 ({ _Py_TYPEOF (x) _x = (x); \
130134 _x < 0 ? -_x : _x; })
131135#else
You can’t perform that action at this time.
0 commit comments