[Python-checkins] cpython: Issue #28152: Fix -Wunreachable-code warning on clang

victor.stinner python-checkins at python.org
Mon Dec 5 12:03:13 EST 2016


https://hg.python.org/cpython/rev/7c7055305f69
changeset:   105464:7c7055305f69
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Mon Dec 05 18:00:42 2016 +0100
summary:
  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.

files:
  Modules/_multiprocessing/multiprocessing.c |  7 +++++--
  1 files changed, 5 insertions(+), 2 deletions(-)


diff --git a/Modules/_multiprocessing/multiprocessing.c b/Modules/_multiprocessing/multiprocessing.c
--- a/Modules/_multiprocessing/multiprocessing.c
+++ b/Modules/_multiprocessing/multiprocessing.c
@@ -171,8 +171,11 @@
     {
         PyObject *py_sem_value_max;
         /* Some systems define SEM_VALUE_MAX as an unsigned value that
-         * causes it to be negative when used as an int (NetBSD). */
-        if ((int)(SEM_VALUE_MAX) < 0)
+         * causes it to be negative when used as an int (NetBSD).
+         *
+         * 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);
         else
             py_sem_value_max = PyLong_FromLong(SEM_VALUE_MAX);

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list