Message301335
> As suggested in http://bugs.python.org/issue31337#msg301229 it would be better to use
> abort() /* NOT REACHED */
Please don't use abort(), but add a new Py_UNREACHABLE() macro to allow to use a different code depending on the compiler/platform and compiler option (like release vs debug build).
> Can we use compiler-specific code like GCC's __builtin_unreachable()? This would help the optimizer.
That's a good example of better implementation for Py_UNREACHABLE().
The tricky part is to make compiler warnings quiet. For example, you cannot replace "abort(); return NULL;" with "abort()", because a function without return would emit a warning.
Maybe the default implementation of the macro should be:
#define Py_UNREACHABLE(stmt) abort(); stmt
I don't know if it would work. |
|
Date |
User |
Action |
Args |
2017-09-05 17:10:24 | vstinner | set | recipients:
+ vstinner, barry, rhettinger, pitrou, skrah, serhiy.storchaka |
2017-09-05 17:10:24 | vstinner | set | messageid: <1504631424.49.0.661108674272.issue31338@psf.upfronthosting.co.za> |
2017-09-05 17:10:24 | vstinner | link | issue31338 messages |
2017-09-05 17:10:24 | vstinner | create | |
|