diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 338f307..a77fc2e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -204,6 +204,21 @@ jobs: compiler_name: "gcc" compiler_version: "12" + - prefix: "Linux" + os: "ubuntu-latest" + container: + image: "ghcr.io/dnkpp/gcc:11" + compiler_name: "gcc" + compiler_version: "11" + + - prefix: "Linux" + os: "ubuntu-latest" + container: + image: "ghcr.io/dnkpp/gcc:10" + compiler_name: "gcc" + compiler_version: "10" + compat_source_loc: true + # msvc - prefix: "Windows 2022" os: "windows-2022" @@ -244,6 +259,11 @@ jobs: compiler_name: "clang" compiler_version: "16" libcxx: false + # gcc-10 doesn't know C++-23 + - cxx_standard: 23 + config: + compiler_name: "gcc" + compiler_version: "10" # seems like macOS doesn't support 32bit builds - architecture: "32bit" config: @@ -268,6 +288,12 @@ jobs: -D CTNP_CXX_STANDARD="${{ matrix.cxx_standard }}" \ )" >> $GITHUB_ENV + - name: Setup compatibility source-location option + if: ${{ matrix.config.compat_source_loc }} + shell: bash + run: | + echo "CMAKE_BASE_OPTIONS=$(echo ${CMAKE_BASE_OPTIONS} -DCTNP_TESTING_COMPAT_SOURCE_LOC=ON)" >> $GITHUB_ENV + - name: Setup macOS if: startsWith(matrix.config.os, 'macOS') shell: bash diff --git a/include/ctnp/config/Config.hpp b/include/ctnp/config/Config.hpp index 91115a3..85b2fca 100644 --- a/include/ctnp/config/Config.hpp +++ b/include/ctnp/config/Config.hpp @@ -8,9 +8,20 @@ #pragma once +#include + #ifndef CTNP_ASSERT #include #define CTNP_ASSERT(condition, msg, ...) assert((condition) && msg) #endif +// clang-format off +// Prevent number from getting decorated with '. +#if 201907L <= __cpp_lib_constexpr_vector + // clang-format on + #define CTNP_DETAIL_CONSTEXPR_VECTOR constexpr +#else + #define CTNP_DETAIL_CONSTEXPR_VECTOR inline +#endif + #endif diff --git a/include/ctnp/parsing/Reductions.hpp b/include/ctnp/parsing/Reductions.hpp index 732782e..a2f7f94 100644 --- a/include/ctnp/parsing/Reductions.hpp +++ b/include/ctnp/parsing/Reductions.hpp @@ -157,7 +157,7 @@ namespace ctnp::parsing return true; } - constexpr bool try_reduce_as_arg_sequence(TokenStack& tokenStack) + CTNP_DETAIL_CONSTEXPR_VECTOR bool try_reduce_as_arg_sequence(TokenStack& tokenStack) { std::span pendingTokens{tokenStack}; if (std::optional suffix = match_suffix(pendingTokens)) @@ -228,7 +228,7 @@ namespace ctnp::parsing return true; } - constexpr bool try_reduce_as_function_context(TokenStack& tokenStack) + CTNP_DETAIL_CONSTEXPR_VECTOR bool try_reduce_as_function_context(TokenStack& tokenStack) { std::span pendingTokens{tokenStack}; if (!is_suffix_of(pendingTokens)) diff --git a/include/ctnp/parsing/Tokens.hpp b/include/ctnp/parsing/Tokens.hpp index 54bf0a2..8bc07d7 100644 --- a/include/ctnp/parsing/Tokens.hpp +++ b/include/ctnp/parsing/Tokens.hpp @@ -187,7 +187,7 @@ namespace ctnp::parsing::token bool isNoexcept{false}; [[nodiscard]] - constexpr bool has_ptr() const noexcept + CTNP_DETAIL_CONSTEXPR_VECTOR bool has_ptr() const noexcept { return 1u < layers.size(); } @@ -233,18 +233,18 @@ namespace ctnp::parsing::token public: std::vector types; - constexpr ~ArgSequence() noexcept; - constexpr ArgSequence(); - constexpr ArgSequence(ArgSequence const&); - constexpr ArgSequence& operator=(ArgSequence const&); - constexpr ArgSequence(ArgSequence&&) noexcept; - constexpr ArgSequence& operator=(ArgSequence&&) noexcept; + CTNP_DETAIL_CONSTEXPR_VECTOR ~ArgSequence() noexcept; + CTNP_DETAIL_CONSTEXPR_VECTOR ArgSequence(); + CTNP_DETAIL_CONSTEXPR_VECTOR ArgSequence(ArgSequence const&); + CTNP_DETAIL_CONSTEXPR_VECTOR ArgSequence& operator=(ArgSequence const&); + CTNP_DETAIL_CONSTEXPR_VECTOR ArgSequence(ArgSequence&&) noexcept; + CTNP_DETAIL_CONSTEXPR_VECTOR ArgSequence& operator=(ArgSequence&&) noexcept; template - constexpr void operator()(Visitor& visitor) const; + CTNP_DETAIL_CONSTEXPR_VECTOR void operator()(Visitor& visitor) const; template - constexpr void handle_as_template_args(Visitor& visitor) const; + CTNP_DETAIL_CONSTEXPR_VECTOR void handle_as_template_args(Visitor& visitor) const; }; class Identifier @@ -563,15 +563,15 @@ namespace ctnp::parsing::token } }; - constexpr ArgSequence::~ArgSequence() noexcept = default; - constexpr ArgSequence::ArgSequence() = default; - constexpr ArgSequence::ArgSequence(ArgSequence const&) = default; - constexpr ArgSequence& ArgSequence::operator=(ArgSequence const&) = default; - constexpr ArgSequence::ArgSequence(ArgSequence&&) noexcept = default; - constexpr ArgSequence& ArgSequence::operator=(ArgSequence&&) noexcept = default; + CTNP_DETAIL_CONSTEXPR_VECTOR ArgSequence::~ArgSequence() noexcept = default; + CTNP_DETAIL_CONSTEXPR_VECTOR ArgSequence::ArgSequence() = default; + CTNP_DETAIL_CONSTEXPR_VECTOR ArgSequence::ArgSequence(ArgSequence const&) = default; + CTNP_DETAIL_CONSTEXPR_VECTOR ArgSequence& ArgSequence::operator=(ArgSequence const&) = default; + CTNP_DETAIL_CONSTEXPR_VECTOR ArgSequence::ArgSequence(ArgSequence&&) noexcept = default; + CTNP_DETAIL_CONSTEXPR_VECTOR ArgSequence& ArgSequence::operator=(ArgSequence&&) noexcept = default; template - constexpr void ArgSequence::operator()(Visitor& visitor) const + CTNP_DETAIL_CONSTEXPR_VECTOR void ArgSequence::operator()(Visitor& visitor) const { if (!types.empty()) { @@ -588,7 +588,7 @@ namespace ctnp::parsing::token } template - constexpr void ArgSequence::handle_as_template_args(Visitor& visitor) const + CTNP_DETAIL_CONSTEXPR_VECTOR void ArgSequence::handle_as_template_args(Visitor& visitor) const { auto& unwrapped = unwrap_visitor(visitor); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index cef295e..5c2968f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -18,8 +18,7 @@ add_executable(${TARGET_NAME} add_subdirectory("parsing") -target_include_directories(${TARGET_NAME} - PRIVATE +target_include_directories(${TARGET_NAME} PRIVATE "$" ) @@ -27,8 +26,7 @@ include(CTNP-EnableWarnings) include(CTNP-EnableAdditionalFlags) find_package(Catch2 REQUIRED) find_package(mimicpp REQUIRED) -target_link_libraries(${TARGET_NAME} - PRIVATE +target_link_libraries(${TARGET_NAME} PRIVATE ctnp::ctnp ctnp::internal::enable-warnings ctnp::internal::enable-additional-flags @@ -37,8 +35,24 @@ target_link_libraries(${TARGET_NAME} Catch2::Catch2WithMain ) -target_precompile_headers(${TARGET_NAME} - PRIVATE +option(CTNP_TESTING_COMPAT_SOURCE_LOC "" OFF) +message(DEBUG "${MESSAGE_PREFIX} CTNP_TESTING_COMPAT_SOURCE_LOC: ${CTNP_TESTING_COMPAT_SOURCE_LOC}") +if (CTNP_TESTING_COMPAT_SOURCE_LOC) + + set(SOURCE_LOCATION_BUILD_TESTS OFF) + CPMAddPackage("gh:paweldac/source_location@0.4") + + target_link_libraries(${TARGET_NAME} PRIVATE + nostd::source_location + ) + + target_compile_definitions(${TARGET_NAME} PRIVATE + "MIMICPP_CONFIG_ALTERNATIVE_SOURCE_LOCATION_BACKEND=nostd::source_location" + ) +endif () + +target_precompile_headers(${TARGET_NAME} PRIVATE + "$<$:>" "Catch2FallbackStringifier.hpp" diff --git a/tests/cmake/Findmimicpp.cmake b/tests/cmake/Findmimicpp.cmake index 832abdb..84f1b7e 100644 --- a/tests/cmake/Findmimicpp.cmake +++ b/tests/cmake/Findmimicpp.cmake @@ -5,13 +5,13 @@ include(get_cpm) +set(MIMICPP_CONFIG_USE_FMT ON) +set(MIMICPP_CONFIG_EXPERIMENTAL_STACKTRACE ON) +set(MIMICPP_CONFIG_EXPERIMENTAL_USE_CPPTRACE ON) CPMAddPackage(mimicpp - VERSION 7 + #VERSION 7 + GIT_TAG 779085478419edfc23c5e254db1f51586c771b9e # commit from 20.06.2025 GITHUB_REPOSITORY DNKpp/mimicpp SYSTEM YES EXCLUDE_FROM_ALL YES - OPTIONS - "MIMICPP_CONFIG_USE_FMT ON" - #"MIMICPP_CONFIG_EXPERIMENTAL_STACKTRACE ON" - #"MIMICPP_CONFIG_EXPERIMENTAL_USE_CPPTRACE ON" ) diff --git a/tests/cmake/get_cpm.cmake b/tests/cmake/get_cpm.cmake index 77b333c..8474873 100644 --- a/tests/cmake/get_cpm.cmake +++ b/tests/cmake/get_cpm.cmake @@ -2,8 +2,8 @@ # # SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors -set(CPM_DOWNLOAD_VERSION 0.41.0) -set(CPM_HASH_SUM "e570f03806b9aae2082ca5b950a9e6b3b41ad56972a78a876aedcaad16653116") +set(CPM_DOWNLOAD_VERSION 0.42.0) +set(CPM_HASH_SUM "2020b4fc42dba44817983e06342e682ecfc3d2f484a581f11cc5731fbe4dce8a") if(CPM_SOURCE_CACHE) set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")