From d2ff28f98843135c614b1abc5305f16f7c69f3f1 Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Sun, 17 Nov 2024 21:34:52 +0100 Subject: [PATCH] Silence spurious warning and enable JSON_DIAGNOSTICS everywhere --- CMakeLists.txt | 2 +- dashboard/CMakeLists.txt | 2 ++ server/CMakeLists.txt | 2 ++ server/driver/configuration.cpp | 7 ++----- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fe35222..2a93ff3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -290,7 +290,7 @@ foreach(TARGET_NAME wivrn wivrn-server wivrn-dashboard wivrn-common wivrn-dissec -Wno-comment -Wno-unused-variable -Wno-sign-compare - $<$:-Wno-volatile> + $<$:-Wno-volatile -Wno-array-bounds> $<$:-Wno-deprecated-volatile -Wno-unneeded-internal-declaration -Wno-c99-extensions -Wno-unused-private-field> ) diff --git a/dashboard/CMakeLists.txt b/dashboard/CMakeLists.txt index ea4dd93f..3345f0b2 100644 --- a/dashboard/CMakeLists.txt +++ b/dashboard/CMakeLists.txt @@ -68,6 +68,8 @@ target_link_libraries(wivrn-dashboard PRIVATE wivrn-common-base ) +target_compile_definitions(wivrn-dashboard PRIVATE JSON_DIAGNOSTICS=1) + if (WIVRN_CHECK_CAPSYSNICE) target_link_libraries(wivrn-dashboard PRIVATE PkgConfig::libcap) endif() diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 3b891cf5..19fe9519 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -199,6 +199,8 @@ target_link_libraries( nlohmann_json::nlohmann_json ) +target_compile_definitions(wivrn-server PRIVATE JSON_DIAGNOSTICS=1) + configure_file(dist/wivrn.service.in wivrn.service) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/wivrn.service DESTINATION lib/systemd/user/) diff --git a/server/driver/configuration.cpp b/server/driver/configuration.cpp index b23d5666..ec6bfd41 100644 --- a/server/driver/configuration.cpp +++ b/server/driver/configuration.cpp @@ -18,10 +18,7 @@ */ #define JSON_DISABLE_ENUM_SERIALIZATION 1 -#ifdef JSON_DIAGNOSTICS -#undef JSON_DIAGNOSTICS -#endif -#define JSON_DIAGNOSTICS 1 + #include #include #include @@ -216,7 +213,7 @@ static void save_keys(const std::vector & keys) for (const auto & key: keys) { - json.push_back(nlohmann::json{ + json.push_back({ {"key", key.public_key}, {"name", key.name}, });