[PATCH] compat: provide a new declaration of hg_ssize_t, in case we don't have it

Maciej Fijalkowski fijall at gmail.com
Mon Jul 11 09:26:32 EDT 2016


The working workaround (it's a bit hard to test) seems to be:

#if defined(_MSC_VER)
#include <BaseTsd.h>
typedef SSIZE_T hg_ssize_t;
#else
typedef ssize_t hg_ssize_t
#endif

any opinions?

On Mon, Jul 11, 2016 at 3:12 PM, Yuya Nishihara <yuya at tcha.org> wrote:
> On Mon, 11 Jul 2016 13:53:47 +0200, Maciej Fijalkowski wrote:
>> # HG changeset patch
>> # User Maciej Fijalkowski <fijall at gmail.com>
>> # Date 1468238015 -7200
>> #      Mon Jul 11 13:53:35 2016 +0200
>> # Node ID 069b332ce21d278384f0b571349b9aba57b42056
>> # Parent  b40939504d0e01e3a7f067b8cf49f26718a7c27c
>> compat: provide a new declaration of hg_ssize_t, in case we don't have it
>>
>> diff -r b40939504d0e -r 069b332ce21d 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
>> @@ -35,4 +35,14 @@
>>  #define inline __inline
>>  #endif
>>
>> +#ifdef HAVE_SSIZE_T
>
> HAVE_SSIZE_T seems to be defined in pyconfig.h, which won't be available
> for cffi build.
>
>> +typedef ssize_t hg_ssize_t;
>> +#elif sizeof(void*) == sizeof(long long)
>
> sizeof() and C types can't be used in preprocessor.
>
>> +typedef long long hg_ssize_t;
>> +#elif sizeof(void*) == sizeof(long)
>> +typedef long hg_ssize_t;
>> +#else
>> +typedef int hg_ssize_t;
>>  #endif
>
> Maybe we'll have to write a workaround specific to Windows?


More information about the Mercurial-devel mailing list