]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] gh-107249: Implement Py_UNUSED() for MSVC (GH-107250) (#127907)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 13 Dec 2024 11:58:47 +0000 (12:58 +0100)
committerGitHub <noreply@github.com>
Fri, 13 Dec 2024 11:58:47 +0000 (11:58 +0000)
commitf3a689fd9d5c762d92e43a7e1fb3ee7bfb27c452
tree65dd31de18db2b4e01bf03c96c8fa31259459ebc
parentb184f4859a32771bfa027c2a4cd2cdd3a5194842
[3.12] gh-107249: Implement Py_UNUSED() for MSVC (GH-107250) (#127907)

gh-107249: Implement Py_UNUSED() for MSVC (GH-107250)

Fix warnings C4100 in Py_UNUSED() when Python is built with "cl /W4".

Example with this function included by Python.h:

    static inline unsigned int
    PyUnicode_IS_READY(PyObject* Py_UNUSED(op))
    { return 1; }

Without this change, building a C program with "cl /W4" which just
includes Python.h emits the warning:

    Include\cpython/unicodeobject.h(199):
    warning C4100: '_unused_op': unreferenced formal parameter

This change fix this warning.
(cherry picked from commit 6a43cce32b66e0f66992119dd82959069b6f324a)

Co-authored-by: Victor Stinner <vstinner@python.org>
Include/pymacro.h
Misc/NEWS.d/next/C API/2023-07-25-17-23-08.gh-issue-107249.xqk2ke.rst [new file with mode: 0644]