In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/20e4c2ede583268f69be4957f1f94953e911c5bf?hp=d6150e10749d85cf1797627bdf8cf9a86cd8d6e6>

- Log -----------------------------------------------------------------
commit 20e4c2ede583268f69be4957f1f94953e911c5bf
Author: Yves Orton <demer...@gmail.com>
Date:   Wed Sep 13 13:34:17 2017 +0200

    in hash init code preserve constness
    
    This causes warnings in some our builds as can be seen in some
    smoke reports:
    
      zaphod32_hash.h:185:17: warning: cast discards '__attribute__((const))'
      qualifier from pointer target type [-Wcast-qual]

M       sbox32_hash.h
M       stadtx_hash.h
M       zaphod32_hash.h

commit 45908e4d120d33a558a8b052036c56cd0c90b898
Author: Yves Orton <demer...@gmail.com>
Date:   Wed Sep 13 13:30:25 2017 +0200

    avoid  'the address of ... will always evaluate as ...' warns in mem macros
    
    In f14cf363205 we added asserts to our memory macros (Copy(), Zero() etc)
    to ensure that the target is non-null. These asserts throw warnings like
    
        perl.c: In function ‘Perl_eval_sv’:
        perl.c:2976:264: warning: the address of ‘myop’ will always evaluate
        as ‘true’ [-Waddress]
             Zero(&myop, 1, UNOP);
    
    which is annoying. This patch changes how these asserts are coded so
    we avoid the warning. Thanks to Zefram for the fix.

M       handy.h
-----------------------------------------------------------------------

Summary of changes:
 handy.h         | 17 ++++++++++-------
 sbox32_hash.h   |  2 +-
 stadtx_hash.h   |  2 +-
 zaphod32_hash.h |  2 +-
 4 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/handy.h b/handy.h
index 31afaae65e..85e8f70721 100644
--- a/handy.h
+++ b/handy.h
@@ -2409,17 +2409,20 @@ void Perl_mem_log_del_sv(const SV *sv, const char 
*filename, const int linenumbe
 #define Safefree(d)    safefree(MEM_LOG_FREE((Malloc_t)(d)))
 #endif
 
-#define Move(s,d,n,t)  (MEM_WRAP_CHECK_(n,t) assert(d), assert(s), 
(void)memmove((char*)(d),(const char*)(s), (n) * sizeof(t)))
-#define Copy(s,d,n,t)  (MEM_WRAP_CHECK_(n,t) assert(d), assert(s), 
(void)memcpy((char*)(d),(const char*)(s), (n) * sizeof(t)))
-#define Zero(d,n,t)    (MEM_WRAP_CHECK_(n,t) assert(d), 
(void)memzero((char*)(d), (n) * sizeof(t)))
+#define perl_assert_ptr(p) assert( ((void*)(p)) != 0 )
 
-#define MoveD(s,d,n,t) (MEM_WRAP_CHECK_(n,t) assert(d), assert(s), 
memmove((char*)(d),(const char*)(s), (n) * sizeof(t)))
-#define CopyD(s,d,n,t) (MEM_WRAP_CHECK_(n,t) assert(d), assert(s), 
memcpy((char*)(d),(const char*)(s), (n) * sizeof(t)))
+
+#define Move(s,d,n,t)  (MEM_WRAP_CHECK_(n,t) perl_assert_ptr(d), 
perl_assert_ptr(s), (void)memmove((char*)(d),(const char*)(s), (n) * sizeof(t)))
+#define Copy(s,d,n,t)  (MEM_WRAP_CHECK_(n,t) perl_assert_ptr(d), 
perl_assert_ptr(s), (void)memcpy((char*)(d),(const char*)(s), (n) * sizeof(t)))
+#define Zero(d,n,t)    (MEM_WRAP_CHECK_(n,t) perl_assert_ptr(d), 
(void)memzero((char*)(d), (n) * sizeof(t)))
+
+#define MoveD(s,d,n,t) (MEM_WRAP_CHECK_(n,t) perl_assert_ptr(d), 
perl_assert_ptr(s), memmove((char*)(d),(const char*)(s), (n) * sizeof(t)))
+#define CopyD(s,d,n,t) (MEM_WRAP_CHECK_(n,t) perl_assert_ptr(d), 
perl_assert_ptr(s), memcpy((char*)(d),(const char*)(s), (n) * sizeof(t)))
 #ifdef HAS_MEMSET
-#define ZeroD(d,n,t)   (MEM_WRAP_CHECK_(n,t) assert(d), memzero((char*)(d), 
(n) * sizeof(t)))
+#define ZeroD(d,n,t)   (MEM_WRAP_CHECK_(n,t) perl_assert_ptr(d), 
memzero((char*)(d), (n) * sizeof(t)))
 #else
 /* Using bzero(), which returns void.  */
-#define ZeroD(d,n,t)   (MEM_WRAP_CHECK_(n,t) assert(d), memzero((char*)(d), 
(n) * sizeof(t)),d)
+#define ZeroD(d,n,t)   (MEM_WRAP_CHECK_(n,t) perl_assert_ptr(d), 
memzero((char*)(d), (n) * sizeof(t)),d)
 #endif
 
 #define PoisonWith(d,n,t,b)    (MEM_WRAP_CHECK_(n,t) (void)memset((char*)(d), 
(U8)(b), (n) * sizeof(t)))
diff --git a/sbox32_hash.h b/sbox32_hash.h
index 9c98195899..748256c71c 100644
--- a/sbox32_hash.h
+++ b/sbox32_hash.h
@@ -1421,7 +1421,7 @@ SBOX32_STATIC_INLINE void sbox32_seed_state96 (
     const U8 *seed_ch,
     U8 *state_ch
 ) {
-    U32 *seed= (U32 *)seed_ch;
+    const U32 *seed= (const U32 *)seed_ch;
     U32 *state= (U32 *)state_ch;
     U32 *state_cursor = state + 1;
     U32 *sbox32_end = state + 1 + (256 * SBOX32_MAX_LEN);
diff --git a/stadtx_hash.h b/stadtx_hash.h
index 3a5d81e7cb..30278e3b53 100644
--- a/stadtx_hash.h
+++ b/stadtx_hash.h
@@ -118,7 +118,7 @@ STADTX_STATIC_INLINE void stadtx_seed_state (
     const U8 *seed_ch,
     U8 *state_ch
 ) {
-    U64 *seed= (U64 *)seed_ch;
+    const U64 *seed= (const U64 *)seed_ch;
     U64 *state= (U64 *)state_ch;
     /* first we apply two masks to each word of the seed, this means that
      * a) at least one of state[0] and state[2] is nonzero,
diff --git a/zaphod32_hash.h b/zaphod32_hash.h
index ec091f723c..842b2473f9 100644
--- a/zaphod32_hash.h
+++ b/zaphod32_hash.h
@@ -134,7 +134,7 @@ void zaphod32_seed_state (
     const U8 *seed_ch,
     U8 *state_ch
 ) {
-    U32 *seed= (U32 *)seed_ch;
+    const U32 *seed= (const U32 *)seed_ch;
     U32 *state= (U32 *)state_ch;
   
     /* hex expansion of pi, skipping first two digits. pi= 3.2[43f6...]*/

--
Perl5 Master Repository

Reply via email to