1
0
forked from boostorg/core

Compare commits

..

3 Commits

Author SHA1 Message Date
Peter Dimov
d92a7b0498 Disable span_constexpr_test under GCC 4.x 2025-02-23 19:19:23 +02:00
Peter Dimov
5f6bb283fb Disable constexpr under GCC 4.x when there's BOOST_ASSERT 2025-02-23 18:55:04 +02:00
Peter Dimov
6b1d7a91e6 Use BOOST_ASSERT instead of BOOST_CORE_DETAIL_ASSERT 2025-02-23 18:55:04 +02:00
13 changed files with 53 additions and 79 deletions

View File

@@ -100,13 +100,13 @@ jobs:
- toolset: gcc-9
cxxstd: "03,11,14,17,2a"
address-model: 32,64
os: ubuntu-24.04
os: ubuntu-20.04
install:
- g++-9-multilib
- toolset: gcc-10
cxxstd: "03,11,14,17,20"
address-model: 32,64
os: ubuntu-24.04
os: ubuntu-20.04
install:
- g++-10-multilib
- toolset: gcc-11
@@ -135,13 +135,6 @@ jobs:
container: ubuntu:24.04
install:
- g++-14-multilib
- toolset: gcc-15
cxxstd: "03,11,14,17,20,23,2c"
address-model: 32,64
os: ubuntu-latest
container: ubuntu:25.04
install:
- g++-15-multilib
- name: UBSAN
toolset: gcc-12
cxxstd: "03,11,14,17,20,23"
@@ -227,15 +220,13 @@ jobs:
- toolset: clang
compiler: clang++-9
cxxstd: "03,11,14,17,2a"
os: ubuntu-latest
container: ubuntu:20.04
os: ubuntu-20.04
install:
- clang-9
- toolset: clang
compiler: clang++-10
cxxstd: "03,11,14,17,20"
os: ubuntu-latest
container: ubuntu:20.04
os: ubuntu-20.04
install:
- clang-10
- toolset: clang
@@ -325,24 +316,13 @@ jobs:
compiler: clang++-19
cxxstd: "03,11,14,17,20,2b"
os: ubuntu-latest
container: ubuntu:24.04
container: ubuntu:24.10
install:
- clang-19
- libc++-19-dev
- libc++abi-19-dev
cxxflags: -stdlib=libc++
linkflags: -stdlib=libc++
- toolset: clang
compiler: clang++-20
cxxstd: "03,11,14,17,20,2b,2c"
os: ubuntu-latest
container: ubuntu:25.04
install:
- clang-20
- libc++-20-dev
- libc++abi-20-dev
cxxflags: -stdlib=libc++
linkflags: -stdlib=libc++
- name: UBSAN
toolset: clang
compiler: clang++-15
@@ -602,7 +582,7 @@ jobs:
- toolset: gcc
cxxstd: "03,11,14,17,2a"
addrmd: 64
os: windows-2022
os: windows-2019
runs-on: ${{matrix.os}}
timeout-minutes: 45
@@ -655,6 +635,7 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-22.04
- os: ubuntu-24.04
- os: macos-13
@@ -722,6 +703,7 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-22.04
- os: ubuntu-24.04
- os: macos-13
@@ -799,6 +781,7 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-22.04
- os: ubuntu-24.04
- os: macos-13
@@ -880,8 +863,8 @@ jobs:
fail-fast: false
matrix:
include:
- os: windows-2019
- os: windows-2022
- os: windows-2025
runs-on: ${{matrix.os}}
timeout-minutes: 10
@@ -942,8 +925,8 @@ jobs:
fail-fast: false
matrix:
include:
- os: windows-2019
- os: windows-2022
- os: windows-2025
runs-on: ${{matrix.os}}
timeout-minutes: 10
@@ -1022,8 +1005,8 @@ jobs:
fail-fast: false
matrix:
include:
- os: windows-2019
- os: windows-2022
- os: windows-2025
runs-on: ${{matrix.os}}
timeout-minutes: 20

View File

