Visitar URL original
Implement Py_UNUSED() for Windows MSVC compiler · Issue #107249 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20240503030401/https://github.com/python/cpython/issues/107249
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Py_UNUSED() for Windows MSVC compiler #107249

Closed
vstinner opened this issue Jul 25, 2023 · 0 comments
Closed

Implement Py_UNUSED() for Windows MSVC compiler #107249

vstinner opened this issue Jul 25, 2023 · 0 comments
Labels
type-feature A feature request or enhancement

Comments

@vstinner
Copy link
Member

vstinner commented Jul 25, 2023 •

The Py_UNUSED() is not implemented for the Windows MSVC compiler.

Example with this function included by Python.h: see #107239 (comment)

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

Without my 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

With my change, no warnings are emitted!

Linked PRs

@vstinner vstinner added the type-feature A feature request or enhancement label Jul 25, 2023
vstinner added a commit to vstinner/cpython that referenced this issue Jul 25, 2023
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.
vstinner added a commit that referenced this issue Jul 25, 2023
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.
jtcave pushed a commit to jtcave/cpython that referenced this issue Jul 27, 2023
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants