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-121040: Use __attribute__((fallthrough)) by vstinner · Pull Request #121044 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Jun 26, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Annotate explicitly "fall through" switch cases with a new _Py_FALLTHROUGH macro which uses attribute((fallthrough)) if available.

Fix warnings when using -Wimplicit-fallthrough compiler flag.

  • Issue: -Wimplicit-fallthrough generating warnings #121040

Sorry, something went wrong.

Uh oh!

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

All reactions
@vstinner
pythongh-121040: Use __attribute__((fallthrough))
bb2eb56
Annotate explicitly "fall through" switch cases with a new
_Py_FALLTHROUGH macro which uses __attribute__((fallthrough)) if
available.

Fix warnings when using -Wimplicit-fallthrough compiler flag.
@vstinner vstinner added the skip news label Jun 26, 2024
@vstinner
vstinner requested review from brettcannon, corona10, ericsnowcurrently, gpshead, iritkatriel, markshannon, ncoghlan, tiran and warsaw as code owners June 26, 2024 12:52
@bedevere-app bedevere-app Bot mentioned this pull request Jun 26, 2024
-Wimplicit-fallthrough generating warnings #121040
Closed
@bedevere-app bedevere-app Bot added the awaiting core review label Jun 26, 2024
@vstinner

vstinner commented Jun 26, 2024

Copy link
Copy Markdown
Member Author

cc @sobolevn

All reactions

Sorry, something went wrong.

Uh oh!

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

sobolevn
sobolevn reviewed Jun 26, 2024
View reviewed changes

@sobolevn sobolevn 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.

Looks like you need to run make regen-cases (or maybe even make regen-all) :)

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Include/pyport.h Resolved

Uh oh!

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

vstinner added 2 commits June 26, 2024 15:06
@vstinner
Run make regen-cases
f892e8b
@vstinner
mention -Wimplicit-fallthrough in _Py_FALLTHROUGH doc
32f3cf9
@vstinner

vstinner commented Jun 26, 2024

Copy link
Copy Markdown
Member Author

Looks like you need to run make regen-cases (or maybe even make regen-all) :)

Done.

All reactions

Sorry, something went wrong.

Uh oh!

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

@mdboom

mdboom commented Jun 26, 2024

Copy link
Copy Markdown
Contributor

Maybe of interest to @nohlson.

All reactions

Sorry, something went wrong.

Uh oh!

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

AlexWaygood
AlexWaygood reviewed Jun 26, 2024
View reviewed changes
Comment thread Include/pyport.h Resolved

Uh oh!

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

@vstinner
Add _Py__has_attribute() macro
3bfdbf6
No longer define __has_attribute() if it's not defined.

Move also _Py__has_builtin() at the top of pyport.h.
ericsnowcurrently
ericsnowcurrently approved these changes Jun 26, 2024
View reviewed changes

@ericsnowcurrently ericsnowcurrently 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

I left one small comment where you might consider a slightly different spelling, but I'll leave that up to you.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Python/pyhash.c Resolved

Uh oh!

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

@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Jun 26, 2024
@brettcannon
brettcannon removed their request for review June 26, 2024 17:35
vstinner added 2 commits June 27, 2024 11:17
@vstinner
Fix typo in the doc
bfea265
@vstinner
Merge branch 'main' into fallthrough
cdc2102
@vstinner
vstinner enabled auto-merge (squash) June 27, 2024 09:38
@vstinner

vstinner commented Jun 27, 2024

Copy link
Copy Markdown
Member Author

I tested my change with -Wimplicit-fallthrough=5 which ignores all comments. There are only remaining comments on Modules/expat/ when --with-system-expat is not used, not in the Python code base anymore.

See also the article about the flag: https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner
vstinner merged commit 12af8ec into python:main Jun 27, 2024
@vstinner
vstinner deleted the fallthrough branch June 27, 2024 09:58
@bedevere-app bedevere-app Bot removed the awaiting merge label Jun 27, 2024
mrahtz pushed a commit to mrahtz/cpython that referenced this pull request Jun 30, 2024
@vstinner @sobolevn @mrahtz
pythongh-121040: Use __attribute__((fallthrough)) (python#121044)
638d523
Fix warnings when using -Wimplicit-fallthrough compiler flag.

Annotate explicitly "fall through" switch cases with a new
_Py_FALLTHROUGH macro which uses __attribute__((fallthrough)) if
available. Replace "fall through" comments with _Py_FALLTHROUGH.

Add _Py__has_attribute() macro. No longer define __has_attribute()
macro if it's not defined. Move also _Py__has_builtin() at the top
of pyport.h.

Co-Authored-By: Nikita Sobolev <[email protected]>
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
@vstinner @sobolevn @estyxx
pythongh-121040: Use __attribute__((fallthrough)) (python#121044)
f1286b8
Fix warnings when using -Wimplicit-fallthrough compiler flag.

Annotate explicitly "fall through" switch cases with a new
_Py_FALLTHROUGH macro which uses __attribute__((fallthrough)) if
available. Replace "fall through" comments with _Py_FALLTHROUGH.

Add _Py__has_attribute() macro. No longer define __has_attribute()
macro if it's not defined. Move also _Py__has_builtin() at the top
of pyport.h.

Co-Authored-By: Nikita Sobolev <[email protected]>
@ZeroIntensity ZeroIntensity mentioned this pull request Jan 16, 2025
GCC style fallthrough attribute is used with clang versions that don't support it #128902
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@sobolevn sobolevn sobolevn left review comments
@AlexWaygood AlexWaygood AlexWaygood left review comments
@ericsnowcurrently ericsnowcurrently ericsnowcurrently approved these changes
@corona10 corona10 Awaiting requested review from corona10 corona10 is a code owner
@ncoghlan ncoghlan Awaiting requested review from ncoghlan ncoghlan is a code owner
@warsaw warsaw Awaiting requested review from warsaw warsaw is a code owner
@gpshead gpshead Awaiting requested review from gpshead gpshead is a code owner
@tiran tiran Awaiting requested review from tiran
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner
@iritkatriel iritkatriel Awaiting requested review from iritkatriel iritkatriel is a code owner

Uh oh!

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

Assignees

No one assigned

Labels

skip news

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.

6 participants

@vstinner @mdboom @ericsnowcurrently @sobolevn @corona10 @AlexWaygood
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 01402503 — 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.