Subject: | doesn't recognize RHEL6 gcc 4.4.7; also patch to silence warnings |
NB using locally built perl-5.16.3 (without threads)
root@noble$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.4 (Santiago)
root@noble$ cc --version --verbose 2>&1
cc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
root@noble$ gcc --version --verbose 2>&1
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
changing line 35 of Makefile.PL to
unless ($cc_version =~ /^g?cc\s+\(GCC\)\s+(4\.(\d+)\S*)/im and $2 >= 4) {
NB I don't have ready access to clang/llvm which has become
the first practical alternative to gcc and is now the default
compiler on OSX & FreeBSD. I don't have acess to clang/llvm
include files but googling "llvm __int128_t" suggests it has
been supported for a while
http://llvm.org/bugs/show_bug.cgi?id=9659
root@noble$ perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for Math::Int128
Writing MYMETA.yml and MYMETA.json
GNU C compiler version 4.4.7 found, good!
"make test" PASSes
Submitted patch which silences all but warning in strtoint128.h.
Applying that initialization of upper_mul_limit results in
t/Math-Int128.t ... No subtests run
t/Math-UInt128.t .. No subtests run
Anyway, all tests PASS after applying patch.
NB there were a similar set of warnings with Math::Int64
I don't think it's actually used, but both Math-UInt128.t
and Math-Int128.t start "#!/usr/bin/perl" which is certainly
NOT the perl I'm building against.
Bonus points for pod tests being author-only
Subject: | Math-Int128-0.11.patch |
diff -u Math-Int128-0.11.orig/Int128.xs Math-Int128-0.11/Int128.xs
--- Math-Int128-0.11.orig/Int128.xs 2013-07-18 16:52:14.000000000 +1000
+++ Math-Int128-0.11/Int128.xs 2013-07-19 18:01:22.923496286 +1000
@@ -121,10 +121,12 @@
static char *sub_error = "Subtraction overflows";
static char *inc_error = "Increment operation wraps";
static char *dec_error = "Decrement operation wraps";
+#if 0 /* prevent 4 cases of "âxxxxxâ defined but not used" */
static char *left_b_error = "Left-shift right operand is out of bounds";
static char *left_error = "Left shift overflows";
static char *right_b_error = "Right-shift right operand is out of bounds";
static char *right_error = "Right shift overflows";
+#endif
static char *div_by_0_error = "Illegal division by zero";
static void croak_string(pTHX_ const char *str) {
@@ -200,6 +202,7 @@
return si128;
}
croak_string(aTHX_ "internal error: reference to int128_t expected");
+ return 0; /* silence gcc "control reaches end of non-void function" */
}
static SV *
@@ -210,6 +213,7 @@
return su128;
}
croak_string(aTHX_ "internal error: reference to uint128_t expected");
+ return 0; /* silence gcc "control reaches end of non-void function" */
}
#define SvI128x(sv) SvI128Y(SvSI128(aTHX_ sv))
@@ -878,7 +882,7 @@
CODE:
if (may_die_on_overflow) {
int neg = 0;
- uint128_t a, b, rl, rh;
+ uint128_t a, b; /* , rl, rh; */
if (a1 < 0) {
a = -a1;
neg ^= 1;
@@ -1256,8 +1260,8 @@
SV *
mi128_string(self, ...)
SV *self
-PREINIT:
- STRLEN len;
+# PREINIT:
+# STRLEN len;
CODE:
RETVAL = newSV(I128STRLEN);
SvPOK_on(RETVAL);
@@ -1476,7 +1480,7 @@
SV *other
SV *rev
PREINIT:
- int sign;
+# int sign;
uint128_t r;
int128_t a, b;
CODE:
@@ -1693,8 +1697,8 @@
SV *
mu128_string(self, ...)
SV *self
-PREINIT:
- STRLEN len;
+# PREINIT:
+# STRLEN len;
CODE:
RETVAL = newSV(I128STRLEN);
SvPOK_on(RETVAL);
@@ -1761,7 +1765,7 @@
CODE:
if (may_die_on_overflow) {
int neg = 0;
- uint128_t a, b, rl, rh;
+ uint128_t a, b; /* , rl, rh; */
if (a1 < 0) {
a = -a1;
neg ^= 1;
Common subdirectories: Math-Int128-0.11.orig/benchmarks and Math-Int128-0.11/benchmarks
diff -u Math-Int128-0.11.orig/c_api.h Math-Int128-0.11/c_api.h
--- Math-Int128-0.11.orig/c_api.h 2012-09-10 21:21:21.000000000 +1000
+++ Math-Int128-0.11/c_api.h 2013-07-19 17:59:57.530721220 +1000
@@ -14,14 +14,14 @@
static void
init_c_api(pTHX) {
HV *hv = get_hv("Math::Int128::C_API", TRUE|GV_ADDMULTI);
- hv_store(hv, "min_version", 11, newSViv(1), 0);
- hv_store(hv, "max_version", 11, newSViv(1), 0);
- hv_store(hv, "SvI128", 6, newSViv(PTR2IV(&SvI128)), 0);
- hv_store(hv, "SvI128OK", 8, newSViv(PTR2IV(&SvI128OK)), 0);
- hv_store(hv, "SvU128", 6, newSViv(PTR2IV(&SvU128)), 0);
- hv_store(hv, "SvU128OK", 8, newSViv(PTR2IV(&SvU128OK)), 0);
- hv_store(hv, "newSVi128", 9, newSViv(PTR2IV(&newSVi128)), 0);
- hv_store(hv, "newSVu128", 9, newSViv(PTR2IV(&newSVu128)), 0);
+ (void) hv_store(hv, "min_version", 11, newSViv(1), 0);
+ (void) hv_store(hv, "max_version", 11, newSViv(1), 0);
+ (void) hv_store(hv, "SvI128", 6, newSViv(PTR2IV(&SvI128)), 0);
+ (void) hv_store(hv, "SvI128OK", 8, newSViv(PTR2IV(&SvI128OK)), 0);
+ (void) hv_store(hv, "SvU128", 6, newSViv(PTR2IV(&SvU128)), 0);
+ (void) hv_store(hv, "SvU128OK", 8, newSViv(PTR2IV(&SvU128OK)), 0);
+ (void) hv_store(hv, "newSVi128", 9, newSViv(PTR2IV(&newSVi128)), 0);
+ (void) hv_store(hv, "newSVu128", 9, newSViv(PTR2IV(&newSVu128)), 0);
}
Common subdirectories: Math-Int128-0.11.orig/c_api_client and Math-Int128-0.11/c_api_client
Common subdirectories: Math-Int128-0.11.orig/lib and Math-Int128-0.11/lib
diff -u Math-Int128-0.11.orig/strtoint128.h Math-Int128-0.11/strtoint128.h
--- Math-Int128-0.11.orig/strtoint128.h 2012-09-10 21:14:26.000000000 +1000
+++ Math-Int128-0.11/strtoint128.h 2013-07-19 18:00:22.981250266 +1000
@@ -44,7 +44,7 @@
uint128_t acc = 0;
int c, neg, between = 0;
- uint128_t upper_mul_limit;
+ uint128_t upper_mul_limit;/* = (UINT128_MAX / base); /* ??? round-up needed when base not power of 2 */
/*
* Skip white space and pick up leading +/- sign if any.
Common subdirectories: Math-Int128-0.11.orig/t and Math-Int128-0.11/t