Skip to content

-Wimplicit-fallthrough generating warnings #121040

Description

@nohlson

Bug report

Bug description:

Due to the addition of -Wimplicit-fallthrough as a BASEFLAG new warnings are generated.

This should be reverted until tooling is created to track these new warnings per #112301

Warnings can be found in builds https://buildbot.python.org/all/#/builders/721/builds/1465/steps/3/logs/warnings__143_ from #121030

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added a commit that references this issue on Jun 26, 2024
  2. sobolevn commented on Jun 26, 2024

    @sobolevn
    Member

    A potential fix could look something like:

    #if __has_attribute(__fallthrough__)
    #  define _Py_FALLTHROUGH __attribute__((__fallthrough__))
    #else
    #  define _Py_FALLTHROUGH do { } while (0)
    #endif
  3. added 2 commits that reference this issue on Jun 26, 2024
  4. vstinner commented on Jun 26, 2024

    @vstinner
    Member
  5. vstinner commented on Jun 26, 2024

    @vstinner
    Member

    A potential fix could look something like: (...)

    I wrote PR gh-121044 to fix these compiler warnings; the PR adds a new _Py_FALLTHROUGH macro.

  6. corona10 commented on Jun 26, 2024

    @corona10
    Member

    A potential fix could look something like:

    It can not be the ultimate solution.

    • Should check MSVC is accept this macro. (or do nothing if the compiler is MSVC)
    • Even if we added the macro for our codebase, vendored libraries like libexpat should follow the new compiler rule.
  7. vstinner commented on Jun 26, 2024

    @vstinner
    Member

    Should check MSVC is accept this macro. (or do nothing if the compiler is MSVC)

    Does MSC implement a flag like -Wimplicit-fallthrough? If not, I don't think that we should care about MSC in _Py_FALLTHROUGH macro.

    Even if we added the macro for our codebase, vendored libraries like libexpat should follow the new compiler rule.

    If you want to use this compiler flag, you can use system libraries, instead of building embedded copies of libexpat and libmpdecimal.

  8. corona10 commented on Jun 26, 2024

    @corona10
    Member

    If you want to use this compiler flag, you can use system libraries, instead of building embedded copies of libexpat and libmpdecimal.

    IIUC, the original intention was to adopt that compiler flag as default, not optional.

  9. corona10 commented on Jun 26, 2024

    @corona10
    Member

    Does MSC implement a flag like -Wimplicit-fallthrough? If not, I don't think that we should care about MSC in _Py_FALLTHROUGH macro.

    But it emits the compiler warning so we should provide dummy macro for the MSVC
    see: https://github.com/python/cpython/pull/121044/files#r1654967484

  10. vstinner commented on Jun 26, 2024

    @vstinner
    Member

    But it emits the compiler warning so we should provide dummy macro for the MSVC
    see: https://github.com/python/cpython/pull/121044/files#r1654967484

    You misunderstood the warning. It was only about __has_attribute(). I fixed this issue.

  11. added a commit that references this issue on Jun 27, 2024
  12. vstinner commented on Jun 27, 2024

    @vstinner
    Member

    Warnings were fixed by 12af8ec. I close the issue.

  13. added 2 commits that reference this issue on Jun 30, 2024
  14. added 2 commits that reference this issue on Jul 11, 2024
  15. added 2 commits that reference this issue on Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions