summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2013-09-11 12:12:25 +0100
committerNicholas Clark <nick@ccl4.org>2013-09-17 13:57:52 +0200
commit1640b983ff7c1296873ae4dc0e2163160c853cb3 (patch)
tree1f2a305a871cfb523c7d7c83a3e5875746a1ba1d
parentb002c7b1f7eb7c6fa27e84405047d34581195270 (diff)
downloadperl-1640b983ff7c1296873ae4dc0e2163160c853cb3.tar.gz
Use IVSIZE not HAS_QUAD to enable 'q' and 'Q' formats in pack.
Whilst the code for 'q' and 'Q' in pp_pack is itself well behaved if enabled on a perl with 32 bit IVs (using SvNV instead of SvIV and SvUV), the regression tests are not. Several tests use an eval of "pack 'q'" to determine if 64 bit integer support is available (instead of $Config{ivsize}), and t/op/pack.t fails many tests. While these could be fixed (or skipped), unfortunately the approach of evaling "pack 'q'" is fairly popular on CPAN, so the breakage isn't just in the perl core, and might also be present in code we can't see or submit patches for.
-rw-r--r--packsizetables.c8
-rw-r--r--pp_pack.c8
-rw-r--r--regen/genpacksizetables.pl7
3 files changed, 11 insertions, 12 deletions
diff --git a/packsizetables.c b/packsizetables.c
index 8c57d410aa..1eeae13ef4 100644
--- a/packsizetables.c
+++ b/packsizetables.c
@@ -34,7 +34,7 @@ STATIC const packprops_t packprops[512] = {
0,
/* N */ SIZE32,
0, 0,
-#if defined(HAS_QUAD)
+#if IVSIZE >= 8
/* Q */ sizeof(Uquad_t),
#else
0,
@@ -59,7 +59,7 @@ STATIC const packprops_t packprops[512] = {
/* n */ SIZE16,
0,
/* p */ sizeof(char *) | PACK_SIZE_CANNOT_CSUM,
-#if defined(HAS_QUAD)
+#if IVSIZE >= 8
/* q */ sizeof(Quad_t),
#else
0,
@@ -141,7 +141,7 @@ STATIC const packprops_t packprops[512] = {
/* n */ SIZE16,
0,
/* p */ sizeof(char *) | PACK_SIZE_CANNOT_CSUM,
-#if defined(HAS_QUAD)
+#if IVSIZE >= 8
/* q */ sizeof(Quad_t),
#else
0,
@@ -170,7 +170,7 @@ STATIC const packprops_t packprops[512] = {
0,
/* N */ SIZE32,
0, 0,
-#if defined(HAS_QUAD)
+#if IVSIZE >= 8
/* Q */ sizeof(Uquad_t),
#else
0,
diff --git a/pp_pack.c b/pp_pack.c
index 3c4e373d23..83aaf581cd 100644
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -1632,7 +1632,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c
PUSHs(newSVpvn_flags(aptr, len, SVs_TEMP));
}
break;
-#ifdef HAS_QUAD
+#if IVSIZE >= 8
case 'q':
while (len-- > 0) {
Quad_t aquad;
@@ -1659,7 +1659,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c
cuv += auquad;
}
break;
-#endif /* HAS_QUAD */
+#endif
/* float and double added gnb@melba.bby.oz.au 22/11/89 */
case 'f':
while (len-- > 0) {
@@ -2982,7 +2982,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
PUSH32(utf8, cur, &ai32, needs_swap);
}
break;
-#ifdef HAS_QUAD
+#if IVSIZE >= 8
case 'Q':
while (len-- > 0) {
Uquad_t auquad;
@@ -2999,7 +2999,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
PUSH_VAR(utf8, cur, aquad, needs_swap);
}
break;
-#endif /* HAS_QUAD */
+#endif
case 'P':
len = 1; /* assume SV is correct length */
GROWING(utf8, cat, start, cur, sizeof(char *));
diff --git a/regen/genpacksizetables.pl b/regen/genpacksizetables.pl
index b9ede5577e..742eb6fb3d 100644
--- a/regen/genpacksizetables.pl
+++ b/regen/genpacksizetables.pl
@@ -13,7 +13,6 @@ sub make_text {
$text .= ",";
if ($condition) {
- $condition = join " && ", map {"defined($_)"} split ' ', $condition;
$text = "#if $condition
$text
#else
@@ -121,9 +120,9 @@ N! =SIZE32
L =SIZE32
p * char *
w * * char
-q Quad_t HAS_QUAD
-Q Uquad_t HAS_QUAD
+q Quad_t IVSIZE >= 8
+Q Uquad_t IVSIZE >= 8
f float
d double
F =NVSIZE
-D =LONG_DOUBLESIZE HAS_LONG_DOUBLE USE_LONG_DOUBLE
+D =LONG_DOUBLESIZE defined(HAS_LONG_DOUBLE) && defined(USE_LONG_DOUBLE)