git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] style: do not "break" in switch() after "return"

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 16, 2020, 00:35 UTC
Message-ID
<xmqqpn3a611j.fsf@gitster.c.googlers.com>
In-Reply-To
<xmqqtusm618e.fsf@gitster.c.googlers.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 18 quoted lines
> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
>
>> Remove this unreachable code. It was found by SunCC, it's found by a
>> non-fatal warning emitted by SunCC. It's one of the things it's more
>> vehement about than GCC & Clang.
>
> This is a borderline Meh to me.
>
> I am even tempted to suggest that, unless all other case arms
> return, iow, if there is even a single arm that breaks, it may even
> be more future-proof to end any and all case arms that do not
> fall-thru to consistently end with break.
>
> If there is some way to fix the compiler, that may be preferrable,
> but as I said, this is borderline Meh and I do not care too deeply
> either way.
>
> Thanks.

Heh, this patch cleanly applies even to the tip of 'maint', which means it is not a new issue at all. Is this caused by more recent SunCC than you used in the past?

Previous: Junio C HamanoNext: Ævar Arnfjörð Bjarmason
Message 4 of 7 in “[ANNOUNCE] Git v2.30.0-rc0”
  1. Junio C HamanoDec 14, 2020
  2. 2/2 style: do not "break" in switch() after "return"Ævar Arnfjörð Bjarmason, Dec 15, 2020
  3. Junio C HamanoDec 16, 2020
  4. Junio C HamanoDec 16, 2020
  5. 1/2 strmap: do not "return" in a void functionÆvar Arnfjörð Bjarmason, Dec 15, 2020
  6. Junio C HamanoDec 16, 2020
  7. 0/2 Make v2.30.0-rc0 compile on SunCCÆvar Arnfjörð Bjarmason, Dec 15, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.