[issue14656] Add a macro for unreachable code

Benjamin Peterson report at bugs.python.org
Tue Apr 24 01:06:33 CEST 2012


Benjamin Peterson <benjamin at python.org> added the comment:

2012/4/23 Martin v. Löwis <report at bugs.python.org>:
>
> Martin v. Löwis <martin at v.loewis.de> added the comment:
>
>>> What's the specific warning that you want to eliminate?
>>
>> "control reaches end of non-void function without return"
>>
>> Basically, whenever you see "assert(0)" today.
>
> Sorry, what I meant is: what specific line (in what specific
> source file) is that warning on?
>
> If there is an assert(0) somewhere, there should be no
> subsequent code, so no such warning should be generated.

Right, we currently avoid this problem by writing "assert(0)" for
example in lookdict_split in dictobject.c. What I'm saying is that
instead writing "assert(0)", we could use Py_UNREACHABLE.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14656>
_______________________________________


More information about the Python-bugs-list mailing list