develooper Front page | perl.perl5.porters | Postings from January 2018

Re: [win32] perl.h now defines INTMAX_C and UINTMAX_C

Thread Previous | Thread Next
From:
sisyphus1
Date:
January 25, 2018 10:39
Subject:
Re: [win32] perl.h now defines INTMAX_C and UINTMAX_C
Message ID:
F24C8EDD45CC474D9BB4B093ADC3730E@OwnerPC311012


-----Original Message----- 
From: Karl Williamson
Sent: Thursday, January 25, 2018 12:46 PM
To: sisyphus1@optusnet.com.au ; perl5-porters@perl.org
Subject: Re: [win32] perl.h now defines INTMAX_C and UINTMAX_C

On 01/22/2018 09:10 PM, sisyphus1@optusnet.com.au wrote:
>> On Windows, as of 5.27.7, INTMAX_C and UINTMAX_C are being defined by
>> perl.h.
>> Both symbols are normally defined in stdint.h.
...
>> Is this behaviour of perl.h wise/acceptable/desirable/allowable ?

>Line 692 of perl.h includes stdint.h if Configure has found defined the
>symbol I_STDINT.  Maybe the windows config file should change to define
>that symbol.  I see that it currently isn't.  Maybe it should be done only
>for more recent releases?

Amending config_H.gc doesn't do the trick as the generated config.h still 
fails to define I_STDINT.
(Actually,  the config.h that gets written initially at the beginning of the 
'make' stage does define I_STDINT, but shortly into the build it gets 
overwritten with a rendition that does *not* define I_STDINT. I think I've 
seen somewhere that config.h gets written initially for miniperl, then 
subsequently rewritten for perl.)

So, in order to effect the inclusion of stdint.h at that point, I just
amended line 692 of perl.h to:

#if defined(I_STDINT) || defined(__MINGW64_VERSION_MAJOR) /* MinGW-W64 
compiler */

With that in place, things look a lot saner.
My builds of 5.27.8 (ivsize = 8 and ivsize = 4) still pass all tests, and 
output

defined
defined

for the below script:

> ############################
> use warnings;
> use strict;
>
> use Inline C => <<'EOC';
>
> void foo() {
> #if defined(_STDINT_H)
>   printf("defined\n");
> #else
>   printf("not defined\n");
> #endif
>
> #if defined(INTMAX_C)
>   printf("defined\n");
> #else
>   printf("not defined\n");
> #endif
>
> }
>
> EOC
>
> foo();
> ############################

And the good news is that with that change to perl.h in place, Math-MPFR-4.0 
then builds without any problems at all.
However, I guess the preferred fix would be to get I_STDINT defined in 
config.h and I don't yet know how to do that.

Cheers,
Rob 

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About