git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] run-command: fix an 'different modifiers' sparse warning
@ 2016-02-25 19:35 Ramsay Jones
  2016-02-25 20:20 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Ramsay Jones @ 2016-02-25 19:35 UTC (permalink / raw)
  To: Jeff King; +Cc: Junio C Hamano, GIT Mailing-list


Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---

Hi Jeff,

If you need to re-roll your 'jk/epipe-in-async' branch, could you
please squash this into the relevant patch. (ie. "write_or_die:
handle EPIPE in async threads", 24-02-2016).

Thanks!

ATB,
Ramsay Jones

 run-command.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/run-command.c b/run-command.c
index cd861bc..5dec18b 100644
--- a/run-command.c
+++ b/run-command.c
@@ -625,7 +625,7 @@ int in_async(void)
 	return !pthread_equal(main_thread, pthread_self());
 }
 
-void async_exit(int code)
+void NORETURN async_exit(int code)
 {
 	pthread_exit((void *)(intptr_t)code);
 }
@@ -675,7 +675,7 @@ int in_async(void)
 	return process_is_async;
 }
 
-int async_exit(int code)
+int NORETURN async_exit(int code)
 {
 	exit(code);
 }
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] run-command: fix an 'different modifiers' sparse warning
  2016-02-25 19:35 [PATCH] run-command: fix an 'different modifiers' sparse warning Ramsay Jones
@ 2016-02-25 20:20 ` Junio C Hamano
  2016-02-25 21:39   ` Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2016-02-25 20:20 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Jeff King, GIT Mailing-list

Ramsay Jones <ramsay@ramsayjones.plus.com> writes:

> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> ---
>
> Hi Jeff,
>
> If you need to re-roll your 'jk/epipe-in-async' branch, could you
> please squash this into the relevant patch. (ie. "write_or_die:
> handle EPIPE in async threads", 24-02-2016).
>
> Thanks!

I actually was planning to merge this to 'next' today, so I'll
squash it in without waiting for a reroll.

By the way, doesn't it bother anybody to give two different types to
the same function depending on NO_PTHREAD?  It is not a new issue
added by this series, but async_exit() that claims to return int
does not (naturally) return anything, and sparse does not seem to
care (neither do we).

>
> ATB,
> Ramsay Jones
>
>  run-command.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/run-command.c b/run-command.c
> index cd861bc..5dec18b 100644
> --- a/run-command.c
> +++ b/run-command.c
> @@ -625,7 +625,7 @@ int in_async(void)
>  	return !pthread_equal(main_thread, pthread_self());
>  }
>  
> -void async_exit(int code)
> +void NORETURN async_exit(int code)
>  {
>  	pthread_exit((void *)(intptr_t)code);
>  }
> @@ -675,7 +675,7 @@ int in_async(void)
>  	return process_is_async;
>  }
>  
> -int async_exit(int code)
> +int NORETURN async_exit(int code)
>  {
>  	exit(code);
>  }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] run-command: fix an 'different modifiers' sparse warning
  2016-02-25 20:20 ` Junio C Hamano
@ 2016-02-25 21:39   ` Jeff King
  2016-02-25 23:08     ` Ramsay Jones
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff King @ 2016-02-25 21:39 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Ramsay Jones, GIT Mailing-list

On Thu, Feb 25, 2016 at 12:20:12PM -0800, Junio C Hamano wrote:

> Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
> 
> > Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> > ---
> >
> > Hi Jeff,
> >
> > If you need to re-roll your 'jk/epipe-in-async' branch, could you
> > please squash this into the relevant patch. (ie. "write_or_die:
> > handle EPIPE in async threads", 24-02-2016).
> >
> > Thanks!
> 
> I actually was planning to merge this to 'next' today, so I'll
> squash it in without waiting for a reroll.

I am OK with that. But I do find it interesting that we must mark
NORETURN in both the declaration and the definition, but we don't for
__attribute__((format)).

> By the way, doesn't it bother anybody to give two different types to
> the same function depending on NO_PTHREAD?  It is not a new issue
> added by this series, but async_exit() that claims to return int
> does not (naturally) return anything, and sparse does not seem to
> care (neither do we).

It would have bothered me if I had noticed. :)

It is simply a bug, and sparse (and the compiler) do not notice it
because it only shows up if you compile with NO_PTHREADS=1. And I think
it is added by this series:

> > @@ -675,7 +675,7 @@ int in_async(void)
> >  	return process_is_async;
> >  }
> >  
> > -int async_exit(int code)
> > +int NORETURN async_exit(int code)

The return value on this one should be "void", too, of course.

-Peff

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] run-command: fix an 'different modifiers' sparse warning
  2016-02-25 21:39   ` Jeff King
@ 2016-02-25 23:08     ` Ramsay Jones
  0 siblings, 0 replies; 4+ messages in thread
From: Ramsay Jones @ 2016-02-25 23:08 UTC (permalink / raw)
  To: Jeff King, Junio C Hamano; +Cc: GIT Mailing-list



On 25/02/16 21:39, Jeff King wrote:
> On Thu, Feb 25, 2016 at 12:20:12PM -0800, Junio C Hamano wrote:
> 
>> Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
>>
>>> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
>>> ---
>>>
>>> Hi Jeff,
>>>
>>> If you need to re-roll your 'jk/epipe-in-async' branch, could you
>>> please squash this into the relevant patch. (ie. "write_or_die:
>>> handle EPIPE in async threads", 24-02-2016).
>>>
>>> Thanks!
>>
>> I actually was planning to merge this to 'next' today, so I'll
>> squash it in without waiting for a reroll.
> 
> I am OK with that. But I do find it interesting that we must mark
> NORETURN in both the declaration and the definition, but we don't for
> __attribute__((format)).
> 
>> By the way, doesn't it bother anybody to give two different types to
>> the same function depending on NO_PTHREAD?  It is not a new issue
>> added by this series, but async_exit() that claims to return int
>> does not (naturally) return anything, and sparse does not seem to
>> care (neither do we).
> 
> It would have bothered me if I had noticed. :)
> 
> It is simply a bug, and sparse (and the compiler) do not notice it
> because it only shows up if you compile with NO_PTHREADS=1. And I think
> it is added by this series:

Wow, I can't believe that I didn't notice this myself while editing
the file! :-D

ATB,
Ramsay Jones

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-25 23:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-25 19:35 [PATCH] run-command: fix an 'different modifiers' sparse warning Ramsay Jones
2016-02-25 20:20 ` Junio C Hamano
2016-02-25 21:39   ` Jeff King
2016-02-25 23:08     ` Ramsay Jones

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).