Patchwork compat: provide a declaration of ssize_t, for MS windows

login
register
mail settings
Submitter Maciej Fijalkowski
Date July 12, 2016, 5:16 p.m.
Message ID <54968a2233db1823fa11.1468343788@brick.arcode.com>
Download mbox | patch
Permalink /patch/15803/
State Superseded
Headers show

Comments

Maciej Fijalkowski - July 12, 2016, 5:16 p.m.
# HG changeset patch
# User Maciej Fijalkowski <fijall@gmail.com>
# Date 1468238015 -7200
#      Mon Jul 11 13:53:35 2016 +0200
# Node ID 54968a2233db1823fa11f47dcc99395097bae3b4
# Parent  b40939504d0e01e3a7f067b8cf49f26718a7c27c
compat: provide a declaration of ssize_t, for MS windows
Adrian Buehlmann - July 12, 2016, 6:01 p.m.
On 2016-07-12 19:16, Maciej Fijalkowski wrote:
> # HG changeset patch
> # User Maciej Fijalkowski <fijall@gmail.com>
> # Date 1468238015 -7200
> #      Mon Jul 11 13:53:35 2016 +0200
> # Node ID 54968a2233db1823fa11f47dcc99395097bae3b4
> # Parent  b40939504d0e01e3a7f067b8cf49f26718a7c27c
> compat: provide a declaration of ssize_t, for MS windows
> 
> diff -r b40939504d0e -r 54968a2233db mercurial/compat.h
> --- a/mercurial/compat.h	Mon Jul 11 11:05:08 2016 +0200
> +++ b/mercurial/compat.h	Mon Jul 11 13:53:35 2016 +0200
> @@ -5,6 +5,8 @@
>  #ifdef _MSC_VER
>  /* msvc 6.0 has problems */
>  #define inline __inline
> +#include <BaseTsd.h>
> +typedef SSIZE_T ssize_t;
>  typedef signed char int8_t;
>  typedef short int16_t;
>  typedef long int32_t;

Perhaps, this can be simplified to:

#if defined(_WIN64)
 typedef __int64 ssize_t;
#else
 typedef long ssize_t;
#endif

(and thusly avoiding including BaseTsd.h ...)
Sean Farley - July 12, 2016, 11:19 p.m.
Adrian Buehlmann <adrian@cadifra.com> writes:

> On 2016-07-12 19:16, Maciej Fijalkowski wrote:
>> # HG changeset patch
>> # User Maciej Fijalkowski <fijall@gmail.com>
>> # Date 1468238015 -7200
>> #      Mon Jul 11 13:53:35 2016 +0200
>> # Node ID 54968a2233db1823fa11f47dcc99395097bae3b4
>> # Parent  b40939504d0e01e3a7f067b8cf49f26718a7c27c
>> compat: provide a declaration of ssize_t, for MS windows
>> 
>> diff -r b40939504d0e -r 54968a2233db mercurial/compat.h
>> --- a/mercurial/compat.h	Mon Jul 11 11:05:08 2016 +0200
>> +++ b/mercurial/compat.h	Mon Jul 11 13:53:35 2016 +0200
>> @@ -5,6 +5,8 @@
>>  #ifdef _MSC_VER
>>  /* msvc 6.0 has problems */
>>  #define inline __inline
>> +#include <BaseTsd.h>
>> +typedef SSIZE_T ssize_t;
>>  typedef signed char int8_t;
>>  typedef short int16_t;
>>  typedef long int32_t;
>
> Perhaps, this can be simplified to:
>
> #if defined(_WIN64)
>  typedef __int64 ssize_t;
> #else
>  typedef long ssize_t;
> #endif
>
> (and thusly avoiding including BaseTsd.h ...)

I like this suggestion.
Maciej Fijalkowski - July 13, 2016, 6:55 a.m.
can you guys commit the way you want it please? We've been
bikeshedding this simple change for like a week now. I have absolutely
zero opinion, I want to be able to use ssize_t. For all practical
purposes you can say typedef intptr_t ssize_t, but it does not work on
DOS16 or something like that

