File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -156,7 +156,7 @@ complete listing.
156
156
.. c :macro :: Py_UNUSED(arg)
157
157
158
158
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; } ``.
160
160
161
161
.. versionadded :: 3.4
162
162
Original file line number Diff line number Diff line change 89
89
/* Check if pointer "p" is aligned to "a"-bytes boundary. */
90
90
#define _Py_IS_ALIGNED (p , a ) (!((uintptr_t)(p) & (uintptr_t)((a) - 1)))
91
91
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))
94
99
#else
95
- #define Py_UNUSED (name ) _unused_ ## name
100
+ # define Py_UNUSED (name ) _unused_ ## name
96
101
#endif
97
102
98
103
#define Py_UNREACHABLE () abort()
You can’t perform that action at this time.
0 commit comments