All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] diffcore.h: be explicit about the signedness of is_binary
@ 2014-02-24  0:54 Richard Lowe
  2014-02-24  2:09 ` Jeff King
  2014-02-24 17:55 ` Junio C Hamano
  0 siblings, 2 replies; 3+ messages in thread
From: Richard Lowe @ 2014-02-24  0:54 UTC (permalink / raw)
  To: git; +Cc: Jeff King

Bitfields need to specify their signedness explicitly or the compiler is
free to default as it sees fit.  With compilers that default 'unsigned'
(SUNWspro 12 seems to do this) the tri-state nature of is_binary
vanishes and all files are treated as binary.

Signed-off-by: Richard Lowe <richlowe@richlowe.net>
---
 diffcore.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/diffcore.h b/diffcore.h
index 79de8cf..7c6f391 100644
--- a/diffcore.h
+++ b/diffcore.h
@@ -46,7 +46,7 @@ struct diff_filespec {
 	unsigned is_stdin : 1;
 	unsigned has_more_entries : 1; /* only appear in combined diff */
 	/* data should be considered "binary"; -1 means "don't know yet" */
-	int is_binary : 2;
+	signed int is_binary : 2;
 	struct userdiff_driver *driver;
 };
 
-- 
1.8.5.5

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

* Re: [PATCH] diffcore.h: be explicit about the signedness of is_binary
  2014-02-24  0:54 [PATCH] diffcore.h: be explicit about the signedness of is_binary Richard Lowe
@ 2014-02-24  2:09 ` Jeff King
  2014-02-24 17:55 ` Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff King @ 2014-02-24  2:09 UTC (permalink / raw)
  To: Richard Lowe; +Cc: git

On Sun, Feb 23, 2014 at 07:54:47PM -0500, Richard Lowe wrote:

> Bitfields need to specify their signedness explicitly or the compiler is
> free to default as it sees fit.  With compilers that default 'unsigned'
> (SUNWspro 12 seems to do this) the tri-state nature of is_binary
> vanishes and all files are treated as binary.
> 
> Signed-off-by: Richard Lowe <richlowe@richlowe.net>

Thanks, I wasn't aware of this corner of the standard when I wrote it.
Your fix is obviously correct.

-Peff

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

* Re: [PATCH] diffcore.h: be explicit about the signedness of is_binary
  2014-02-24  0:54 [PATCH] diffcore.h: be explicit about the signedness of is_binary Richard Lowe
  2014-02-24  2:09 ` Jeff King
@ 2014-02-24 17:55 ` Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2014-02-24 17:55 UTC (permalink / raw)
  To: Richard Lowe; +Cc: git, Jeff King

Richard Lowe <richlowe@richlowe.net> writes:

> Bitfields need to specify their signedness explicitly or the compiler is
> free to default as it sees fit.  With compilers that default 'unsigned'
> (SUNWspro 12 seems to do this) the tri-state nature of is_binary
> vanishes and all files are treated as binary.
>
> Signed-off-by: Richard Lowe <richlowe@richlowe.net>
> ---

Looks good; thanks.

>  diffcore.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/diffcore.h b/diffcore.h
> index 79de8cf..7c6f391 100644
> --- a/diffcore.h
> +++ b/diffcore.h
> @@ -46,7 +46,7 @@ struct diff_filespec {
>  	unsigned is_stdin : 1;
>  	unsigned has_more_entries : 1; /* only appear in combined diff */
>  	/* data should be considered "binary"; -1 means "don't know yet" */
> -	int is_binary : 2;
> +	signed int is_binary : 2;
>  	struct userdiff_driver *driver;
>  };

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

end of thread, other threads:[~2014-02-24 17:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-24  0:54 [PATCH] diffcore.h: be explicit about the signedness of is_binary Richard Lowe
2014-02-24  2:09 ` Jeff King
2014-02-24 17:55 ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.