From c4e843b6dde49e01a1d45178eefc2707c565c794 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Fri, 4 Nov 2022 18:47:13 +0100 Subject: [PATCH] Fix clang compiler warning [why] Compiling with clang issues this warning (clang 10.0 and 15.0 tested): .../sol/sol.hpp:14541:32: warning: unknown warning group '-Wmaybe-uninitialized', ignored [-Wunknown-warning-option] #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" [how] Check if the compiler does know the warning, before trying to turn the warning off. Signed-off-by: Fini Jastrow --- include/sol/protected_function_result.hpp | 2 ++ include/sol/stack_check_get_qualified.hpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/sol/protected_function_result.hpp b/include/sol/protected_function_result.hpp index 4d53ce04..8fe0b68f 100644 --- a/include/sol/protected_function_result.hpp +++ b/include/sol/protected_function_result.hpp @@ -101,7 +101,9 @@ namespace sol { #if SOL_IS_ON(SOL_COMPILER_GCC) #pragma GCC diagnostic push +#if !SOL_IS_ON(SOL_COMPILER_CLANG) #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif #endif template diff --git a/include/sol/stack_check_get_qualified.hpp b/include/sol/stack_check_get_qualified.hpp index 60825033..753f911a 100644 --- a/include/sol/stack_check_get_qualified.hpp +++ b/include/sol/stack_check_get_qualified.hpp @@ -32,7 +32,9 @@ namespace sol { namespace stack { #if SOL_IS_ON(SOL_COMPILER_GCC) #pragma GCC diagnostic push +#if !SOL_IS_ON(SOL_COMPILER_CLANG) #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif #endif namespace stack_detail {