Re: [PATCH] config.mak.dev: enable -Wunreachable-code
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 10, 2025, 15:40 UTC
- Message-ID
- <xmqqfrjkao75.fsf@gitster.g>
- In-Reply-To
- <20250308032309.GA584028@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 24 quoted lines
> On Fri, Mar 07, 2025 at 05:54:45PM -0500, Jeff King wrote:
>
>> 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.
>
> Hmph, this might be more trouble than it is worth.
>
> After correcting the problem in the refs code, the osx CI builds (and
> only those) now fail with:
>
> run-command.c:519:3: error: code will never be executed [-Werror,-Wunreachable-code]
> die_errno("sigfillset");
> ^~~~~~~~~
> ...
> I guess a knob-less version is:
>
> errno = 0;
> sigfillset(&all); /* don't check return value! only errno */
> if (errno)
> die_errno("sigfillset");
>
> which is subtle, to say the least.Bah. This is just as horrible as some other warnings that are not enabled by default. I guess we should just be more vigilant X-<.
Thanks.