summaryrefslogtreecommitdiff
path: root/builtin/commit.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2025-03-17 16:53:29 -0700
committerJunio C Hamano <gitster@pobox.com>2025-03-17 17:31:28 -0700
commit16f5d967e2267ea37cd29d7aee21994921b6b98c (patch)
treed305338726937e38c1a8d44b51af7d837a845ca6 /builtin/commit.c
parent82e79c63642c3e9815aab3433d9979afd173d07d (diff)
config.mak.dev: enable -Wunreachable-code
Having the compiler point out unreachable code can help avoid bugs, like the one discussed in: https://lore.kernel.org/git/20250307195057.GA3675279@coredump.intra.peff.net/ In that case it was found by Coverity, but finding it earlier saves everybody time and effort. We can use -Wunreachable-code to get some help from the compiler here. Interestingly, this is a noop in gcc. It was a real warning up until gcc 4.x, when it was removed for being too flaky, but they left the command-line option to avoid breaking users. See: https://stackoverflow.com/questions/17249934/why-does-gcc-not-warn-for-unreachable-code However, clang does implement this option, and it finds the case mentioned above (and no other cases within the code base). And since we run clang in several of our CI jobs, that's enough to get an early warning of breakage. We could enable it only for clang, but since gcc is happy to ignore it, it's simpler to just turn it on for all developer builds. Signed-off-by: Jeff King <peff@peff.net> [jc: squashed meson.build change sent by Patrick] Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit.c')
0 files changed, 0 insertions, 0 deletions