[Cmake-commits] CMake branch, next, updated. v3.7.0-rc3-1007-g404e3eb

Brad King brad.king at kitware.com
Wed Nov 9 11:48:17 EST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  404e3ebc4f512d912a07d12de897931463c9df3c (commit)
       via  96d23ca9a55e112c167e39535d5e132e046954a0 (commit)
       via  7a941d91d3a7b864008d0e15b8a2ace1c6b88b85 (commit)
      from  db87aa33be07ed5234f948316a1483f716e3ecb7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=404e3ebc4f512d912a07d12de897931463c9df3c
commit 404e3ebc4f512d912a07d12de897931463c9df3c
Merge: db87aa3 96d23ca
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Nov 9 11:48:16 2016 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Nov 9 11:48:16 2016 -0500

    Merge topic 'import-librhash' into next
    
    96d23ca9 librhash: Avoid signed left-shift overflow
    7a941d91 librhash: Implement bswap_32 as a function even in strict C90 mode


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=96d23ca9a55e112c167e39535d5e132e046954a0
commit 96d23ca9a55e112c167e39535d5e132e046954a0
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Nov 9 11:43:34 2016 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Nov 9 11:43:34 2016 -0500

    librhash: Avoid signed left-shift overflow
    
    Fix `rhash_md5_final` to use unsigned integers for left shifting to
    avoid the possibility of undefined overflow behavior.

diff --git a/Utilities/cmlibrhash/librhash/md5.c b/Utilities/cmlibrhash/librhash/md5.c
index 0feb090..b20de45 100644
--- a/Utilities/cmlibrhash/librhash/md5.c
+++ b/Utilities/cmlibrhash/librhash/md5.c
@@ -213,8 +213,8 @@ void rhash_md5_final(md5_ctx *ctx, unsigned char* result)
 	/* pad message and run for last block */
 
 	/* append the byte 0x80 to the message */
-	ctx->message[index]   &= ~(0xFFFFFFFF << shift);
-	ctx->message[index++] ^= 0x80 << shift;
+	ctx->message[index]   &= ~(0xFFFFFFFFu << shift);
+	ctx->message[index++] ^= 0x80u << shift;
 
 	/* if no room left in the message to store 64-bit message length */
 	if (index > 14) {

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7a941d91d3a7b864008d0e15b8a2ace1c6b88b85
commit 7a941d91d3a7b864008d0e15b8a2ace1c6b88b85
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Nov 9 11:38:54 2016 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Nov 9 11:41:36 2016 -0500

    librhash: Implement bswap_32 as a function even in strict C90 mode
    
    We cannot fall back to the macro implementation because some call sites
    may call it with an argument like `*ptr++` that has side effects.

diff --git a/Utilities/cmlibrhash/librhash/byte_order.h b/Utilities/cmlibrhash/librhash/byte_order.h
index fe49e26..d34a020 100644
--- a/Utilities/cmlibrhash/librhash/byte_order.h
+++ b/Utilities/cmlibrhash/librhash/byte_order.h
@@ -71,6 +71,10 @@ void rhash_swap_copy_str_to_u64(void* to, int index, const void* from, size_t le
 void rhash_swap_copy_u64_to_str(void* to, const void* from, size_t length);
 void rhash_u32_mem_swap(unsigned *p, int length_in_u32);
 
+#ifndef __has_builtin
+# define __has_builtin(x) 0
+#endif
+
 /* define bswap_32 */
 #if defined(__GNUC__) && defined(CPU_IA32) && !defined(__i386__)
 /* for intel x86 CPU */
@@ -81,23 +85,18 @@ static inline uint32_t bswap_32(uint32_t x) {
 #elif defined(__GNUC__)  && (__GNUC__ >= 4) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 3)
 /* for GCC >= 4.3 */
 # define bswap_32(x) __builtin_bswap32(x)
+#elif defined(__clang__) && __has_builtin(__builtin_bswap32)
+# define bswap_32(x) __builtin_bswap32(x)
 #elif (_MSC_VER > 1300) && (defined(CPU_IA32) || defined(CPU_X64)) /* MS VC */
 # define bswap_32(x) _byteswap_ulong((unsigned long)x)
-#elif !defined(__STRICT_ANSI__)
+#else
 /* general bswap_32 definition */
-static inline uint32_t bswap_32(uint32_t x) {
+static uint32_t bswap_32(uint32_t x) {
 	x = ((x << 8) & 0xFF00FF00) | ((x >> 8) & 0x00FF00FF);
 	return (x >> 16) | (x << 16);
 }
-#else
-#define bswap_32(x) ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >>  8) | \
-	(((x) & 0x0000ff00) <<  8) | (((x) & 0x000000ff) << 24))
 #endif /* bswap_32 */
 
-#ifndef __has_builtin
-# define __has_builtin(x) 0
-#endif
-
 #if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 3)
 # define bswap_64(x) __builtin_bswap64(x)
 #elif defined(__clang__) && __has_builtin(__builtin_bswap64)

-----------------------------------------------------------------------

Summary of changes:
 Utilities/cmlibrhash/librhash/byte_order.h |   17 ++++++++---------
 Utilities/cmlibrhash/librhash/md5.c        |    4 ++--
 2 files changed, 10 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list