From cd03713b608896a96397f88600849ecb87272089 Mon Sep 17 00:00:00 2001 From: danieltowner Date: Mon, 5 Oct 2026 10:47:36 +0100 Subject: [PATCH] Turned off warnings and fixed the code (#14) xvec can be used as a header-only library in projects with different warning settings. Requiring users to disable the same warnings as xvec is impractical. Fix the underlying code issues and disable only the remaining warnings. The warnings have also been turned into errors to ensure that they don't get overlooked. --- include/xvec/detail/core.hpp | 18 +++++++++++++++--- include/xvec/x86/x86_impl.hpp | 1 - test/CMakeLists.txt | 17 +---------------- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/include/xvec/detail/core.hpp b/include/xvec/detail/core.hpp index 6f8f45f..348e958 100644 --- a/include/xvec/detail/core.hpp +++ b/include/xvec/detail/core.hpp @@ -496,10 +496,22 @@ struct mask_traits static constexpr int internalNp = std::bit_ceil(std::max(8, _Np)); #if defined (__llvm__) - #if (__INTEL_LLVM_COMPILER > 20220000) - using compact_builtin_type = unsigned _BitInt(internalNp); + + // Two different names for ExtInt/BitInt - choose one explicitly to avoid warnings about deprecations. + #if defined(__INTEL_LLVM_COMPILER) + #if __INTEL_LLVM_COMPILER > 20220000 + using compact_builtin_type = unsigned _BitInt(internalNp); + #else + using compact_builtin_type = unsigned _ExtInt(internalNp); + #endif + #elif defined(__clang_major__) + #if __clang_major__ >= 14 + using compact_builtin_type = unsigned _BitInt(internalNp); + #else + using compact_builtin_type = unsigned _ExtInt(internalNp); + #endif #else - using compact_builtin_type = unsigned _ExtInt(internalNp); + #error "Unknown LLVM-based compiler: choose a bit-precise integer type" #endif static constexpr auto all_bits_set = (_Np == internalNp) ? ~compact_builtin_type() : ((compact_builtin_type(1) << _Np) - 1); diff --git a/include/xvec/x86/x86_impl.hpp b/include/xvec/x86/x86_impl.hpp index 8082510..e714360 100644 --- a/include/xvec/x86/x86_impl.hpp +++ b/include/xvec/x86/x86_impl.hpp @@ -183,7 +183,6 @@ mask_to_bitset(x86_avx512_tag, const _Mp& mask) noexcept // Build the bitset up 64-bits at a time. Each 64-bit group is extracted from the extended int and // then inserted into the bitset. -#pragma unroll for (simd_size_type i = 0; i<((_Np + 63) / 64); ++i) { const auto b = std::bitset<_Np>(std::uint64_t(mask.to_builtin() >> (64 * i))); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a4c1555..8df58e9 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -234,8 +234,7 @@ target_compile_options( INTERFACE -Wall -Wextra - -Wno-tautological-constant-compare - -Wno-deprecated-declarations + -Werror -Wno-psabi -Wno-sign-compare "${XVEC_TEST_OLEVEL}" @@ -246,25 +245,11 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "^(IntelLLVM|Clang)$") target_compile_options( xvec_test_common INTERFACE - -Wno-unknown-warning-option - -Wno-deprecated-copy - -Wno-deprecated-builtins - -Wno-unused-command-line-argument ) - - if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - target_compile_options( - xvec_test_common - INTERFACE - -Wno-deprecated-type - ) - endif() elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") target_compile_options( xvec_test_common INTERFACE - -Wno-unknown-warning - -Wno-maybe-uninitialized -Wno-unknown-pragmas -flax-vector-conversions )