From 2cc916ac479f6d826a6f5f13b14ebb4a7fcd92ab Mon Sep 17 00:00:00 2001 From: tytan652 Date: Tue, 22 Oct 2024 18:46:27 +0200 Subject: [PATCH] cmake/plugins: Enable -Wswitch on GCC This warning is already enabled for Clang which causes issue for things that are usually built with MSVC or GCC (e.g. non-macOS plugins). obs-nvenc switch warning is also fixed in this commit. obs-qsv11 has switch warning set to not become errors. --- cmake/linux/compilerconfig.cmake | 1 + plugins/obs-nvenc/nvenc-helpers.c | 1 + plugins/obs-qsv11/CMakeLists.txt | 7 +++++++ 3 files changed, 9 insertions(+) diff --git a/cmake/linux/compilerconfig.cmake b/cmake/linux/compilerconfig.cmake index 92ab95735c1a11..3f4d45e4dbb096 100644 --- a/cmake/linux/compilerconfig.cmake +++ b/cmake/linux/compilerconfig.cmake @@ -33,6 +33,7 @@ set( -Wno-unused-function -Wno-unused-label -Wparentheses + -Wswitch -Wuninitialized -Wunreachable-code -Wunused-parameter diff --git a/plugins/obs-nvenc/nvenc-helpers.c b/plugins/obs-nvenc/nvenc-helpers.c index f99067962ed47c..c6ea42131a9571 100644 --- a/plugins/obs-nvenc/nvenc-helpers.c +++ b/plugins/obs-nvenc/nvenc-helpers.c @@ -179,6 +179,7 @@ const char *nv_error_name(NVENCSTATUS err) RETURN_CASE(NV_ENC_ERR_RESOURCE_REGISTER_FAILED); RETURN_CASE(NV_ENC_ERR_RESOURCE_NOT_REGISTERED); RETURN_CASE(NV_ENC_ERR_RESOURCE_NOT_MAPPED); + RETURN_CASE(NV_ENC_ERR_NEED_MORE_OUTPUT); } #undef RETURN_CASE diff --git a/plugins/obs-qsv11/CMakeLists.txt b/plugins/obs-qsv11/CMakeLists.txt index b6419b630f1641..b590a58e0a3741 100644 --- a/plugins/obs-qsv11/CMakeLists.txt +++ b/plugins/obs-qsv11/CMakeLists.txt @@ -35,6 +35,13 @@ target_sources( target_compile_definitions(obs-qsv11 PRIVATE $<$:DX11_D3D>) +target_compile_options( + obs-qsv11 + PRIVATE + $<$:-Wno-error=switch> + $<$:-Wno-error=switch> +) + target_link_libraries( obs-qsv11 PRIVATE