diff --git a/src/example/pegtl/coverage.cpp b/src/example/pegtl/coverage.cpp index c68f2d98..0205a5e2 100644 --- a/src/example/pegtl/coverage.cpp +++ b/src/example/pegtl/coverage.cpp @@ -2,7 +2,10 @@ // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) +#if defined( __cpp_exception ) + #include +#include #include #include #include @@ -14,7 +17,6 @@ #include #include -#include namespace coverage { @@ -140,9 +142,9 @@ namespace coverage { assert( !in.empty() ); std::size_t t = 0; - const bool b = pegtl::internal::convert_unsigned( t, in.string_view() ); - (void)b; - assert( b ); + const auto p = std::from_chars( in.begin(), in.end(), t ); + (void)p; + assert( p.ptr == in.end() ); assert( t > 0 ); st.number = t - 1; st.count = std::nullopt; @@ -319,3 +321,12 @@ int main( int argc, char** argv ) coverage::coverage( std::vector< std::string >( argv + 1, argv + argc ) ).report(); return 0; } + +#else + +int main( int /*unused*/, char** /*unused*/ ) +{ + return 0; +} + +#endif diff --git a/src/test/pegtl/contrib_integer_convert.cpp b/src/test/pegtl/contrib_integer_convert.cpp index 8baa4dfd..fa670ad5 100644 --- a/src/test/pegtl/contrib_integer_convert.cpp +++ b/src/test/pegtl/contrib_integer_convert.cpp @@ -6,11 +6,12 @@ #include "test.hpp" +#if defined( __cpp_exceptions ) + #include namespace TAO_PEGTL_NAMESPACE { - void unit_test() { for( char c = 2; c < 122; ++c ) { @@ -156,4 +157,17 @@ namespace TAO_PEGTL_NAMESPACE } // namespace TAO_PEGTL_NAMESPACE +#else + +namespace TAO_PEGTL_NAMESPACE +{ + void unit_test() + { + std::cerr << "Skipping convert test..." << std::endl; + } + +} // namespace TAO_PEGTL_NAMESPACE + +#endif + #include "main.hpp" diff --git a/src/test/pegtl/internal_mmap_input.cpp b/src/test/pegtl/internal_mmap_input.cpp index c70af87e..ffe18b6b 100644 --- a/src/test/pegtl/internal_mmap_input.cpp +++ b/src/test/pegtl/internal_mmap_input.cpp @@ -4,7 +4,7 @@ #include "test.hpp" -#if defined( _POSIX_MAPPED_FILES ) || defined( _WIN32 ) +#if defined( __cpp_exceptions ) && ( defined( _POSIX_MAPPED_FILES ) || defined( _WIN32 ) ) #include "verify_file.hpp"