Issue #28152: Fix -Wunreachable-code warning on clang

Replace 0 with (0) to ignore a compiler warning about dead code on
"((int)(SEM_VALUE_MAX) < 0)": SEM_VALUE_MAX is not negative on Linux.
This commit is contained in:
Victor Stinner 2016-12-05 18:00:42 +01:00
parent 44d9bea1b8
commit 408bfa6d96
1 changed files with 5 additions and 2 deletions

View File

@ -171,8 +171,11 @@ PyInit__multiprocessing(void)
{ {
PyObject *py_sem_value_max; PyObject *py_sem_value_max;
/* Some systems define SEM_VALUE_MAX as an unsigned value that /* Some systems define SEM_VALUE_MAX as an unsigned value that
* causes it to be negative when used as an int (NetBSD). */ * causes it to be negative when used as an int (NetBSD).
if ((int)(SEM_VALUE_MAX) < 0) *
* Issue #28152: Use (0) instead of 0 to fix a warning on dead code
* when using clang -Wunreachable-code. */
if ((int)(SEM_VALUE_MAX) < (0))
py_sem_value_max = PyLong_FromLong(INT_MAX); py_sem_value_max = PyLong_FromLong(INT_MAX);
else else
py_sem_value_max = PyLong_FromLong(SEM_VALUE_MAX); py_sem_value_max = PyLong_FromLong(SEM_VALUE_MAX);