From f51dc98dfcaecf402e2d3aa3e0282b27beb4e237 Mon Sep 17 00:00:00 2001 From: abhishekbelgaonkar23 <155880197+abhishekbelgaonkar23@users.noreply.github.com> Date: Sat, 16 Nov 2024 13:41:56 +0530 Subject: [PATCH] Fix: Clang 19 -Wc++20-extensions warning (#2910) --- src/catch2/internal/catch_compiler_capabilities.hpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/catch2/internal/catch_compiler_capabilities.hpp b/src/catch2/internal/catch_compiler_capabilities.hpp index d544b00c..4cf1d652 100644 --- a/src/catch2/internal/catch_compiler_capabilities.hpp +++ b/src/catch2/internal/catch_compiler_capabilities.hpp @@ -103,8 +103,16 @@ # define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ _Pragma( "clang diagnostic ignored \"-Wunused-variable\"" ) -# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"" ) +# if (__clang_major__ >= 20) +# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wvariadic-macro-arguments-omitted\"" ) +# elif (__clang_major__ == 19) +# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wc++20-extensions\"" ) +# else +# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS + _Pragma( "clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"" ) +# endif # define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ _Pragma( "clang diagnostic ignored \"-Wunused-template\"" )