Re: [PATCH v2 01/13] push: do not pretend to return `int` from `die_push_simple()`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Junio,

On Fri, 4 Oct 2019, Junio C Hamano wrote:

> "Johannes Schindelin via GitGitGadget" <gitgitgadget@xxxxxxxxx>
> writes:
>
> > From: Johannes Schindelin <johannes.schindelin@xxxxxx>
> >
> > This function is marked as `NORETURN`, and it indeed does not want to
> > return anything. So let's not declare it with the return type `int`.
> > This fixes the following warning when building with MSVC:
> >
> > 	C4646: function declared with 'noreturn' has non-void return type
> >
> > Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx>
> > ---
> >  builtin/push.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/builtin/push.c b/builtin/push.c
> > index 021dd3b1e4..d216270d5f 100644
> > --- a/builtin/push.c
> > +++ b/builtin/push.c
> > @@ -143,8 +143,8 @@ static int push_url_of_remote(struct remote *remote, const char ***url_p)
> >  	return remote->url_nr;
> >  }
> >
> > -static NORETURN int die_push_simple(struct branch *branch,
> > -				    struct remote *remote)
> > +static NORETURN void die_push_simple(struct branch *branch,
> > +				     struct remote *remote)
>
> Haha ;-)  "I won't return and I'll return int" sounds like an
> oxymoron.

Funny, right? ;-)

I was a bit concerned that GCC did not catch it, nor Clang, but hey,
that's the benefit of compiling with more than just one compiler.

Ciao,
Dscho

>
> >  {
> >  	/*
> >  	 * There's no point in using shorten_unambiguous_ref here,
>




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux