In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/b9f8153164cb7b53ab0f6f4ec0b9f6a17dd959da?hp=233a40691b70c42ca9024717a12a721a2b30073c>
- Log ----------------------------------------------------------------- commit b9f8153164cb7b53ab0f6f4ec0b9f6a17dd959da Author: Jarkko Hietaniemi <[email protected]> Date: Fri Aug 29 10:56:11 2014 -0400 Another way to detect C99. M perl.h commit 27db273710d0098ce16442ee7a8f95566814d025 Author: Jarkko Hietaniemi <[email protected]> Date: Fri Aug 29 08:45:09 2014 -0400 HAS_C99 was oddly defined, and oddly used. It was defined as "C version high enough, but not VMS", but used as "does it have intmax_t". Now that we have I_STDINT, we can do better. M perl.h M sv.c commit 83f6d82b7e53721edaf57199aef40f74df91d9fd Author: Jarkko Hietaniemi <[email protected]> Date: Fri Aug 29 08:43:34 2014 -0400 Configure: add i_stdint. M Configure M Cross/config.sh-arm-linux M NetWare/config.wc M Porting/Glossary M Porting/config.sh M config_h.SH M configure.com M plan9/config_sh.sample M symbian/config.sh M uconfig.h M uconfig.sh M uconfig64.sh M win32/config.ce M win32/config.gc M win32/config.vc commit 5d34af8920febc1e0e0667bafe14759f8464ea6d Author: Jarkko Hietaniemi <[email protected]> Date: Fri Aug 29 19:57:39 2014 -0400 apidoc for Perl_isinfnan. M numeric.c commit 5c7d6202bf7f0485e729dbee16be772bb8cd4b4e Author: Jarkko Hietaniemi <[email protected]> Date: Wed Aug 27 21:17:30 2014 -0400 Add a simple atan2() test. (Not similar to the 'torture tests' that were removed.) M t/op/exp.t ----------------------------------------------------------------------- Summary of changes: Configure | 6 ++++++ Cross/config.sh-arm-linux | 1 + NetWare/config.wc | 1 + Porting/Glossary | 5 +++++ Porting/config.sh | 1 + config_h.SH | 6 ++++++ configure.com | 1 + numeric.c | 11 +++++++++-- perl.h | 8 +++++--- plan9/config_sh.sample | 1 + sv.c | 12 ++++-------- symbian/config.sh | 1 + t/op/exp.t | 12 ++++++++---- uconfig.h | 10 ++++++++-- uconfig.sh | 1 + uconfig64.sh | 1 + win32/config.ce | 1 + win32/config.gc | 1 + win32/config.vc | 1 + 19 files changed, 62 insertions(+), 19 deletions(-) diff --git a/Configure b/Configure index fbf239b..eac67ea 100755 --- a/Configure +++ b/Configure @@ -954,6 +954,7 @@ i_shadow='' i_socks='' i_stdbool='' i_stddef='' +i_stdint='' i_stdlib='' i_string='' strings='' @@ -5752,6 +5753,10 @@ do set $yyy; var=$2; eval "was=\$$2"; set $yyy; shift; shift; yyy=$@; done' +: see if stdint is available +set stdint.h i_stdint +eval $inhdr + : see if stdlib is available set stdlib.h i_stdlib eval $inhdr @@ -23810,6 +23815,7 @@ i_socks='$i_socks' i_stdarg='$i_stdarg' i_stdbool='$i_stdbool' i_stddef='$i_stddef' +i_stdint='$i_stdint' i_stdlib='$i_stdlib' i_string='$i_string' i_sunmath='$i_sunmath' diff --git a/Cross/config.sh-arm-linux b/Cross/config.sh-arm-linux index d9ac805..da74cf0 100644 --- a/Cross/config.sh-arm-linux +++ b/Cross/config.sh-arm-linux @@ -693,6 +693,7 @@ i_socks='undef' i_stdarg='define' i_stdbool='undef' i_stddef='define' +i_stdint='define' i_stdlib='define' i_string='define' i_sunmath='undef' diff --git a/NetWare/config.wc b/NetWare/config.wc index c966693..1fc3b98 100644 --- a/NetWare/config.wc +++ b/NetWare/config.wc @@ -675,6 +675,7 @@ i_socks='undef' i_stdarg='define' i_stdbool='define' i_stddef='define' +i_stdint='undef' i_stdlib='define' i_string='define' i_sunmath='undef' diff --git a/Porting/Glossary b/Porting/Glossary index 563273a..4b4cc1b 100644 --- a/Porting/Glossary +++ b/Porting/Glossary @@ -3257,6 +3257,11 @@ i_stddef (i_stddef.U): indicates to the C program that <stddef.h> exists and should be included. +i_stdint (i_stdint.U): + This variable conditionally defines the I_STDINT symbol, which + indicates to the C program that <stdint.h> exists and should + be included. + i_stdlib (i_stdlib.U): This variable conditionally defines the I_STDLIB symbol, which indicates to the C program that <stdlib.h> exists and should diff --git a/Porting/config.sh b/Porting/config.sh index ec9b418..4521f5b 100644 --- a/Porting/config.sh +++ b/Porting/config.sh @@ -708,6 +708,7 @@ i_socks='define' i_stdarg='define' i_stdbool='define' i_stddef='define' +i_stdint='undef' i_stdlib='define' i_string='define' i_sunmath='undef' diff --git a/config_h.SH b/config_h.SH index d947b79..30374b7 100755 --- a/config_h.SH +++ b/config_h.SH @@ -744,6 +744,12 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un */ #$i_stddef I_STDDEF /**/ +/* I_STDINT: + * This symbol, if defined, indicates that <stdint.h> exists and should + * be included. + */ +#$i_stdint I_STDINT /**/ + /* I_STDLIB: * This symbol, if defined, indicates that <stdlib.h> exists and should * be included. diff --git a/configure.com b/configure.com index 4beb059..001ae8a 100644 --- a/configure.com +++ b/configure.com @@ -6448,6 +6448,7 @@ $ ELSE $ WC "i_stdbool='undef'" $ ENDIF $ WC "i_stddef='define'" +$ WC "i_stdint='undef'" $ WC "i_stdlib='define'" $ WC "i_string='define'" $ WC "i_sunmath='undef'" diff --git a/numeric.c b/numeric.c index 4b066b2..8de8491 100644 --- a/numeric.c +++ b/numeric.c @@ -1324,8 +1324,15 @@ Perl_my_atof2(pTHX_ const char* orig, NV* value) return (char *)s; } -/* Perl_isinfnan() is utility function that returns true if the NV - * argument is either an infinity or a NaN, false otherwise. */ +/* +=for apidoc grok_atou + +Perl_isinfnan() is utility function that returns true if the NV +argument is either an infinity or a NaN, false otherwise. To test +in more detail, use Perl_isinf() and Perl_isnan(). + +=cut +*/ bool Perl_isinfnan(NV nv) { diff --git a/perl.h b/perl.h index 82dc6b1..354286c 100644 --- a/perl.h +++ b/perl.h @@ -28,10 +28,8 @@ # include "config.h" #endif -#ifndef HAS_C99 -# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && !defined(__VMS) +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(_STDC_C99) # define HAS_C99 1 -# endif #endif /* See L<perlguts/"The Perl API"> for detailed notes on @@ -706,6 +704,10 @@ # endif #endif +#ifdef I_STDINT +# include <stdint.h> +#endif + #include <ctype.h> #ifdef METHOD /* Defined by OSF/1 v3.0 by ctype.h */ diff --git a/plan9/config_sh.sample b/plan9/config_sh.sample index e61deb1..7a9b5ca 100644 --- a/plan9/config_sh.sample +++ b/plan9/config_sh.sample @@ -687,6 +687,7 @@ i_socks='undef' i_stdarg='define' i_stdbool='undef' i_stddef='define' +i_stdint='undef' i_stdlib='define' i_string='define' i_sunmath='undef' diff --git a/sv.c b/sv.c index 2bbb088..5f88508 100644 --- a/sv.c +++ b/sv.c @@ -35,10 +35,6 @@ # include <rms.h> #endif -#ifdef HAS_C99 -# include <stdint.h> -#endif - #ifdef __Lynx__ /* Missing proto on LynxOS */ char *gconvert(double, int, int, char *); @@ -11313,7 +11309,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p case 'V': case 'z': case 't': -#ifdef HAS_C99 +#ifdef I_STDINT case 'j': #endif intsize = *q++; @@ -11462,7 +11458,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p case 't': iv = va_arg(*args, ptrdiff_t); break; #endif default: iv = va_arg(*args, int); break; -#ifdef HAS_C99 +#ifdef I_STDINT case 'j': iv = va_arg(*args, intmax_t); break; #endif case 'q': @@ -11565,7 +11561,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p #ifdef HAS_PTRDIFF_T case 't': uv = va_arg(*args, ptrdiff_t); break; /* will sign extend, but there is no uptrdiff_t, so oh well */ #endif -#ifdef HAS_C99 +#ifdef I_STDINT case 'j': uv = va_arg(*args, uintmax_t); break; #endif default: uv = va_arg(*args, unsigned); break; @@ -12131,7 +12127,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p #ifdef HAS_PTRDIFF_T case 't': *(va_arg(*args, ptrdiff_t*)) = i; break; #endif -#ifdef HAS_C99 +#ifdef I_STDINT case 'j': *(va_arg(*args, intmax_t*)) = i; break; #endif case 'q': diff --git a/symbian/config.sh b/symbian/config.sh index cc8f2dc..4cd1cd2 100644 --- a/symbian/config.sh +++ b/symbian/config.sh @@ -614,6 +614,7 @@ i_socks='undef' i_stdarg='define' i_stdbool='undef' i_stddef='undef' +i_stdint='undef' i_stdlib='define' i_string='define' i_sunmath='undef' diff --git a/t/op/exp.t b/t/op/exp.t index 4c5dec5..a475502 100644 --- a/t/op/exp.t +++ b/t/op/exp.t @@ -8,7 +8,7 @@ BEGIN { require './test.pl'; } -plan tests => 32; +plan tests => 34; # compile time evaluation @@ -41,6 +41,8 @@ is(substr($s,0,5), '0.693', 'compile time log(2)'); cmp_ok(exp(log(1)), '==', 1, 'compile time exp(log(1)) == 1'); +cmp_ok(round(atan2(1, 2)), '==', '0.463647609', "atan2(1, 2)"); + # run time evaluation $x0 = 0; @@ -104,6 +106,8 @@ cmp_ok(round(cos(-1 * $pi_2)), '==', 0.0, 'cos(-pi/2) == 0'); cmp_ok(round(cos($x1)), '==', '0.540302306', "cos(1)"); -# atan2() tests were removed due to differing results from calls to -# atan2() on various OS's and architectures. See perlport.pod for -# more information. +cmp_ok(round(atan2($x1, $x2)), '==', '0.463647609', "atan2($x1, $x2)"); + +# atan2() tests testing with -0.0, 0.0, -1.0, 1.0 were removed due to +# differing results from calls to atan2() on various OS's and +# architectures. See perlport.pod for more information. diff --git a/uconfig.h b/uconfig.h index 4543b89..d55873a 100644 --- a/uconfig.h +++ b/uconfig.h @@ -709,6 +709,12 @@ */ #define I_STDDEF /**/ +/* I_STDINT: + * This symbol, if defined, indicates that <stdint.h> exists and should + * be included. + */ +/*#define I_STDINT / **/ + /* I_STDLIB: * This symbol, if defined, indicates that <stdlib.h> exists and should * be included. @@ -4803,6 +4809,6 @@ #endif /* Generated from: - * d11e261bb139be0ee56e1999842277e01b6c71ad49dcb6334cea88f982648fb4 config_h.SH - * 11ac8affd49fd0343b02249879adb0b00934fdfa8405591f28f73077e00105ab uconfig.sh + * 0f8a0a7c63b386e4ced948683f663789f15d702182a8443f833613f5d7cfecc7 config_h.SH + * a4410f6212dd1c64a11e20c38b71f6449fbafd923141b5e5dcd867e0dfd4dadb uconfig.sh * ex: set ro: */ diff --git a/uconfig.sh b/uconfig.sh index 84cd7c5..b6d505b 100644 --- a/uconfig.sh +++ b/uconfig.sh @@ -600,6 +600,7 @@ i_socks='undef' i_stdarg='define' i_stdbool='undef' i_stddef='define' +i_stdint='undef' i_stdlib='define' i_string='define' i_sunmath='undef' diff --git a/uconfig64.sh b/uconfig64.sh index ff0f48c..fec0e8a 100644 --- a/uconfig64.sh +++ b/uconfig64.sh @@ -601,6 +601,7 @@ i_socks='undef' i_stdarg='define' i_stdbool='undef' i_stddef='define' +i_stdint='undef' i_stdlib='define' i_string='define' i_sunmath='undef' diff --git a/win32/config.ce b/win32/config.ce index de8c776..afabb9a 100644 --- a/win32/config.ce +++ b/win32/config.ce @@ -671,6 +671,7 @@ i_socks='undef' i_stdarg='define' i_stdbool='undef' i_stddef='define' +i_stdint='undef' i_stdlib='define' i_string='define' i_sunmath='undef' diff --git a/win32/config.gc b/win32/config.gc index 58c0fbc..428006e 100644 --- a/win32/config.gc +++ b/win32/config.gc @@ -683,6 +683,7 @@ i_socks='undef' i_stdarg='define' i_stdbool='define' i_stddef='define' +i_stdint='undef' i_stdlib='define' i_string='define' i_sunmath='undef' diff --git a/win32/config.vc b/win32/config.vc index a20b04b..5f82658 100644 --- a/win32/config.vc +++ b/win32/config.vc @@ -682,6 +682,7 @@ i_socks='undef' i_stdarg='define' i_stdbool='undef' i_stddef='define' +i_stdint='undef' i_stdlib='define' i_string='define' i_sunmath='undef' -- Perl5 Master Repository
