8000 bpo-41875: Use __builtin_unreachable when possible by corona10 · Pull Request #22433 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-41875: Use __builtin_unreachable when possible #22433

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

Merged
merged 2 commits into from
Sep 28, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
8000
Diff view
Diff view
Next Next commit
bpo-41875: Use __builtin_unreachable when possible
  • Loading branch information
corona10 committed Sep 28, 2020
commit c3694a15fa68fe8e7da5a0da7d478b2dfd5fd9dd
4 changes: 3 additions & 1 deletion Include/pymacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@
"We've reached an unreachable state. Anything is possible.\n" \
"The limits were in our heads all along. Follow your dreams.\n" \
"https://xkcd.com/2200")
#elif defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER)
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
# define Py_UNREACHABLE() __builtin_unreachable()
#elif defined(__clang__) || defined(__INTEL_COMPILER)
# define Py_UNREACHABLE() __builtin_unreachable()
#elif defined(_MSC_VER)
# define Py_UNREACHABLE() __assume(0)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Update :c:macro:`Py_UNREACHABLE` to use __builtin_unreachable() if only the
compiler is able to use it. Patch by Dong-hee Na.
0