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

CLAP_STATE_CONTEXT_COMPAT is not coming #51

Merged
merged 4 commits into from
Jan 21, 2024
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: 13 additions & 13 deletions .github/workflows/pullreq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ jobs:
exe: .exe

- os: ubuntu-latest
cmakeargs: -DCMAKE_CXX_COMPILER=g++-11 -DCMAKE_C_COMPILER=gcc-11
cmakeargs: -DCMAKE_CXX_COMPILER=g++-11 -DCMAKE_C_COMPILER=gcc-11 -DCLAP_HELPERS_TESTS_CXX_STANDARD=11
install_ninja: false
name: Linux gcc11
name: Linux gcc11 C++ 11

- os: ubuntu-latest
cmakeargs: -DCMAKE_CXX_COMPILER=g++-12 -DCMAKE_C_COMPILER=gcc-12
cmakeargs: -DCMAKE_CXX_COMPILER=g++-12 -DCMAKE_C_COMPILER=gcc-12 -DCLAP_HELPERS_TESTS_CXX+STANDARD=17
install_ninja: false
name: Linux gcc12
name: Linux gcc12 C++ 17

- os: ubuntu-latest
cmakeargs: -DCLAP_HELPERS_TESTS_CXX_STANDARD=20 -DCMAKE_CXX_COMPILER=g++-12 -DCMAKE_C_COMPILER=gcc-12
Expand All @@ -58,25 +58,25 @@ jobs:
name: Linux gcc12 C++23

- os: macos-latest
cmakeargs: -GNinja
cmakeargs: -GNinja -DCLAP_HELPERS_TESTS_CXX_STANDARD=11
install_ninja: true
name: MacOS Ninja
name: MacOS Ninja C++11

- os: macos-latest
cmakeargs: -G"Xcode"
cmakeargs: -G"Xcode" -DCLAP_HELPERS_TESTS_CXX_STANDARD=14
install_ninja: false
name: MacOS Xcode
name: MacOS Xcode C++14

- os: macos-latest
cmakeargs: -G"Unix Makefiles" -DCLAP_HELPERS_TESTS_CXX_STANDARD=17
abique marked this conversation as resolved.
Show resolved Hide resolved
install_ninja: false
name: MacOS Unix Makefiles C++17

- os: macos-latest
cmakeargs: -G"Ninja Multi-Config" -DCLAP_HELPERS_TESTS_CXX_STANDARD=20
install_ninja: true
name: MacOS Ninja Multi C++20

- os: macos-latest
cmakeargs: -G"Unix Makefiles"
install_ninja: false
name: MacOS Unix Makefiles

steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ if (${CLAP_HELPERS_BUILD_TESTS})
if (NOT DEFINED CLAP_HELPERS_TESTS_CXX_STANDARD)
message(STATUS "${PROJECT_NAME}: defaulting to c++11")
set(CLAP_HELPERS_TESTS_CXX_STANDARD 11)
else()
message(STATUS "${PROJECT_NAME}: Using CXX Standard ${CLAP_HELPERS_TESTS_CXX_STANDARD}")
endif()

if ((NOT TARGET Catch2::Catch2WithMain) AND ${CLAP_HELPERS_DOWNLOAD_DEPENDENCIES})
Expand Down Expand Up @@ -65,10 +67,18 @@ if (${CLAP_HELPERS_BUILD_TESTS})
tests/preset-discovery-provider.cc
tests/preset-discovery-metadata-receiver.cc
)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD ${CLAP_HELPERS_TESTS_CXX_STANDARD})
set_target_properties(${PROJECT_NAME}-tests PROPERTIES CXX_STANDARD ${CLAP_HELPERS_TESTS_CXX_STANDARD})
target_link_libraries(${PROJECT_NAME}-tests ${PROJECT_NAME} Catch2::Catch2WithMain)
target_compile_definitions(${PROJECT_NAME}-tests PUBLIC -DCATCH_CONFIG_PREFIX_ALL)

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
target_compile_options(${PROJECT_NAME}-tests
PRIVATE
-Werror
)
endif()

add_custom_command(TARGET ${PROJECT_NAME}-tests POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "Relocating $<TARGET_FILE:${PROJECT_NAME}-tests> to ${CMAKE_BINARY_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:${PROJECT_NAME}-tests>" "${CMAKE_BINARY_DIR}"
Expand Down
4 changes: 2 additions & 2 deletions include/clap/helpers/host.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -428,15 +428,15 @@ namespace clap { namespace helpers {
///////////////
template <MisbehaviourHandler h, CheckingLevel l>
Host<h, l> &Host<h, l>::from(const clap_host *host) noexcept {
if constexpr (l >= CheckingLevel::Minimal) {
if (l >= CheckingLevel::Minimal) {
if (!host) CLAP_HELPERS_UNLIKELY {
std::cerr << "Passed an null host pointer" << std::endl;
std::terminate();
}
}

auto self = static_cast<Host *>(host->host_data);
if constexpr (l >= CheckingLevel::Minimal) {
if (l >= CheckingLevel::Minimal) {
if (!self) CLAP_HELPERS_UNLIKELY {
std::cerr << "Passed an invalid host pointer because the host_data is null"
<< std::endl;
Expand Down
7 changes: 1 addition & 6 deletions include/clap/helpers/plugin.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -440,12 +440,7 @@ namespace clap { namespace helpers {

if (!strcmp(id, CLAP_EXT_STATE) && self.implementsState())
return &_pluginState;
if ((!strcmp(id, CLAP_EXT_STATE_CONTEXT)
#ifdef CLAP_EXT_STATE_CONTEXT_COMPAT
|| !strcmp(id, CLAP_EXT_STATE_CONTEXT_COMPAT)
#endif
) &&
self.implementsStateContext() && self.implementsState())
if (!strcmp(id, CLAP_EXT_STATE_CONTEXT) && self.implementsStateContext() && self.implementsState())
return &_pluginStateContext;
if ((!strcmp(id, CLAP_EXT_PRESET_LOAD) || !strcmp(id, CLAP_EXT_PRESET_LOAD_COMPAT)) &&
self.implementsPresetLoad())
Expand Down
Loading