GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-128902: Fix check for fallthrough attribute support by jmroot · Pull Request #128903 · python/cpython

Conversation

@jmroot

@jmroot jmroot commented Jan 16, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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

  • Issue: GCC style fallthrough attribute is used with clang versions that don't support it #128902

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jmroot
Fix check for fallthrough attribute support
82bbdbd
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
@bedevere-app bedevere-app Bot mentioned this pull request Jan 16, 2025
GCC style fallthrough attribute is used with clang versions that don't support it #128902
Closed
@bedevere-app bedevere-app Bot added the awaiting review label Jan 16, 2025
@blurb-it @jmroot
📜🤖 Added by blurb_it.
e24773d
@jmroot
jmroot force-pushed the fallthrough branch from 17b7b50 to e24773d Compare January 16, 2025 03:40
vstinner
vstinner approved these changes Jan 16, 2025
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this 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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Jan 16, 2025
@ned-deily

ned-deily commented Jan 21, 2025

Copy link
Copy Markdown
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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jmroot

jmroot commented Jan 21, 2025

Copy link
Copy Markdown
Contributor Author

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
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ned-deily

ned-deily commented Jan 22, 2025

Copy link
Copy Markdown
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 in Modules/_hacl) that may require you to move to a newer version of clang for 3.14.

jmroot reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ned-deily
ned-deily merged commit edf8033 into python:main Jan 22, 2025
@bedevere-app bedevere-app Bot removed the awaiting merge label Jan 22, 2025
@vstinner

vstinner commented Jan 22, 2025

Copy link
Copy Markdown
Member

Thanks for your fix @jmroot.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jmroot
jmroot deleted the fallthrough branch January 22, 2025 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vstinner vstinner vstinner approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@jmroot @ned-deily @vstinner
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.