Patchwork compat: define ssize_t as int on 32bit Windows, silences C4142 warning

login
register
mail settings
Submitter Yuya Nishihara
Date July 15, 2016, 3:17 p.m.
Message ID <8268c3bd8718213a46ae.1468595839@mimosa>
Download mbox | patch
Permalink /patch/15878/
State Accepted
Headers show

Comments

Yuya Nishihara - July 15, 2016, 3:17 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1468594496 -32400
#      Fri Jul 15 23:54:56 2016 +0900
# Node ID 8268c3bd8718213a46ae5ff1d3d674fe77a815a7
# Parent  2a692364f43bf27862ab001b905c5c8d61e59e6d
compat: define ssize_t as int on 32bit Windows, silences C4142 warning

It appears Python.h provides ssize_t, which is aliased to int.

https://hg.python.org/cpython/file/v2.7.11/PC/pyconfig.h#l205
Adrian Buehlmann - July 15, 2016, 4:10 p.m.
On 2016-07-15 17:17, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1468594496 -32400
> #      Fri Jul 15 23:54:56 2016 +0900
> # Node ID 8268c3bd8718213a46ae5ff1d3d674fe77a815a7
> # Parent  2a692364f43bf27862ab001b905c5c8d61e59e6d
> compat: define ssize_t as int on 32bit Windows, silences C4142 warning
> 
> It appears Python.h provides ssize_t, which is aliased to int.
> 
> https://hg.python.org/cpython/file/v2.7.11/PC/pyconfig.h#l205
> 
> diff --git a/mercurial/compat.h b/mercurial/compat.h
> --- a/mercurial/compat.h
> +++ b/mercurial/compat.h
> @@ -8,7 +8,7 @@
>  #if defined(_WIN64)
>  typedef __int64 ssize_t;
>  #else
> -typedef long ssize_t;
> +typedef int ssize_t;
>  #endif
>  typedef signed char int8_t;
>  typedef short int16_t;

LGTM
Augie Fackler - July 15, 2016, 5:27 p.m.
On Sat, Jul 16, 2016 at 12:17:19AM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1468594496 -32400
> #      Fri Jul 15 23:54:56 2016 +0900
> # Node ID 8268c3bd8718213a46ae5ff1d3d674fe77a815a7
> # Parent  2a692364f43bf27862ab001b905c5c8d61e59e6d
> compat: define ssize_t as int on 32bit Windows, silences C4142 warning
>

queued, thanks

>
> It appears Python.h provides ssize_t, which is aliased to int.
>
> https://hg.python.org/cpython/file/v2.7.11/PC/pyconfig.h#l205
>
> diff --git a/mercurial/compat.h b/mercurial/compat.h
> --- a/mercurial/compat.h
> +++ b/mercurial/compat.h
> @@ -8,7 +8,7 @@
>  #if defined(_WIN64)
>  typedef __int64 ssize_t;
>  #else
> -typedef long ssize_t;
> +typedef int ssize_t;
>  #endif
>  typedef signed char int8_t;
>  typedef short int16_t;
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/compat.h b/mercurial/compat.h
--- a/mercurial/compat.h
+++ b/mercurial/compat.h
@@ -8,7 +8,7 @@ 
 #if defined(_WIN64)
 typedef __int64 ssize_t;
 #else
-typedef long ssize_t;
+typedef int ssize_t;
 #endif
 typedef signed char int8_t;
 typedef short int16_t;