Skip to content

Commit 4bb31e9

Browse files
committed
Fix a clang warning in grammar.c
Clang is smarter than GCC and emits a warning for dead code after a function declared with __attribute__((__noreturn__)) (Py_FatalError).
1 parent 7fbce56 commit 4bb31e9

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Parser/grammar.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,13 @@ findlabel(labellist *ll, int type, const char *str)
122122
}
123123
fprintf(stderr, "Label %d/'%s' not found\n", type, str);
124124
Py_FatalError("grammar.c:findlabel()");
125+
126+
/* Py_FatalError() is declared with __attribute__((__noreturn__)).
127+
GCC emits a warning without "return 0;" (compiler bug!), but Clang is
128+
smarter and emits a warning on the return... */
129+
#ifndef __clang__
125130
return 0; /* Make gcc -Wall happy */
131+
#endif
126132
}
127133

128134
/* Forward */

0 commit comments

Comments
 (0)