Skip to content

Commit

Permalink
Merge pull request #1717 from contour-terminal/improvement/small_tweaks
Browse files Browse the repository at this point in the history
Small changes to validate key mapping documentation and no assert when compiling with CMAKE_BUILD_TYPE None
  • Loading branch information
Yaraslaut authored Feb 2, 2025
2 parents fdf03a3 + a213999 commit ae85b1e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/actions/spelling/allow/uncategorized.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ DATAROOTDIR
DBus
DCCACHE
DCMAKE
DNDEBUG
DCODE
DCONTOUR
DEFGHIJKL
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ if(DEFINED MSVC)
add_compile_options(/nologo)
endif()


# CMAKE_BUILD_TYPE check for None
if(CMAKE_BUILD_TYPE STREQUAL "None")
add_compile_definitions(-DNDEBUG)
endif()

if (CONTOUR_BUILD_WITH_MIMALLOC)
add_definitions(-DCONTOUR_BUILD_WITH_MIMALLOC)
endif()
Expand Down
10 changes: 9 additions & 1 deletion src/contour/Actions.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ namespace documentation
constexpr inline std::string_view SwitchToTabRight { "Switch to tab to the right" };
} // namespace documentation

inline auto getDocumentation()
#if defined(__clang__) && __clang_major__ >= 19
constexpr
#endif
inline auto
getDocumentation()
{
return std::array {
std::tuple { Action { CancelSelection {} }, documentation::CancelSelection },
Expand Down Expand Up @@ -348,6 +352,10 @@ inline auto getDocumentation()
};
}

#if defined(__clang__) && __clang_major__ >= 19
static_assert(getDocumentation().size() == std::variant_size_v<Action>);
#endif

} // namespace contour::actions

// {{{ fmtlib custom formatters
Expand Down

0 comments on commit ae85b1e

Please sign in to comment.