@@ -38,7 +38,7 @@ and return type use spans.
```
auto sha1(boost::span<const unsigned char> input,
boost::span<unsigned char, SHA_DIGEST_LENGTH> output)
boost::span<unsigned char, SHA_DIGEST_LENGTH> ouput)
{
SHA_CTX context;
SHA1_Init(&context);

View File

@@ -28,7 +28,7 @@
# pragma intrinsic(_BitScanForward)
# pragma intrinsic(_BitScanReverse)
# if defined(_M_X64) || defined(_M_ARM64)
# if defined(_M_X64)
# pragma intrinsic(_BitScanForward64)
# pragma intrinsic(_BitScanReverse64)
# endif
@@ -230,7 +230,7 @@ inline int countl_impl( boost::uint16_t x ) BOOST_NOEXCEPT
#endif
#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64)) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
#if defined(_MSC_VER) && defined(_M_X64) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
BOOST_CXX14_CONSTEXPR inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT
{
@@ -255,7 +255,7 @@ BOOST_CXX14_CONSTEXPR inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT
}
}
#elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64))
#elif defined(_MSC_VER) && defined(_M_X64)
inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT
{
@@ -455,7 +455,7 @@ inline int countr_impl( boost::uint16_t x ) BOOST_NOEXCEPT
#endif
#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64)) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
#if defined(_MSC_VER) && defined(_M_X64) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
BOOST_CXX14_CONSTEXPR inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT
{
@@ -480,7 +480,7 @@ BOOST_CXX14_CONSTEXPR inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT
}
}
#elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64))
#elif defined(_MSC_VER) && defined(_M_X64)
inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT
{
@@ -703,7 +703,7 @@ BOOST_CXX14_CONSTEXPR inline boost::uint32_t bit_ceil_impl( boost::uint32_t x )
{
if( x == 0 )
{
return 1;
return 0;
}
--x;
@@ -723,7 +723,7 @@ BOOST_CXX14_CONSTEXPR inline boost::uint64_t bit_ceil_impl( boost::uint64_t x )
{
if( x == 0 )
{
return 1;
return 0;
}
--x;

View File

@@ -10,7 +10,6 @@ Distributed under the Boost Software License, Version 1.0.
#include <boost/config.hpp>
#include <new>
#include <cstddef>
namespace boost {

View File

@@ -30,7 +30,7 @@
#if defined( BOOST_CORE_HAS_CXXABI_H )
# include <cxxabi.h>
// For some architectures (mips, mips64, x86, x86_64) cxxabi.h in Android NDK is implemented by gabi++ library
// For some archtectures (mips, mips64, x86, x86_64) cxxabi.h in Android NDK is implemented by gabi++ library
// (https://android.googlesource.com/platform/ndk/+/master/sources/cxx-stl/gabi++/), which does not implement
// abi::__cxa_demangle(). We detect this implementation by checking the include guard here.
# if defined( __GABIXX_CXXABI_H__ )

View File

@@ -1,18 +0,0 @@
/*
Copyright 2025 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#undef BOOST_CORE_DETAIL_ASSERT
#if !defined(__clang__) && \
!defined(__INTEL_COMPILER) && \
defined(__GNUC__) && \
(__GNUC__ < 5)
#define BOOST_CORE_DETAIL_ASSERT(expr) void(0)
#else
#include <boost/assert.hpp>
#define BOOST_CORE_DETAIL_ASSERT(expr) BOOST_ASSERT(expr)
#endif

View File

@@ -37,7 +37,7 @@ namespace boost
/**
* Casts a scoped enum to its underlying type.
*
* This function is useful when working with scoped enum classes, which doesn't implicitly convert to the underlying type.
* This function is useful when working with scoped enum classes, which doens't implicitly convert to the underlying type.
* @param v A scoped enum.
* @returns The underlying type.
* @throws No-throws.

View File

@@ -8,12 +8,20 @@ Distributed under the Boost Software License, Version 1.0.
#ifndef BOOST_CORE_SPAN_HPP
#define BOOST_CORE_SPAN_HPP
#include <boost/core/detail/assert.hpp>
#include <boost/core/data.hpp>
#include <boost/assert.hpp>
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#include <array>
#include <iterator>
#include <type_traits>
#if BOOST_WORKAROUND(BOOST_GCC, < 50000)
# define BOOST_CORE_SPAN_CONSTEXPR
#else
# define BOOST_CORE_SPAN_CONSTEXPR constexpr
#endif
namespace boost {
constexpr std::size_t dynamic_extent = static_cast<std::size_t>(-1);
@@ -274,19 +282,19 @@ public:
return span<T, C>(s_.p + O, C);
}
constexpr span<T, dynamic_extent> first(size_type c) const {
return BOOST_CORE_DETAIL_ASSERT(c <= size()),
BOOST_CORE_SPAN_CONSTEXPR span<T, dynamic_extent> first(size_type c) const {
return BOOST_ASSERT(c <= size()),
span<T, dynamic_extent>(s_.p, c);
}
constexpr span<T, dynamic_extent> last(size_type c) const {
return BOOST_CORE_DETAIL_ASSERT(c <= size()),
BOOST_CORE_SPAN_CONSTEXPR span<T, dynamic_extent> last(size_type c) const {
return BOOST_ASSERT(c <= size()),
span<T, dynamic_extent>(s_.p + (s_.n - c), c);
}
constexpr span<T, dynamic_extent> subspan(size_type o,
BOOST_CORE_SPAN_CONSTEXPR span<T, dynamic_extent> subspan(size_type o,
size_type c = dynamic_extent) const {
return BOOST_CORE_DETAIL_ASSERT(o <= size() &&
return BOOST_ASSERT(o <= size() &&
(c == dynamic_extent || c + o <= size())),
span<T, dynamic_extent>(s_.p + o,
c == dynamic_extent ? s_.n - o : c);
@@ -304,16 +312,16 @@ public:
return s_.n == 0;
}
constexpr reference operator[](size_type i) const {
return BOOST_CORE_DETAIL_ASSERT(i < size()), s_.p[i];
BOOST_CORE_SPAN_CONSTEXPR reference operator[](size_type i) const {
return BOOST_ASSERT(i < size()), s_.p[i];
}
constexpr reference front() const {
return BOOST_CORE_DETAIL_ASSERT(!empty()), *s_.p;
BOOST_CORE_SPAN_CONSTEXPR reference front() const {
return BOOST_ASSERT(!empty()), *s_.p;
}
constexpr reference back() const {
return BOOST_CORE_DETAIL_ASSERT(!empty()), s_.p[s_.n - 1];
BOOST_CORE_SPAN_CONSTEXPR reference back() const {
return BOOST_ASSERT(!empty()), s_.p[s_.n - 1];
}
constexpr pointer data() const noexcept {
@@ -403,4 +411,6 @@ as_writable_bytes(span<T, E> s) noexcept
} /* boost */
#undef BOOST_CORE_SPAN_CONSTEXPR
#endif

View File

@@ -19,15 +19,14 @@ template<class T> void test_bit_ceil( T x )
T y = boost::core::bit_ceil( x );
BOOST_TEST( boost::core::has_single_bit( y ) );
BOOST_TEST_GE( +y, +x );
if( x == 0 )
{
BOOST_TEST_EQ( y, 1 );
BOOST_TEST_EQ( y, 0 );
}
else
{
BOOST_TEST( boost::core::has_single_bit( y ) );
BOOST_TEST_GE( +y, +x );
BOOST_TEST_LT( y >> 1, +x );
}
}

View File

@@ -31,7 +31,7 @@ using std::distance;
*/
// struct C {} doesn't work with libc++.
// struct C {} doesn't wotk with libc++.
typedef std::forward_iterator_tag C;
struct T

View File

@@ -6,7 +6,8 @@ Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#include <boost/config.hpp>
#if !defined(BOOST_NO_CXX11_CONSTEXPR)
#include <boost/config/workaround.hpp>
#if !defined(BOOST_NO_CXX11_CONSTEXPR) && !BOOST_WORKAROUND(BOOST_GCC, < 50000)
#include <boost/core/span.hpp>
#include <boost/core/lightweight_test.hpp>

View File

@@ -9,7 +9,7 @@
// objects to be swapped would themselves be from the boost namespace.
// If so, boost::core::invoke_swap itself might be found by argument dependent lookup.
// The implementation of boost::core::invoke_swap resolves this issue by giving
// boost::core::invoke_swap two template arguments, thereby making it less specialized
// boost::core::invoke_swap two template argumetns, thereby making it less specialized
// than std::swap.
#include <boost/core/invoke_swap.hpp>

View File

@@ -12,7 +12,7 @@
//Put test class in the global namespace
#include "./swap_test_class.hpp"
//Provide swap function in global namespace
//Provide swap function in gloabl namespace
void swap(swap_test_class& left, swap_test_class& right)
{
left.swap(right);