Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3ab61473
Commit
3ab61473
authored
Sep 12, 2019
by
Zachary Ware
Committed by
Gregory P. Smith
Sep 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enhance Py_UNREACHABLE macro (GH-16032)
parent
224b8aaa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
Include/pymacro.h
Include/pymacro.h
+26
-0
No files found.
Include/pymacro.h
View file @
3ab61473
...
@@ -100,6 +100,32 @@
...
@@ -100,6 +100,32 @@
# define Py_UNUSED(name) _unused_ ## name
# define Py_UNUSED(name) _unused_ ## name
#endif
#endif
#if defined(RANDALL_WAS_HERE)
#define Py_UNREACHABLE() do { \
fputs( \
"ERROR:\n\n" \
"If you're seeing this, the code is in what I thought was\n" \
"an unreachable state.\n\n" \
"I could give you advice for what to do, but honestly, why\n" \
"should you trust me? I clearly screwed this up. I'm writing\n" \
"a message that should never appear, yet I know it will\n" \
"probably appear someday.\n\n" \
"On a deep level, I know I'm not up to this task.\n" \
"I'm so sorry.\n\n" \
"https://xkcd.com/2200\n", stderr); \
abort(); \
} while(0)
#elif defined(Py_DEBUG)
#define Py_UNREACHABLE() do { \
fputs( \
"ERROR:\n\n" \
"We've reached an unreachable state. Anything is possible.\n" \
"The limits were in our heads all along. Follow your dreams.\n\n" \
"https://xkcd.com/2200\n", stderr); \
abort(); \
} while(0)
#else
#define Py_UNREACHABLE() abort()
#define Py_UNREACHABLE() abort()
#endif
#endif
/* Py_PYMACRO_H */
#endif
/* Py_PYMACRO_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment