]> granicus.if.org Git - python/commitdiff
Fix a clang warning in grammar.c
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 19 Aug 2016 13:11:56 +0000 (15:11 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 19 Aug 2016 13:11:56 +0000 (15:11 +0200)
Clang is smarter than GCC and emits a warning for dead code after a function
declared with __attribute__((__noreturn__)) (Py_FatalError).

Parser/grammar.c

index b598294a4aad4a720f1c07414564c75a05388406..e2cce28a8d6ae2b5c2be249785badc8a737d0998 100644 (file)
@@ -122,7 +122,13 @@ findlabel(labellist *ll, int type, const char *str)
     }
     fprintf(stderr, "Label %d/'%s' not found\n", type, str);
     Py_FatalError("grammar.c:findlabel()");
+
+    /* Py_FatalError() is declared with __attribute__((__noreturn__)).
+       GCC emits a warning without "return 0;" (compiler bug!), but Clang is
+       smarter and emits a warning on the return... */
+#ifndef __clang__
     return 0; /* Make gcc -Wall happy */
+#endif
 }
 
 /* Forward */