diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47db4de..71ff692 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,7 @@ jobs: - toolset: gcc-14 # Do not remove! It is the only toolset that tests CMake tests down below cxxstd: "03,11,14,17,20" os: ubuntu-24.04 + compiler: g++-14 - toolset: gcc-12 cxxstd: "03,11,14,17,2a" os: ubuntu-22.04 @@ -40,6 +41,7 @@ jobs: - toolset: clang-19 cxxstd: "20,23" os: ubuntu-24.04 + compiler: clang++-19 install: clang-19 llvm-19 libclang-rt-19-dev libc++-19-dev libc++abi-19-dev clang-tools-19 runs-on: ${{matrix.os}} @@ -74,43 +76,50 @@ jobs: python tools/boostdep/depinst/depinst.py --include benchmark --include example --include examples --include tools --git_args "--depth 10 --jobs 3" $LIBRARY ./bootstrap.sh ./b2 -j4 variant=debug tools/inspect - - name: Run modules tests wihtout 'import std;' - + - name: Run modules tests without 'import std;' if: ${{matrix.toolset == 'clang-19'}} run: | cd ../boost-root/libs/lexical_cast - mkdir build_module - cd build_module - cmake -DBOOST_USE_MODULES=1 -GNinja -DCMAKE_CXX_COMPILER=clang++-19 ../test/cmake_subdir_test/ - cmake --build . - ctest -V - cd .. + cmake -S test/cmake_subdir_test -B build_module \ + -GNinja \ + -DBUILD_TESTING=1 \ + -DBOOST_USE_MODULES=1 \ + -DCMAKE_CXX_COMPILER=clang++-19 \ + -DCMAKE_C_COMPILER=clang-19 + cmake --build build_module + ctest --test-dir build_module -V --no-tests=error rm -rf build_module - name: Run modules tests - if: false - # if: ${{matrix.toolset == 'clang-19'}} + if: ${{matrix.toolset == 'clang-19'}} run: | cd ../boost-root/libs/lexical_cast - mkdir build_module - cd build_module - cmake -DBUILD_TESTING=1 -DBOOST_USE_MODULES=1 -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_EXE_LINKER_FLAGS=-stdlib=libc++ -DCMAKE_CXX_STANDARD=23 -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 -G Ninja ../test/cmake_subdir_test/ - cmake --build . - ctest -V - cd .. + cmake -S test/cmake_subdir_test -B build_module \ + -GNinja \ + -DBUILD_TESTING=1 \ + -DBOOST_USE_MODULES=1 \ + -DCMAKE_CXX_COMPILER=clang++-19 \ + -DCMAKE_C_COMPILER=clang-19 \ + -DCMAKE_CXX_FLAGS=-stdlib=libc++ \ + -DCMAKE_CXX_STANDARD=23 \ + -DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508 \ + -DCMAKE_CXX_MODULE_STD=ON + cmake --build build_module + ctest --test-dir build_module -V --no-tests=error rm -rf build_module - name: Run CMake tests - if: ${{matrix.toolset == 'gcc-14'}} + if: ${{matrix.toolset == 'gcc-14' || matrix.toolset == 'clang-19'}} run: | cd ../boost-root/ - mkdir __build - cd __build - cmake -DBUILD_TESTING=1 -DBOOST_INCLUDE_LIBRARIES=lexical_cast -DCMAKE_CXX_COMPILER=g++-14 -DCMAKE_C_COMPILER=gcc-14 .. - cmake --build . --target tests - ctest --output-on-failure --no-tests=error - cd .. + cmake -S . -B __build \ + -DBUILD_TESTING=1 \ + -DBOOST_INCLUDE_LIBRARIES=lexical_cast \ + -DCMAKE_CXX_COMPILER=${{matrix.compiler}} \ + -DCMAKE_C_COMPILER=${{matrix.toolset}} + cmake --build __build --target tests + ctest --test-dir __build --output-on-failure --no-tests=error rm -rf __build - name: Run tests @@ -187,7 +196,7 @@ jobs: git clone -b %BOOST_BRANCH% --depth 10 https://github.com/boostorg/boost.git boost-root cd boost-root xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\ - git submodule update --init tools/boostdep + git submodule update --init tools/boostdep libs/test python tools/boostdep/depinst/depinst.py --include benchmark --include example --include examples --include tools --git_args "--jobs 3" %LIBRARY% cmd /c bootstrap @@ -200,7 +209,7 @@ jobs: cd ../boost-root/ mkdir __build cd __build - cmake -DBUILD_TESTING=1 -DBOOST_INCLUDE_LIBRARIES=lexical_cast .. + cmake -DBUILD_TESTING=1 -DBOOST_INCLUDE_LIBRARIES=lexical_cast -G Ninja .. cmake --build . --target tests --config Debug ctest --output-on-failure --no-tests=error -C Debug @@ -219,7 +228,7 @@ jobs: cmake --build . ctest --no-tests=error -V - - name: Run modules tests wihtout 'import std;' + - name: Run modules tests without 'import std;' if: ${{matrix.toolset == 'msvc-14.3'}} shell: cmd run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 0dd0a35..33377c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ if (BOOST_USE_MODULES) target_compile_definitions(boost_lexical_cast PRIVATE BOOST_LEXICAL_CAST_USE_STD_MODULE) message(STATUS "Using `import std;`") else() - message(STATUS "`import std;` is not awailable") + message(STATUS "`import std;` is not available") endif() set(__scope PUBLIC) else() diff --git a/example/args_to_numbers.cpp b/example/args_to_numbers.cpp index e547e82..2a4175e 100644 --- a/example/args_to_numbers.cpp +++ b/example/args_to_numbers.cpp @@ -7,9 +7,10 @@ //[lexical_cast_args_example //`The following example treats command line arguments as a sequence of numeric data -#include #include +#include + int main(int /*argc*/, char * argv[]) { using boost::lexical_cast; diff --git a/example/generic_stringize.cpp b/example/generic_stringize.cpp index 64f0241..ad1549a 100644 --- a/example/generic_stringize.cpp +++ b/example/generic_stringize.cpp @@ -20,6 +20,12 @@ Step 1: Making a functor that converts any type to a string and remembers result: */ +#include + +#include +#include +#include + #include struct stringize_functor { @@ -38,7 +44,6 @@ public: }; //` Step 2: Applying `stringize_functor` to each element in sequence: -#include template std::string stringize(const Sequence& seq) { std::string result; @@ -47,9 +52,6 @@ std::string stringize(const Sequence& seq) { } //` Step 3: Using the `stringize` with different types: -#include -#include - int main() { std::tuple decim('-', 10, 'e', 5); if (stringize(decim) != "-10e5") { diff --git a/example/small_examples.cpp b/example/small_examples.cpp index 9352751..1d07840 100644 --- a/example/small_examples.cpp +++ b/example/small_examples.cpp @@ -4,12 +4,13 @@ // (See the accompanying file LICENSE_1_0.txt // or a copy at .) -#include - #include #include +#include #include +#include + #ifdef BOOST_MSVC # pragma warning(disable: 4996) // `strerror` is not safe #endif diff --git a/example/variant_to_long_double.cpp b/example/variant_to_long_double.cpp index 7febf88..3e4a53b 100644 --- a/example/variant_to_long_double.cpp +++ b/example/variant_to_long_double.cpp @@ -10,9 +10,13 @@ In this example we'll make a `to_long_double` method that converts value of the Boost.Variant to `long double`. */ -#include +#ifdef BOOST_USE_MODULES +#include +#endif #include +#include + struct to_long_double_functor: boost::static_visitor { template long double operator()(const T& v) const { diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e3c65aa..1cca027 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,64 +3,82 @@ # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt -include(BoostTest OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST) - -if(NOT HAVE_BOOST_TEST) - return() +if(NOT TARGET tests) + add_custom_target(tests) endif() -set(BOOST_TEST_LINK_LIBRARIES Boost::lexical_cast Boost::core) +function(boost_lexical_cast_add_test_impl test_name test_file libs) + add_executable(${test_name} ${test_file}) + target_link_libraries(${test_name} PRIVATE ${libs}) + add_test(NAME ${test_name} COMMAND ${test_name}) + add_dependencies(tests ${test_name}) +endfunction() -boost_test(TYPE run SOURCES lexical_cast_test.cpp LINK_LIBRARIES Boost::type_traits) -boost_test(TYPE run SOURCES loopback_test.cpp) -boost_test(TYPE run SOURCES abstract_test.cpp) -boost_test(TYPE run SOURCES noncopyable_test.cpp) -boost_test(TYPE run SOURCES vc8_bug_test.cpp) -boost_test(TYPE run SOURCES implicit_convert.cpp) -boost_test(TYPE run SOURCES wchars_test.cpp) -boost_test(TYPE run SOURCES float_types_test.cpp) +function(boost_lexical_cast_add_test name libs) + set(test_name lexical_cast_${name}) + set(test_file ${name}.cpp) + boost_lexical_cast_add_test_impl(${test_name} ${test_file} "Boost::lexical_cast;${libs}") +endfunction() + +boost_lexical_cast_add_test(lexical_cast_test Boost::type_traits) +boost_lexical_cast_add_test(loopback_test "") +boost_lexical_cast_add_test(abstract_test "") +boost_lexical_cast_add_test(noncopyable_test "") +boost_lexical_cast_add_test(vc8_bug_test "") +boost_lexical_cast_add_test(implicit_convert "") +boost_lexical_cast_add_test(wchars_test "") +boost_lexical_cast_add_test(float_types_test "") if(NOT MSVC) # Make sure that LexicalCast works the same way as some of the C++ Standard Libraries - boost_test(TYPE run SOURCES float_types_test.cpp COMPILE_DEFINITIONS BOOST_LEXICAL_CAST_DETAIL_TEST_ON_OLD NAME float_types_non_opt) + boost_lexical_cast_add_test_impl(lexical_cast_float_types_non_opt float_types_test.cpp Boost::lexical_cast) + target_compile_definitions(lexical_cast_float_types_non_opt PRIVATE BOOST_LEXICAL_CAST_DETAIL_TEST_ON_OLD) endif() -boost_test(TYPE run SOURCES inf_nan_test.cpp) -boost_test(TYPE run SOURCES containers_test.cpp) -boost_test(TYPE run SOURCES empty_input_test.cpp LINK_LIBRARIES Boost::range) -boost_test(TYPE run SOURCES pointers_test.cpp) +boost_lexical_cast_add_test(inf_nan_test "") +boost_lexical_cast_add_test(containers_test "") +boost_lexical_cast_add_test(empty_input_test Boost::range) +boost_lexical_cast_add_test(pointers_test "") if(MSVC) - boost_test(TYPE compile SOURCES typedefed_wchar_test.cpp COMPILE_OPTIONS "/Zc:wchar_t-") - boost_test(TYPE run SOURCES typedefed_wchar_test_runtime.cpp COMPILE_OPTIONS "/Zc:wchar_t-") + add_executable(lexical_cast_typedefed_wchar_test_compile typedefed_wchar_test.cpp) + target_compile_options(lexical_cast_typedefed_wchar_test_compile PRIVATE "/Zc:wchar_t-") + + boost_lexical_cast_add_test(typedefed_wchar_test_runtime "") + target_compile_options(lexical_cast_typedefed_wchar_test_runtime PRIVATE "/Zc:wchar_t-") endif() -boost_test(TYPE run SOURCES no_locale_test.cpp - COMPILE_DEFINITIONS BOOST_NO_STD_LOCALE BOOST_LEXICAL_CAST_ASSUME_C_LOCALE - LINK_LIBRARIES Boost::range +boost_lexical_cast_add_test(no_locale_test Boost::range) +target_compile_definitions(lexical_cast_no_locale_test + PRIVATE + BOOST_NO_STD_LOCALE + BOOST_LEXICAL_CAST_ASSUME_C_LOCALE ) -boost_test(TYPE run SOURCES no_exceptions_test.cpp - COMPILE_OPTIONS "-fno-exceptions" - COMPILE_DEFINITIONS - _HAS_EXCEPTIONS=0 # MSVC stdlib - _STLP_NO_EXCEPTIONS # STLPort - LINK_LIBRARIES Boost::range +boost_lexical_cast_add_test_impl(lexical_cast_no_exceptions_test no_exceptions_test.cpp "Boost::container;Boost::range") +target_include_directories(lexical_cast_no_exceptions_test PRIVATE ../include) +target_compile_definitions(lexical_cast_no_exceptions_test + PRIVATE + _HAS_EXCEPTIONS=0 # MSVC stdlib + _STLP_NO_EXCEPTIONS # STLPort ) +if(MSVC) + target_compile_definitions(lexical_cast_no_exceptions_test PRIVATE BOOST_NO_EXCEPTIONS) +endif() +target_compile_options(lexical_cast_no_exceptions_test PRIVATE "-fno-exceptions") -boost_test(TYPE run SOURCES iterator_range_test.cpp LINK_LIBRARIES Boost::range) -boost_test(TYPE run SOURCES string_view_test.cpp LINK_LIBRARIES Boost::utility) -boost_test(TYPE run SOURCES arrays_test.cpp LINK_LIBRARIES Boost::array) -boost_test(TYPE run SOURCES integral_types_test.cpp LINK_LIBRARIES Boost::type_traits) -boost_test(TYPE run SOURCES stream_detection_test.cpp) -boost_test(TYPE run SOURCES stream_traits_test.cpp LINK_LIBRARIES Boost::array Boost::range Boost::utility) +boost_lexical_cast_add_test(iterator_range_test Boost::range) +boost_lexical_cast_add_test(string_view_test Boost::utility) +boost_lexical_cast_add_test(arrays_test Boost::array) +boost_lexical_cast_add_test(integral_types_test Boost::type_traits) +boost_lexical_cast_add_test(stream_detection_test "") +boost_lexical_cast_add_test(stream_traits_test "Boost::array;Boost::range;Boost::utility") -boost_test(TYPE compile-fail SOURCES to_pointer_test.cpp) -boost_test(TYPE compile-fail SOURCES from_volatile.cpp) -boost_test(TYPE run SOURCES filesystem_test.cpp LINK_LIBRARIES Boost::filesystem) -boost_test(TYPE run SOURCES try_lexical_convert.cpp) +boost_lexical_cast_add_test(filesystem_test Boost::filesystem) +boost_lexical_cast_add_test(try_lexical_convert "") file(GLOB EXAMPLE_FILES "../example/*.cpp") foreach (testsourcefile ${EXAMPLE_FILES}) - boost_test(TYPE run SOURCES ${testsourcefile} LINK_LIBRARIES Boost::variant Boost::date_time) + get_filename_component(testname ${testsourcefile} NAME_WE) + boost_lexical_cast_add_test_impl(lexical_cast_example_${testname} ${testsourcefile} "Boost::variant;Boost::date_time") endforeach() diff --git a/test/abstract_test.cpp b/test/abstract_test.cpp index 359cddd..87079e2 100644 --- a/test/abstract_test.cpp +++ b/test/abstract_test.cpp @@ -12,10 +12,10 @@ // Test abstract class. Bug 1358600: // http://sf.net/tracker/?func=detail&aid=1358600&group_id=7586&atid=107586 -#include - #include +#include + class A { public: diff --git a/test/arrays_test.cpp b/test/arrays_test.cpp index f1e70a5..298ec86 100644 --- a/test/arrays_test.cpp +++ b/test/arrays_test.cpp @@ -8,12 +8,12 @@ // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). -#include - #include #include +#include + using namespace boost; #if !defined(BOOST_NO_CXX11_CHAR16_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS) && !defined(_LIBCPP_VERSION) && !defined(BOOST_MSVC) @@ -61,7 +61,7 @@ static void testing_template_array_output_on_spec_value(T val) BOOST_TEST_THROWS(lexical_cast(val), boost::bad_lexical_cast); } -#if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_NO_STD_WSTRING) +#if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_NO_STD_WSTRING) && !defined(_LIBCPP_VERSION) typedef ArrayT warr_type; typedef ArrayT wshort_arr_type; std::wstring wethalon(L"100"); @@ -156,7 +156,7 @@ static void testing_template_array_output_on_char_value() BOOST_TEST_THROWS(lexical_cast(val), boost::bad_lexical_cast); } -#if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_NO_STD_WSTRING) +#if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_NO_STD_WSTRING) && !defined(_LIBCPP_VERSION) typedef ArrayT warr_type; typedef ArrayT wshort_arr_type; std::wstring wethalon(L"100"); @@ -238,11 +238,13 @@ static void testing_template_array_output_on_char_value() void testing_boost_array_output_conversion() { +#ifndef _LIBCPP_VERSION testing_template_array_output_on_char_value(); testing_template_array_output_on_spec_value(100); testing_template_array_output_on_spec_value(static_cast(100)); testing_template_array_output_on_spec_value(static_cast(100)); testing_template_array_output_on_spec_value(static_cast(100)); +#endif } void testing_std_array_output_conversion() @@ -344,7 +346,10 @@ static void testing_generic_array_input_conversion() void testing_boost_array_input_conversion() { +#ifndef _LIBCPP_VERSION testing_generic_array_input_conversion(); +#endif + BOOST_TEST(true); } void testing_std_array_input_conversion() diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt index e1f7818..fb3951f 100644 --- a/test/cmake_subdir_test/CMakeLists.txt +++ b/test/cmake_subdir_test/CMakeLists.txt @@ -1,4 +1,5 @@ # Copyright (c) 2016-2025 Antony Polukhin +# Copyright (c) 2025-2026 Fedor Osetrov # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt @@ -6,20 +7,70 @@ cmake_minimum_required(VERSION 3.5...4.0) project(lexical_cast_subdir_test LANGUAGES CXX) -add_subdirectory(../../../assert boostorg/assert) -add_subdirectory(../../../core boostorg/core) -add_subdirectory(../../../config boostorg/config) -add_subdirectory(../../../container boostorg/container) -add_subdirectory(../../../container_hash boostorg/container_hash) -add_subdirectory(../../../detail boostorg/detail) -add_subdirectory(../../../intrusive boostorg/intrusive) -add_subdirectory(../../../move boostorg/move) -add_subdirectory(../../../throw_exception boostorg/throw_exception) -add_subdirectory(../../../type_traits boostorg/type_traits) +set(deps -add_subdirectory(../../ boostorg/lexical_cast) +# Library dependencies +config +container +core +throw_exception + +# Test dependencies +algorithm +array +align +assert +atomic +bind +compat +concept_check +container_hash +conversion +date_time +describe +detail +exception +filesystem +function +function_types +functional +fusion +integer +intrusive +io +iterator +move +mp11 +mpl +numeric/conversion +optional +predef +preprocessor +range +regex +scope +smart_ptr +static_assert +system +test +tokenizer +tuple +type_index +type_traits +typeof +unordered +utility +variant +variant2 +winapi +) + +foreach(dep IN LISTS deps) + add_subdirectory(../../../${dep} boostorg/${dep}) +endforeach() enable_testing() +add_subdirectory(../../ boostorg/lexical_cast) if (BOOST_USE_MODULES) add_executable(boost_lexical_cast_module_usage ../modules/usage_sample.cpp) @@ -27,26 +78,3 @@ if (BOOST_USE_MODULES) add_test(NAME boost_lexical_cast_module_usage COMMAND boost_lexical_cast_module_usage) endif() -list(APPEND RUN_TESTS_SOURCES - lexical_cast_test.cpp - loopback_test.cpp - abstract_test.cpp - noncopyable_test.cpp - vc8_bug_test.cpp - implicit_convert.cpp - float_types_test.cpp - inf_nan_test.cpp - containers_test.cpp - pointers_test.cpp - integral_types_test.cpp - stream_detection_test.cpp - try_lexical_convert.cpp -) - -foreach (testsourcefile ${RUN_TESTS_SOURCES}) - get_filename_component(testname ${testsourcefile} NAME_WLE) - add_executable(${PROJECT_NAME}_${testname} ../${testsourcefile}) - target_link_libraries(${PROJECT_NAME}_${testname} Boost::lexical_cast Boost::type_traits Boost::core) - add_test(NAME ${PROJECT_NAME}_${testname} COMMAND ${PROJECT_NAME}_${testname}) -endforeach() - diff --git a/test/containers_test.cpp b/test/containers_test.cpp index 077a6a9..8296c3b 100644 --- a/test/containers_test.cpp +++ b/test/containers_test.cpp @@ -8,11 +8,11 @@ // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). -#include - #include #include +#include + using namespace boost; void testing_boost_containers_basic_string() diff --git a/test/empty_input_test.cpp b/test/empty_input_test.cpp index f9a6a93..e1df142 100644 --- a/test/empty_input_test.cpp +++ b/test/empty_input_test.cpp @@ -8,15 +8,16 @@ // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). -#include #include -#include "escape_struct.hpp" - #include #include +#include + +#include "escape_struct.hpp" + using namespace boost; #if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING) diff --git a/test/filesystem_test.cpp b/test/filesystem_test.cpp index a50f326..6930016 100644 --- a/test/filesystem_test.cpp +++ b/test/filesystem_test.cpp @@ -10,11 +10,11 @@ // // Test lexical_cast usage with long filesystem::path. Bug 7704. -#include - #include #include +#include + void test_filesystem() { boost::filesystem::path p; diff --git a/test/float_types_test.cpp b/test/float_types_test.cpp index 717797b..df0559b 100644 --- a/test/float_types_test.cpp +++ b/test/float_types_test.cpp @@ -8,19 +8,21 @@ // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). -#ifndef BOOST_LEXICAL_CAST_DETAIL_TEST_ON_OLD -#include -#else -// Make sure that tests work the same way on non-optimized version -#include "lexical_cast_old.hpp" -#endif - #include #include #include #include + +#ifndef BOOST_LEXICAL_CAST_DETAIL_TEST_ON_OLD #include +#include +#else +// Make sure that tests work the same way on non-optimized version +#include "lexical_cast_old.hpp" +#include +#endif + #ifndef BOOST_TEST_CLOSE_FRACTION // Naiive, but works for most tests in this file @@ -304,7 +306,7 @@ void test_float_typess_for_overflows() BOOST_TEST_THROWS(lexical_cast("1"+s_max_value), bad_lexical_cast); BOOST_TEST_THROWS(lexical_cast("9"+s_max_value), bad_lexical_cast); #endif - +#if !(defined(_LIBCPP_VERSION) && defined(BOOST_LEXICAL_CAST_DETAIL_TEST_ON_OLD)) if ( std::is_same::value ) { BOOST_TEST_THROWS(lexical_cast( (std::numeric_limits::max)() ), bad_lexical_cast); @@ -340,6 +342,7 @@ void test_float_typess_for_overflows() <= (std::numeric_limits::min)() / 2 + std::numeric_limits::epsilon() ); } +#endif } #undef CHECK_CLOSE_ABS_DIFF diff --git a/test/implicit_convert.cpp b/test/implicit_convert.cpp index 0773c16..7f5150c 100644 --- a/test/implicit_convert.cpp +++ b/test/implicit_convert.cpp @@ -4,10 +4,10 @@ // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). -#include - #include +#include + struct oops { operator int () const { return 41; diff --git a/test/inf_nan_test.cpp b/test/inf_nan_test.cpp index 66bf9aa..a5f0a25 100644 --- a/test/inf_nan_test.cpp +++ b/test/inf_nan_test.cpp @@ -10,12 +10,12 @@ #include -#include - #include #include +#include + #if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING) #define BOOST_LCAST_NO_WCHAR_T #endif diff --git a/test/integral_types_test.cpp b/test/integral_types_test.cpp index 7c31a5a..572e9a9 100644 --- a/test/integral_types_test.cpp +++ b/test/integral_types_test.cpp @@ -19,8 +19,6 @@ // #define _SCL_SECURE_NO_WARNINGS -#include - #include #include @@ -34,6 +32,8 @@ #include #include +#include + #if (defined(BOOST_HAS_LONG_LONG) || defined(BOOST_HAS_MS_INT64)) \ && !(defined(BOOST_MSVC) && BOOST_MSVC < 1300) #define LCAST_TEST_LONGLONG diff --git a/test/iterator_range_test.cpp b/test/iterator_range_test.cpp index 09f6d54..b7d2e67 100644 --- a/test/iterator_range_test.cpp +++ b/test/iterator_range_test.cpp @@ -9,12 +9,12 @@ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). -#include - #include #include +#include + using namespace boost; #if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING) @@ -136,7 +136,7 @@ void test_it_range_using_char(CharT* one, CharT* eleven) #endif BOOST_TEST_EQ(lexical_cast(crng2), 1); -#ifndef BOOST_LCAST_NO_WCHAR_T +#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(_LIBCPP_VERSION) BOOST_TEST(lexical_cast(rng1) == L"1"); BOOST_TEST(lexical_cast(crng1) == L"1"); BOOST_TEST(lexical_cast(rng2) == L"1"); @@ -191,7 +191,7 @@ void test_signed_char_iterator_ranges() void test_wchar_iterator_ranges() { -#ifndef BOOST_LCAST_NO_WCHAR_T +#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(_LIBCPP_VERSION) typedef wchar_t test_char_type; test_char_type data1[] = L"1"; test_char_type data2[] = L"11"; diff --git a/test/lexical_cast_old.hpp b/test/lexical_cast_old.hpp index 4ffcc38..8d51c65 100644 --- a/test/lexical_cast_old.hpp +++ b/test/lexical_cast_old.hpp @@ -42,6 +42,9 @@ #include #endif +#if defined(BOOST_USE_MODULES) +#undef BOOST_USE_MODULES +#endif #include #include #include diff --git a/test/lexical_cast_test.cpp b/test/lexical_cast_test.cpp index ed83c7d..44eb890 100644 --- a/test/lexical_cast_test.cpp +++ b/test/lexical_cast_test.cpp @@ -19,8 +19,6 @@ // #define _SCL_SECURE_NO_WARNINGS -#include - #include #include @@ -31,6 +29,8 @@ #include // std::transform #include +#include + #if (defined(BOOST_HAS_LONG_LONG) || defined(BOOST_HAS_MS_INT64)) \ && !(defined(BOOST_MSVC) && BOOST_MSVC < 1300) #define LCAST_TEST_LONGLONG @@ -528,8 +528,10 @@ void test_char16_conversions() // There's no std::ctype in Xcode_15.0.1 #if !defined(BOOST_NO_CXX11_CHAR16_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS) && !defined(__APPLE__) BOOST_TEST(u"100" == lexical_cast(u"100")); +#if !defined(_LIBCPP_VERSION) // libc++ also does not have std::ctype BOOST_TEST(u"1" == lexical_cast(u'1')); #endif +#endif } void test_char32_conversions() @@ -537,8 +539,10 @@ void test_char32_conversions() // There's no std::ctype in Xcode_15.0.1 #if !defined(BOOST_NO_CXX11_CHAR32_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS) && !defined(__APPLE__) BOOST_TEST(U"100" == lexical_cast(U"100")); +#if !defined(_LIBCPP_VERSION) // libc++ also does not have std::ctype BOOST_TEST(U"1" == lexical_cast(U'1')); #endif +#endif } void test_getting_pointer_to_function() diff --git a/test/loopback_test.cpp b/test/loopback_test.cpp index 844efb7..10a3cc2 100644 --- a/test/loopback_test.cpp +++ b/test/loopback_test.cpp @@ -12,10 +12,10 @@ // Test round-tripping conversion FPT -> string -> FPT, // where FPT is Floating Point Type. -#include - #include +#include + #if (defined(__CYGWIN__) || defined(__FreeBSD__) || defined(__NetBSD__) \ || (defined(__hppa) && !defined(__OpenBSD__)) || (defined(__NO_LONG_DOUBLE_MATH) && (DBL_MANT_DIG != LDBL_MANT_DIG))) \ || defined(__MINGW64__) diff --git a/test/no_exceptions_test.cpp b/test/no_exceptions_test.cpp index f79cdf4..1d11508 100644 --- a/test/no_exceptions_test.cpp +++ b/test/no_exceptions_test.cpp @@ -16,12 +16,16 @@ #pragma warning(disable: 4097 4100 4121 4127 4146 4244 4245 4511 4512 4701 4800) #endif -#include #include #include #include +#if defined(BOOST_USE_MODULES) +#undef BOOST_USE_MODULES +#endif +#include + #include "escape_struct.hpp" #ifndef BOOST_NO_EXCEPTIONS diff --git a/test/no_locale_test.cpp b/test/no_locale_test.cpp index 6d339a2..d4689f4 100644 --- a/test/no_locale_test.cpp +++ b/test/no_locale_test.cpp @@ -8,8 +8,6 @@ // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). -#include - #include #include @@ -17,6 +15,8 @@ #include +#include + using namespace boost; // Testing compilation and some basic usage with BOOST_NO_STD_LOCALE diff --git a/test/noncopyable_test.cpp b/test/noncopyable_test.cpp index eb63236..a550dc4 100644 --- a/test/noncopyable_test.cpp +++ b/test/noncopyable_test.cpp @@ -11,11 +11,12 @@ // // Test that Source can be non-copyable. -#include #include #include +#include + class Noncopyable : private boost::noncopyable { public: diff --git a/test/pointers_test.cpp b/test/pointers_test.cpp index 95b9b2c..0737a81 100644 --- a/test/pointers_test.cpp +++ b/test/pointers_test.cpp @@ -8,12 +8,12 @@ // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). -#include - #include #include +#include + #if defined(BOOST_NO_STRINGSTREAM) typedef std::strstream ss_t; #else diff --git a/test/stream_detection_test.cpp b/test/stream_detection_test.cpp index 677a3f2..15513fc 100644 --- a/test/stream_detection_test.cpp +++ b/test/stream_detection_test.cpp @@ -8,13 +8,13 @@ // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). -#include - #include #include #include +#include + ///////////////////////// char streamable classes /////////////////////////////////////////// diff --git a/test/stream_traits_test.cpp b/test/stream_traits_test.cpp index 9fab3cc..5555503 100644 --- a/test/stream_traits_test.cpp +++ b/test/stream_traits_test.cpp @@ -4,6 +4,9 @@ // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). +#if defined(BOOST_USE_MODULES) +#undef BOOST_USE_MODULES +#endif #include #include diff --git a/test/string_view_test.cpp b/test/string_view_test.cpp index 678efb0..395daf0 100644 --- a/test/string_view_test.cpp +++ b/test/string_view_test.cpp @@ -9,8 +9,6 @@ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). -#include - #include #ifndef BOOST_NO_CXX17_HDR_STRING_VIEW @@ -19,6 +17,8 @@ #include +#include + template void test_string_view_conversion() { diff --git a/test/try_lexical_convert.cpp b/test/try_lexical_convert.cpp index b9183fc..4709623 100644 --- a/test/try_lexical_convert.cpp +++ b/test/try_lexical_convert.cpp @@ -8,10 +8,10 @@ // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). -#include - #include +#include + using namespace boost::conversion; void try_uncommon_cases() diff --git a/test/vc8_bug_test.cpp b/test/vc8_bug_test.cpp index 6ceadba..a4ebeda 100644 --- a/test/vc8_bug_test.cpp +++ b/test/vc8_bug_test.cpp @@ -12,7 +12,6 @@ // implementation has changed and it does not use stringstream for casts // to integral types -#include #include #include @@ -20,6 +19,8 @@ #include #include +#include + #ifdef BOOST_MSVC # pragma warning(disable: 4127) // conditional expression is constant #endif diff --git a/test/wchars_test.cpp b/test/wchars_test.cpp index 7d682be..db5695f 100644 --- a/test/wchars_test.cpp +++ b/test/wchars_test.cpp @@ -8,9 +8,14 @@ // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). +#include + #include -#include +#if defined(BOOST_USE_MODULES) +#undef BOOST_USE_MODULES +#endif +#include #if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING) #define BOOST_LCAST_NO_WCHAR_T