From 56b768f2585d1cc931308185ce7d824065295d3b Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 21 Jun 2025 15:46:15 +0100 Subject: [PATCH] Fix -Wunused-variable warnings in testcases --- Examples/test-suite/cpp11_auto_variable.i | 8 ++++++-- Examples/test-suite/special_variables.i | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Examples/test-suite/cpp11_auto_variable.i b/Examples/test-suite/cpp11_auto_variable.i index ade9da75a..9040a1a5e 100644 --- a/Examples/test-suite/cpp11_auto_variable.i +++ b/Examples/test-suite/cpp11_auto_variable.i @@ -41,12 +41,16 @@ static constexpr auto NOEXCEPT_FUNC = noexcept(func); %warnfilter(SWIGWARN_CPP11_AUTO) Bad4; %inline %{ - static auto Bad1 = &t; static constexpr auto Bad2 = &f; static auto Bad3 = &zero; static constexpr auto Bad4 = &one; - +%} +%{ +// Wunused-variable warning suppression +bool warning_suppression() { + return Bad1 || Bad3; +} %} %inline %{ diff --git a/Examples/test-suite/special_variables.i b/Examples/test-suite/special_variables.i index 31bbac4c2..90d7f80c2 100644 --- a/Examples/test-suite/special_variables.i +++ b/Examples/test-suite/special_variables.i @@ -128,6 +128,7 @@ void DirectorTest_director_testmethodSwigExplicitDirectorTest(int i) {} %typemap(directorargout) int i { $symname(99); int isvoid_special_variable = $isvoid; + (void)isvoid_special_variable; } %feature("director") DirectorTest; %inline %{