bpo-41875: Use __builtin_unreachable when possible (GH-22433)

This commit is contained in:
Dong-hee Na 2020-09-29 05:41:23 +09:00 committed by GitHub
parent ff9147d93b
commit 24ba3b0df5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -118,7 +118,9 @@
"We've reached an unreachable state. Anything is possible.\n" \ "We've reached an unreachable state. Anything is possible.\n" \
"The limits were in our heads all along. Follow your dreams.\n" \ "The limits were in our heads all along. Follow your dreams.\n" \
"https://xkcd.com/2200") "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() # define Py_UNREACHABLE() __builtin_unreachable()
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
# define Py_UNREACHABLE() __assume(0) # define Py_UNREACHABLE() __assume(0)

View File

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