summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2016-01-19 12:23:08 +0000
committerDavid Mitchell <davem@iabyn.com>2016-01-19 12:23:08 +0000
commit9847ebb435e553b1ea1b14bd6512c8bd5b8f71fa (patch)
tree5ecc4573954fde9d38a6e4ab6bd010c848f3a1b0 /lib
parentc52cb8175c7c08890821789b4c7177b1e0e92558 (diff)
downloadperl-9847ebb435e553b1ea1b14bd6512c8bd5b8f71fa.tar.gz
lib/ExtUtils/typemap: silence g++ warning.
From the added code comment: The weird way this is written is because g++ is dumb enough to warn "comparison is always false" on something like: sizeof(a) > sizeof(b) && a > B_t_MAX (where the LH condition is false)
Diffstat (limited to 'lib')
-rw-r--r--lib/ExtUtils/typemap14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/ExtUtils/typemap b/lib/ExtUtils/typemap
index 1cdb8465f6..4bfba95e9e 100644
--- a/lib/ExtUtils/typemap
+++ b/lib/ExtUtils/typemap
@@ -379,9 +379,17 @@ T_ARRAY
{
U32 ix_$var;
SSize_t extend_size =
- sizeof(size_$var) > sizeof(SSize_t) && size_$var > SSize_t_MAX
- ? -1 /* might wrap; -1 triggers a panic in EXTEND() */
- : (SSize_t)size_$var;
+ /* The weird way this is written is because g++ is dumb
+ * enough to warn "comparison is always false" on something
+ * like:
+ *
+ * sizeof(a) > sizeof(b) && a > B_t_MAX
+ *
+ * (where the LH condition is false)
+ */
+ (size_$var > (sizeof(size_$var) > sizeof(SSize_t)
+ ? SSize_t_MAX : size_$var))
+ ? -1 : (SSize_t)size_$var;
EXTEND(SP, extend_size);
for (ix_$var = 0; ix_$var < size_$var; ix_$var++) {
ST(ix_$var) = sv_newmortal();