Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small changes to validate key mapping documentation and no assert when compiling with CMAKE_BUILD_TYPE None #1717

Merged
merged 1 commit into from
Feb 2, 2025
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
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
Loading