File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -156,7 +156,7 @@ complete listing.
156156.. c :macro :: Py_UNUSED(arg)
157157
158158 Use this for unused arguments in a function definition to silence compiler
159- warnings, e.g. `` PyObject* func(PyObject * Py_UNUSED(ignored)) ``.
159+ warnings. Example: `` int func(int a, int Py_UNUSED(b)) { return a; } ``.
160160
161161 .. versionadded :: 3.4
162162
Original file line number Diff line number Diff line change 8989/* Check if pointer "p" is aligned to "a"-bytes boundary. */
9090#define _Py_IS_ALIGNED (p , a ) (!((uintptr_t)(p) & (uintptr_t)((a) - 1)))
9191
92- #ifdef __GNUC__
93- #define Py_UNUSED (name ) _unused_ ## name __attribute__((unused))
92+ /* Use this for unused arguments in a function definition to silence compiler
93+ * warnings. Example:
94+ *
95+ * int func(int a, int Py_UNUSED(b)) { return a; }
96+ */
97+ #if defined(__GNUC__ ) || defined(__clang__ )
98+ # define Py_UNUSED (name ) _unused_ ## name __attribute__((unused))
9499#else
95- #define Py_UNUSED (name ) _unused_ ## name
100+ # define Py_UNUSED (name ) _unused_ ## name
96101#endif
97102
98103#define Py_UNREACHABLE () abort()
You can’t perform that action at this time.
0 commit comments