git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Michael Lohmann <mi.al.lohmann@gmail.com>
Cc: git@vger.kernel.org,  phillip.wood123@gmail.com,
	phillip.wood@dunelm.org.uk,  wanja.hentze@bevuta.com
Subject: Re: [PATCH v3] builtin/revert.c: refactor using an enum for cmd-action
Date: Thu, 11 Jan 2024 16:40:25 -0800	[thread overview]
Message-ID: <xmqqttnjcrk6.fsf@gitster.g> (raw)
In-Reply-To: <20240111200627.64199-1-mi.al.lohmann@gmail.com> (Michael Lohmann's message of "Thu, 11 Jan 2024 21:06:27 +0100")

Michael Lohmann <mi.al.lohmann@gmail.com> writes:

> -	if (cmd == 'c')
> +	case ACTION_CONTINUE:
>  		return sequencer_continue(the_repository, opts);
> -	if (cmd == 'a')
> +	case ACTION_ABORT:
>  		return sequencer_rollback(the_repository, opts);
> -	if (cmd == 's')
> +	case ACTION_SKIP:
>  		return sequencer_skip(the_repository, opts);
> -	return sequencer_pick_revisions(the_repository, opts);
> +	case ACTION_START:
> +		return sequencer_pick_revisions(the_repository, opts);
> +	}
>  }

This change broke the build when merged to 'seen' like so ...

builtin/revert.c: In function 'run_sequencer':
builtin/revert.c:242:1: error: control reaches end of non-void function [-Werror=return-typ ]
  242 | }
      | ^
 
... so I'm discarding
it out of my tree and redoing today's integration cycle.

Different compilers are smart in different ways, and we shouldn't
overly rely on the fact that some compilers may be happy by seeing a
switch that has all the enum values and notice that one of the return
will be triggered in its case arms.




  parent reply	other threads:[~2024-01-12  0:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-11  8:04 [PATCH] builtin/revert.c: refactor using an enum for cmd-action Michael Lohmann
2024-01-11 16:57 ` Phillip Wood
2024-01-11 17:47   ` [PATCH v2] " Michael Lohmann
2024-01-11 19:50     ` Junio C Hamano
2024-01-11 20:06       ` [PATCH v3] " Michael Lohmann
2024-01-11 21:47         ` Junio C Hamano
2024-01-12  0:40         ` Junio C Hamano [this message]
2024-01-12  7:24         ` Jeff King
2024-01-12 18:13           ` Junio C Hamano
2024-01-12 19:33             ` Michael Lohmann
2024-01-11 19:37   ` [PATCH] " Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqttnjcrk6.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=mi.al.lohmann@gmail.com \
    --cc=phillip.wood123@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=wanja.hentze@bevuta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).