This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
silence VC Win64 perl warnings in hv_func.h
authorDaniel Dragan <bulk88@hotmail.com>
Tue, 23 Dec 2014 05:35:24 +0000 (00:35 -0500)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 23 Dec 2014 17:22:16 +0000 (09:22 -0800)
These warnings are in a public header, hv_func.h, so CPAN
XS builders will see 8 warnings with every .c file from
a CPAN XS module that they will compile. Silence the
warnings since headers should never warn unconditionally.

See [perl #123483] for details.

hv_func.h
pod/perldelta.pod

index b3eea00..24ebf56 100644 (file)
--- a/hv_func.h
+++ b/hv_func.h
@@ -269,7 +269,7 @@ S_perl_hash_siphash_2_4(const unsigned char * const seed, const unsigned char *i
 
 PERL_STATIC_INLINE U32
 S_perl_hash_superfast(const unsigned char * const seed, const unsigned char *str, STRLEN len) {
-    U32 hash = *((U32*)seed) + len;
+    U32 hash = *((U32*)seed) + (U32)len;
     U32 tmp;
     int rem= len & 3;
     len >>= 2;
@@ -379,7 +379,7 @@ S_perl_hash_murmur3(const unsigned char * const seed, const unsigned char *ptr,
 
     const unsigned char *end;
     int bytes_in_carry = 0; /* bytes in carry */
-    I32 total_length= len;
+    I32 total_length= (I32)len;
 
 #if defined(UNALIGNED_SAFE)
     /* Handle carry: commented out as its only used in incremental mode - it never fires for us
@@ -402,7 +402,7 @@ S_perl_hash_murmur3(const unsigned char * const seed, const unsigned char *ptr,
     /* Consume enough so that the next data byte is word aligned */
     STRLEN i = -PTR2IV(ptr) & 3;
     if(i && i <= len) {
-      MURMUR_DOBYTES(i, h1, carry, bytes_in_carry, ptr, len);
+      MURMUR_DOBYTES((int)i, h1, carry, bytes_in_carry, ptr, len);
     }
 
     /* We're now aligned. Process in aligned blocks. Specialise for each possible carry count */
@@ -443,7 +443,7 @@ S_perl_hash_murmur3(const unsigned char * const seed, const unsigned char *ptr,
     len -= len/4*4;
 
     /* Append any remaining bytes into carry */
-    MURMUR_DOBYTES(len, h1, carry, bytes_in_carry, ptr, len);
+    MURMUR_DOBYTES((int)len, h1, carry, bytes_in_carry, ptr, len);
 
     if (bytes_in_carry) {
         k1 = carry >> ( 4 - bytes_in_carry ) * 8;
@@ -467,7 +467,7 @@ S_perl_hash_murmur3(const unsigned char * const seed, const unsigned char *ptr,
 PERL_STATIC_INLINE U32
 S_perl_hash_djb2(const unsigned char * const seed, const unsigned char *str, const STRLEN len) {
     const unsigned char * const end = (const unsigned char *)str + len;
-    U32 hash = *((U32*)seed) + len;
+    U32 hash = *((U32*)seed) + (U32)len;
     while (str < end) {
         hash = ((hash << 5) + hash) + *str++;
     }
@@ -477,7 +477,7 @@ S_perl_hash_djb2(const unsigned char * const seed, const unsigned char *str, con
 PERL_STATIC_INLINE U32
 S_perl_hash_sdbm(const unsigned char * const seed, const unsigned char *str, const STRLEN len) {
     const unsigned char * const end = (const unsigned char *)str + len;
-    U32 hash = *((U32*)seed) + len;
+    U32 hash = *((U32*)seed) + (U32)len;
     while (str < end) {
         hash = (hash << 6) + (hash << 16) - hash + *str++;
     }
@@ -503,7 +503,7 @@ S_perl_hash_sdbm(const unsigned char * const seed, const unsigned char *str, con
 PERL_STATIC_INLINE U32
 S_perl_hash_one_at_a_time(const unsigned char * const seed, const unsigned char *str, const STRLEN len) {
     const unsigned char * const end = (const unsigned char *)str + len;
-    U32 hash = *((U32*)seed) + len;
+    U32 hash = *((U32*)seed) + (U32)len;
     while (str < end) {
         hash += *str++;
         hash += (hash << 10);
@@ -518,7 +518,7 @@ S_perl_hash_one_at_a_time(const unsigned char * const seed, const unsigned char
 PERL_STATIC_INLINE U32
 S_perl_hash_one_at_a_time_hard(const unsigned char * const seed, const unsigned char *str, const STRLEN len) {
     const unsigned char * const end = (const unsigned char *)str + len;
-    U32 hash = *((U32*)seed) + len;
+    U32 hash = *((U32*)seed) + (U32)len;
     
     while (str < end) {
         hash += (hash << 10);
index 54be512..2064551 100644 (file)
@@ -305,9 +305,19 @@ L</Modules and Pragmata> section.
 
 =over 4
 
-=item XXX-some-platform
+=item Win32
 
-XXX
+=over 4
+
+=item *
+
+Previously, on Visual C++ for Win64 built Perls only, when compiling every Perl
+XS module (including CPAN ones) and Perl aware .c file with a 64 bit Visual C++,
+would uncondtionally have around a dozen warnings from hv_func.h.  These
+warnings have been silenced.  GCC all bitness and Visual C++ for Win32 were
+not affected.
+
+=back
 
 =back