Skip to content

Commit

Permalink
Patch Vc to avoid warnings about macro redefinitions
Browse files Browse the repository at this point in the history
See VcDevel/Vc#247 for more information.
  • Loading branch information
amadio authored and oshadura committed Mar 26, 2020
1 parent e5ddfc0 commit 8f86364
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmake/modules/SearchInstalledSoftware.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1124,9 +1124,14 @@ if(vc AND NOT Vc_FOUND)
set(Vc_LIBNAME "${CMAKE_STATIC_LIBRARY_PREFIX}Vc${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(Vc_LIBRARY "${Vc_ROOTDIR}/lib/${Vc_LIBNAME}")

if(UNIX)
set(VC_PATCH_COMMAND patch -p1 < ${CMAKE_SOURCE_DIR}/cmake/patches/vc-bit-scan-forward.patch)
endif()

ExternalProject_Add(VC
URL ${Vc_SRC_URI}
URL_HASH SHA256=68e609a735326dc3625e98bd85258e1329fb2a26ce17f32c432723b750a4119f
PATCH_COMMAND ${VC_PATCH_COMMAND}
BUILD_IN_SOURCE 0
BUILD_BYPRODUCTS ${Vc_LIBRARY}
LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1
Expand Down
28 changes: 28 additions & 0 deletions cmake/patches/vc-bit-scan-forward.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From 01015d26dd6a66b2cb39740c05bbb7d5eb0f10a3 Mon Sep 17 00:00:00 2001
From: Guilherme Amadio <amadio@cern.ch>
Date: Fri, 6 Mar 2020 10:46:02 +0100
Subject: [PATCH] Avoid redefinition of _bit_scan_{forward,reverse} macros
---
Vc/common/bitscanintrinsics.h | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/Vc/common/bitscanintrinsics.h b/Vc/common/bitscanintrinsics.h
index 62543563..ce419e34 100644
--- a/Vc/common/bitscanintrinsics.h
+++ b/Vc/common/bitscanintrinsics.h
@@ -29,11 +29,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define VC_COMMON_BITSCANINTRINSICS_H_

#if defined(Vc_GCC) || defined(Vc_CLANG) || defined(Vc_APPLECLANG)
-# if Vc_GCC >= 0x40500
- // GCC 4.5.0 introduced _bit_scan_forward / _bit_scan_reverse
-# include <x86intrin.h>
-# else
- // GCC <= 4.4 and clang have x86intrin.h, but not the required functions
+#include <x86intrin.h>
+# ifndef _bit_scan_forward
# define _bit_scan_forward(x) __builtin_ctz(x)
#include "macros.h"
static Vc_ALWAYS_INLINE Vc_CONST int _Vc_bit_scan_reverse_asm(unsigned int x) {
--
2.25.1

0 comments on commit 8f86364

Please sign in to comment.