STINNER Victor added the comment:

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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue31338>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to