From 605cd8ef4aa1b9b73e9be5f1493ca60467a3568b Mon Sep 17 00:00:00 2001 From: Philip Top Date: Thu, 19 Dec 2019 10:52:03 -0800 Subject: [PATCH 01/11] fix shadow and some undef warnings --- toml/traits.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/toml/traits.hpp b/toml/traits.hpp index 0064e37..a1c6144 100644 --- a/toml/traits.hpp +++ b/toml/traits.hpp @@ -209,7 +209,9 @@ struct is_container : conjunction< negation>, // not a map negation>, // not a std::string #if __cplusplus >= 201703L +#if __has_include() negation>, // not a std::string_view +#endif // has_include() #endif has_iterator, // has T::iterator has_value_type // has T::value_type From acad8b1a61849834fb75722899484e8150422420 Mon Sep 17 00:00:00 2001 From: Philip Top Date: Thu, 19 Dec 2019 12:22:42 -0800 Subject: [PATCH 02/11] add additional check for invocability --- toml/traits.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toml/traits.hpp b/toml/traits.hpp index a1c6144..3839451 100644 --- a/toml/traits.hpp +++ b/toml/traits.hpp @@ -282,7 +282,7 @@ using enable_if_t = typename std::enable_if::type; // --------------------------------------------------------------------------- // return_type_of_t -#if __cplusplus >= 201703L +#if __cplusplus >= 201703L && defined(__cpp_lib_is_invocable) && __cpp_lib_is_invokable>=201710 template using return_type_of_t = std::invoke_result_t; From 26a066ad073e1f61a6cfe5f8fe49d767966c4a7c Mon Sep 17 00:00:00 2001 From: Philip Top Date: Thu, 19 Dec 2019 12:40:22 -0800 Subject: [PATCH 03/11] skip ci ci skip update another string_view issue --- CMakeLists.txt | 4 ++++ toml/string.hpp | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 49b665d..ce0e811 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.1) enable_testing() +if("${CMAKE_VERSION}" VERSION_GREATER 3.1) + project(toml11 VERSION 3.2.0) +else() + project(toml11) project(toml11 VERSION 3.7.0) diff --git a/toml/string.hpp b/toml/string.hpp index a6ed080..5136d8c 100644 --- a/toml/string.hpp +++ b/toml/string.hpp @@ -9,6 +9,7 @@ #if __cplusplus >= 201703L #if __has_include() +#define TOML11_USING_STRING_VIEW 1 #include #endif #endif @@ -53,7 +54,7 @@ struct string string& operator+=(const std::string& rhs) {str += rhs; return *this;} string& operator+=(const string& rhs) {str += rhs.str; return *this;} -#if __cplusplus >= 201703L +#if defined(TOML11_USING_STRING_VIEW) && TOML11_USING_STRING_VIEW>0 explicit string(std::string_view s): kind(string_t::basic), str(s){} string(std::string_view s, string_t k): kind(k), str(s){} From 99e483c44746a38ce13c6684bfbdc3957ac33410 Mon Sep 17 00:00:00 2001 From: Philip Top Date: Thu, 19 Dec 2019 12:49:33 -0800 Subject: [PATCH 04/11] [ci skip] use a policy in the CMakeLists.txt for toml11 fix some more string_view errors --- CMakeLists.txt | 4 ---- toml/get.hpp | 2 +- toml/value.hpp | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ce0e811..49b665d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,5 @@ cmake_minimum_required(VERSION 3.1) enable_testing() -if("${CMAKE_VERSION}" VERSION_GREATER 3.1) - project(toml11 VERSION 3.2.0) -else() - project(toml11) project(toml11 VERSION 3.7.0) diff --git a/toml/get.hpp b/toml/get.hpp index 6669e34..d7fdf55 100644 --- a/toml/get.hpp +++ b/toml/get.hpp @@ -140,7 +140,7 @@ get(basic_value&& v) // ============================================================================ // std::string_view -#if __cplusplus >= 201703L +#if defined(TOML11_USING_STRING_VIEW) && TOML11_USING_STRING_VIEW>0 template class M, template class V> inline detail::enable_if_t::value, std::string_view> diff --git a/toml/value.hpp b/toml/value.hpp index ecae2c3..1b43db8 100644 --- a/toml/value.hpp +++ b/toml/value.hpp @@ -624,7 +624,7 @@ class basic_value assigner(this->string_, toml::string(std::string(s), kind)); } -#if __cplusplus >= 201703L +#if defined(TOML11_USING_STRING_VIEW) && TOML11_USING_STRING_VIEW>0 basic_value(std::string_view s) : type_(value_t::string), region_info_(std::make_shared(region_base{})) From 6dd44dc67255e9f0192d0e3c6de02ba83eb553dc Mon Sep 17 00:00:00 2001 From: Philip Top Date: Thu, 16 Jan 2020 16:30:30 -0800 Subject: [PATCH 05/11] fix project issue with cmake --- CMakeLists.txt | 2 +- tests/CMakeLists.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 49b665d..9795bfe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ option(toml11_TEST_WITH_ASAN "use LLVM address sanitizer" OFF) option(toml11_TEST_WITH_UBSAN "use LLVM undefined behavior sanitizer" OFF) include(CheckCXXCompilerFlag) -if("${CMAKE_VERSION}" VERSION_GREATER 3.1) +if(CMAKE_VERSION VERSION_GREATER 3.1) set(CMAKE_CXX_STANDARD 11 CACHE STRING "The C++ standard whose features are requested to build all targets.") set(CMAKE_CXX_STANDARD_REQUIRED ON CACHE BOOL "Boolean describing whether the value of CXX_STANDARD is a requirement.") set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Boolean specifying whether compiler specific extensions are requested.") diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 49ebcb4..0c122db 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -149,6 +149,8 @@ if(MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4820") # pragma warning(pop): likely mismatch, popping warning state pushed in different file set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd5031") + # pragma warning(pop): spectre warnings in tests + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd5045") endif() find_package(Boost COMPONENTS unit_test_framework REQUIRED) From e08c579e369174673ddf876a8a32d4d7d46b4f50 Mon Sep 17 00:00:00 2001 From: Philip Top Date: Fri, 20 Mar 2020 06:39:59 -0700 Subject: [PATCH 06/11] fix a change in the key_value name from upstream merge --- tests/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0c122db..99d73b9 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -151,6 +151,8 @@ if(MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd5031") # pragma warning(pop): spectre warnings in tests set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd5045") + # pragma warning(pop): spectre warnings in tests + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4265") endif() find_package(Boost COMPONENTS unit_test_framework REQUIRED) @@ -187,6 +189,7 @@ option(TOML11_REQUIRE_FILESYSTEM_LIBRARY "need to link -lstdc++fs or -lc++fs" OF foreach(TEST_NAME ${TEST_NAMES}) add_executable(${TEST_NAME} ${TEST_NAME}.cpp) target_link_libraries(${TEST_NAME} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} toml11::toml11) + target_include_directories(${TEST_NAME} SYSTEM PRIVATE ${Boost_INCLUDE_DIRS}) # to compile tests with ... if(TOML11_REQUIRE_FILESYSTEM_LIBRARY) From 7f98740c9c67967781ed7db1510ac6391bc1ae3b Mon Sep 17 00:00:00 2001 From: Philip Top Date: Fri, 20 Mar 2020 13:34:42 -0700 Subject: [PATCH 07/11] update from changes in cmake standard --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9795bfe..dcc3804 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,9 +9,11 @@ option(toml11_TEST_WITH_UBSAN "use LLVM undefined behavior sanitizer" OFF) include(CheckCXXCompilerFlag) if(CMAKE_VERSION VERSION_GREATER 3.1) - set(CMAKE_CXX_STANDARD 11 CACHE STRING "The C++ standard whose features are requested to build all targets.") - set(CMAKE_CXX_STANDARD_REQUIRED ON CACHE BOOL "Boolean describing whether the value of CXX_STANDARD is a requirement.") - set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Boolean specifying whether compiler specific extensions are requested.") + set(CMAKE_CXX_EXTENSIONS OFF) + if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) + endif() + set(CXX_STANDARD_REQUIRED ON) else() # Manually check for C++11 compiler flag. CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) From a919190490d7d2d2f0d5160a281bc5be499b943c Mon Sep 17 00:00:00 2001 From: Philip Top Date: Fri, 19 Nov 2021 08:47:18 -0800 Subject: [PATCH 08/11] tweak the cmake a little --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dcc3804..bcf84bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,11 +9,11 @@ option(toml11_TEST_WITH_UBSAN "use LLVM undefined behavior sanitizer" OFF) include(CheckCXXCompilerFlag) if(CMAKE_VERSION VERSION_GREATER 3.1) - set(CMAKE_CXX_EXTENSIONS OFF) + set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Boolean specifying whether compiler specific extensions are requested.") if(NOT DEFINED CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD 11 CACHE STRING "The C++ standard whose features are requested to build all targets.") endif() - set(CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_STANDARD_REQUIRED ON CACHE BOOL "Boolean describing whether the value of CXX_STANDARD is a requirement.") else() # Manually check for C++11 compiler flag. CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) From eef7106fbe7a74366d3d3158b396a5a905f6f461 Mon Sep 17 00:00:00 2001 From: Philip Top Date: Fri, 19 Nov 2021 10:22:37 -0800 Subject: [PATCH 09/11] fix more warnings --- toml/traits.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toml/traits.hpp b/toml/traits.hpp index 3839451..fa33ff0 100644 --- a/toml/traits.hpp +++ b/toml/traits.hpp @@ -282,7 +282,7 @@ using enable_if_t = typename std::enable_if::type; // --------------------------------------------------------------------------- // return_type_of_t -#if __cplusplus >= 201703L && defined(__cpp_lib_is_invocable) && __cpp_lib_is_invokable>=201710 +#if __cplusplus >= 201703L && defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable>=201710 template using return_type_of_t = std::invoke_result_t; From 84f61f7dc844b4996c60613a2cd33e80f7654e8f Mon Sep 17 00:00:00 2001 From: Philip Top Date: Tue, 23 Nov 2021 16:16:16 -0800 Subject: [PATCH 10/11] match the cmake condition to upstream --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bcf84bc..1121345 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ option(toml11_TEST_WITH_ASAN "use LLVM address sanitizer" OFF) option(toml11_TEST_WITH_UBSAN "use LLVM undefined behavior sanitizer" OFF) include(CheckCXXCompilerFlag) -if(CMAKE_VERSION VERSION_GREATER 3.1) +if("${CMAKE_VERSION}" VERSION_GREATER 3.1) set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Boolean specifying whether compiler specific extensions are requested.") if(NOT DEFINED CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 11 CACHE STRING "The C++ standard whose features are requested to build all targets.") From 9c1708c988e75fa9dabd50906f11c85f09d2d0dd Mon Sep 17 00:00:00 2001 From: Philip Top Date: Wed, 24 Nov 2021 06:40:09 -0800 Subject: [PATCH 11/11] Update toml/traits.hpp Co-authored-by: Toru Niina --- toml/traits.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toml/traits.hpp b/toml/traits.hpp index fa33ff0..5495c93 100644 --- a/toml/traits.hpp +++ b/toml/traits.hpp @@ -282,7 +282,7 @@ using enable_if_t = typename std::enable_if::type; // --------------------------------------------------------------------------- // return_type_of_t -#if __cplusplus >= 201703L && defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable>=201710 +#if __cplusplus >= 201703L && defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable>=201703 template using return_type_of_t = std::invoke_result_t;