Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down
11 changes: 11 additions & 0 deletions include/ctnp/config/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,20 @@

#pragma once

#include <version>

#ifndef CTNP_ASSERT
#include <cassert>
#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
4 changes: 2 additions & 2 deletions include/ctnp/parsing/Reductions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ArgSequence, ArgSeparator, Type>(pendingTokens))
Expand Down Expand Up @@ -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<ClosingParens>(pendingTokens))
Expand Down
34 changes: 17 additions & 17 deletions include/ctnp/parsing/Tokens.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -233,18 +233,18 @@ namespace ctnp::parsing::token
public:
std::vector<Type> 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 <parser_visitor Visitor>
constexpr void operator()(Visitor& visitor) const;
CTNP_DETAIL_CONSTEXPR_VECTOR void operator()(Visitor& visitor) const;

template <parser_visitor Visitor>
constexpr void handle_as_template_args(Visitor& visitor) const;
CTNP_DETAIL_CONSTEXPR_VECTOR void handle_as_template_args(Visitor& visitor) const;
};

class Identifier
Expand Down Expand Up @@ -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 <parser_visitor Visitor>
constexpr void ArgSequence::operator()(Visitor& visitor) const
CTNP_DETAIL_CONSTEXPR_VECTOR void ArgSequence::operator()(Visitor& visitor) const
{
if (!types.empty())
{
Expand All @@ -588,7 +588,7 @@ namespace ctnp::parsing::token
}

template <parser_visitor Visitor>
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);

Expand Down
26 changes: 20 additions & 6 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ add_executable(${TARGET_NAME}

add_subdirectory("parsing")

target_include_directories(${TARGET_NAME}
PRIVATE
target_include_directories(${TARGET_NAME} PRIVATE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>"
)

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
Expand All @@ -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
"$<$<BOOL:${CTNP_TESTING_COMPAT_SOURCE_LOC}>:<mimic++/compatibility/paweldac-source_location.hpp$<ANGLE-R>>"
<mimic++/mimic++.hpp>
"Catch2FallbackStringifier.hpp"
<catch2/catch_all.hpp>
Expand Down
10 changes: 5 additions & 5 deletions tests/cmake/Findmimicpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
4 changes: 2 additions & 2 deletions tests/cmake/get_cpm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Loading