Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-128902: Fix check for fallthrough attribute support#128903

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ned-deily merged 2 commits intopython:mainfromjmroot:fallthrough
Jan 22, 2025

Conversation

@jmroot
Copy link
Contributor

@jmrootjmroot commentedJan 16, 2025
edited by bedevere-appbot
Loading

Clang versions prior to 10 (which corresponds to Apple Clang 12) do not support the GCC extension syntax__attribute__((fallthrough)), but do evaluate__has_attribute(fallthrough) to 1 because they support the C++11 style syntax[[fallthrough]]. The only way to tell if the GCC style syntax is supported is thus to check the clang version.

Ref:llvm/llvm-project@1e0affb

Clang versions prior to 10 (which corresponds to Apple Clang 12) do notsupport the GCC extension syntax __attribute__((fallthrough)), but doevaluate __has_attribute(fallthrough) to 1 because they support theC++11 style syntax [[fallthrough]]. The only way to tell if the GCCstyle syntax is supported is thus to check the clang version.Ref:llvm/llvm-project@1e0affb
Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM.

@pablogsal@ambv@ned-deily: I would appreciate if one of you can also review this change, since I don't have access to macOS.

@ned-deily
Copy link
Member

@jmroot Thanks for the PR, as always. On the surface it looks OK to me but I was not successful in creating a failing test environment to check the fix. Following the comment in the PR, I tested with the current HEAD of cpython main (3.14) on macOS 10.14.6 with both the relevant Apple Command Line Tools - LLVM version 10.0.1 (clang-1001.0.46.4) - and then with MacPorts clang version 9.0.1 by removing a _Py_FALLTHROUGH guard and with./configure --enable-safety to enable-Wimplicit-fallthrough. No fallthrough warnings were generated with either compiler with or without the PR. However, on a current macOS / Xcode configuration (macOS 15.2 / Apple clang version 16.0.0 (clang-1600.0.26.6)), the unguarded fallthrough is warned with or without the PR, as expected. I may be doing something wrong in my testing but it would be good to ensure the comment is accurate. Can you say how this issue arose and how to reproduce?

@jmroot
Copy link
ContributorAuthor

Can you say how this issue arose and how to reproduce?

It arose in routine builds of the 3.14 alphas on our buildbots. Here's the first log I found demonstrating the issue:https://build.macports.org/builders/ports-10.9_x86_64-builder/builds/299390/steps/install-port/logs/stdio

I think unknown attributes are supposed to be ignored, so there may be another bug in the mix causing the build failures. It seems pretty clear from the LLVM commit that clang versions less than 10 don't support the attribute, but perhaps only some are harmed by it.

ned-deily reacted with thumbs up emoji

@ned-deily
Copy link
Member

Thanks for the buildbot log which shows the failure when building on macOS 10.9 with the default Command Line Tools for that version. I am able to reproduce the failure on 10.9 and can verify that the PR does fix that failure. So it may be that the comments about particular clang versions are overly restrictive but, given that these older OS and compiler versions are no longer supported upstream and, more importantly, that the fallthrough warnings will show up on builds of the same source with newer compilers, let's not worry about the exact wording.

BTW, while this PR gets past this problem when building on macOS 10.9, there appears to be other build issues using this compiler and SDK on 10.9 (i.e.SSE4.1 instruction set not enabled inModules/_hacl) that may require you to move to a newer version of clang for 3.14.

jmroot reacted with thumbs up emoji

@ned-deilyned-deily merged commitedf8033 intopython:mainJan 22, 2025
45 checks passed
@vstinner
Copy link
Member

Thanks for your fix@jmroot.

@jmrootjmroot deleted the fallthrough branchJanuary 22, 2025 09:52
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@vstinnervstinnervstinner approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@jmroot@ned-deily@vstinner

[8]ページ先頭

©2009-2025 Movatter.jp