On Wed, Jul 13, 2016 at 1:19 AM, Sean Farley <sean@farley.io> wrote:
> Adrian Buehlmann <adrian@cadifra.com> writes:
>
>> On 2016-07-12 19:16, Maciej Fijalkowski wrote:
>>> # HG changeset patch
>>> # User Maciej Fijalkowski <fijall@gmail.com>
>>> # Date 1468238015 -7200
>>> #      Mon Jul 11 13:53:35 2016 +0200
>>> # Node ID 54968a2233db1823fa11f47dcc99395097bae3b4
>>> # Parent  b40939504d0e01e3a7f067b8cf49f26718a7c27c
>>> compat: provide a declaration of ssize_t, for MS windows
>>>
>>> diff -r b40939504d0e -r 54968a2233db mercurial/compat.h
>>> --- a/mercurial/compat.h     Mon Jul 11 11:05:08 2016 +0200
>>> +++ b/mercurial/compat.h     Mon Jul 11 13:53:35 2016 +0200
>>> @@ -5,6 +5,8 @@
>>>  #ifdef _MSC_VER
>>>  /* msvc 6.0 has problems */
>>>  #define inline __inline
>>> +#include <BaseTsd.h>
>>> +typedef SSIZE_T ssize_t;
>>>  typedef signed char int8_t;
>>>  typedef short int16_t;
>>>  typedef long int32_t;
>>
>> Perhaps, this can be simplified to:
>>
>> #if defined(_WIN64)
>>  typedef __int64 ssize_t;
>> #else
>>  typedef long ssize_t;
>> #endif
>>
>> (and thusly avoiding including BaseTsd.h ...)
>
> I like this suggestion.
Maciej Fijalkowski - July 13, 2016, 6:57 a.m.
It's additionally blocking all the other things I want to do on
mercurial, for really no reason whatsoever

On Wed, Jul 13, 2016 at 8:55 AM, Maciej Fijalkowski <fijall@gmail.com> wrote:
> can you guys commit the way you want it please? We've been
> bikeshedding this simple change for like a week now. I have absolutely
> zero opinion, I want to be able to use ssize_t. For all practical
> purposes you can say typedef intptr_t ssize_t, but it does not work on
> DOS16 or something like that
>
> On Wed, Jul 13, 2016 at 1:19 AM, Sean Farley <sean@farley.io> wrote:
>> Adrian Buehlmann <adrian@cadifra.com> writes:
>>
>>> On 2016-07-12 19:16, Maciej Fijalkowski wrote:
>>>> # HG changeset patch
>>>> # User Maciej Fijalkowski <fijall@gmail.com>
>>>> # Date 1468238015 -7200
>>>> #      Mon Jul 11 13:53:35 2016 +0200
>>>> # Node ID 54968a2233db1823fa11f47dcc99395097bae3b4
>>>> # Parent  b40939504d0e01e3a7f067b8cf49f26718a7c27c
>>>> compat: provide a declaration of ssize_t, for MS windows
>>>>
>>>> diff -r b40939504d0e -r 54968a2233db mercurial/compat.h
>>>> --- a/mercurial/compat.h     Mon Jul 11 11:05:08 2016 +0200
>>>> +++ b/mercurial/compat.h     Mon Jul 11 13:53:35 2016 +0200
>>>> @@ -5,6 +5,8 @@
>>>>  #ifdef _MSC_VER
>>>>  /* msvc 6.0 has problems */
>>>>  #define inline __inline
>>>> +#include <BaseTsd.h>
>>>> +typedef SSIZE_T ssize_t;
>>>>  typedef signed char int8_t;
>>>>  typedef short int16_t;
>>>>  typedef long int32_t;
>>>
>>> Perhaps, this can be simplified to:
>>>
>>> #if defined(_WIN64)
>>>  typedef __int64 ssize_t;
>>> #else
>>>  typedef long ssize_t;
>>> #endif
>>>
>>> (and thusly avoiding including BaseTsd.h ...)
>>
>> I like this suggestion.
Adrian Buehlmann - July 13, 2016, 8:05 a.m.
On 2016-07-13 08:57, Maciej Fijalkowski wrote:
> It's additionally blocking all the other things I want to do on
> mercurial, for really no reason whatsoever
> 
> On Wed, Jul 13, 2016 at 8:55 AM, Maciej Fijalkowski <fijall@gmail.com> wrote:
>> can you guys commit the way you want it please? We've been
>> bikeshedding this simple change for like a week now. I have absolutely
>> zero opinion, I want to be able to use ssize_t. For all practical
>> purposes you can say typedef intptr_t ssize_t, but it does not work on
>> DOS16 or something like that

I don't like the additional #include of a Windows specific header you
added in your proposed patch and I made a proposal how to do it instead.

I'm primarily interested in keeping things working. If you want to give
up on your patches, then I'm perfectly fine with that.

I'd say that replying with a rant certainly won't help getting things
done any faster.

Perhaps just simply use my proposal and send a revised version of your
patch?

Patch

diff -r b40939504d0e -r 54968a2233db mercurial/compat.h
--- a/mercurial/compat.h	Mon Jul 11 11:05:08 2016 +0200
+++ b/mercurial/compat.h	Mon Jul 11 13:53:35 2016 +0200
@@ -5,6 +5,8 @@ 
 #ifdef _MSC_VER
 /* msvc 6.0 has problems */
 #define inline __inline
+#include <BaseTsd.h>
+typedef SSIZE_T ssize_t;
 typedef signed char int8_t;
 typedef short int16_t;
 typedef long int32_t;