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

victor.stinner python-checkins at python.org
Mon Dec 5 11:57:54 EST 2016


https://hg.python.org/cpython/rev/390fbb9c5e59
changeset:   105463:390fbb9c5e59
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Mon Dec 05 17:55:36 2016 +0100
summary:
  Issue #28152: Fix -Wunreachable-code warning on clang

Replace C if() with precompiler #if to fix a warning on dead code when using
clang.

files:
  Modules/zipimport.c |  10 +++++-----
  1 files changed, 5 insertions(+), 5 deletions(-)


diff --git a/Modules/zipimport.c b/Modules/zipimport.c
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -998,13 +998,13 @@
             goto file_error;
         }
         name[name_size] = '\0';  /* Add terminating null byte */
-        if (SEP != '/') {
-            for (i = 0; i < name_size; i++) {
-                if (name[i] == '/') {
-                    name[i] = SEP;
-                }
+#if SEP != '/'
+        for (i = 0; i < name_size; i++) {
+            if (name[i] == '/') {
+                name[i] = SEP;
             }
         }
+#endif
         /* Skip the rest of the header.
          * On Windows, calling fseek to skip over the fields we don't use is
          * slower than reading the data because fseek flushes stdio's

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


More information about the Python-checkins mailing list