[Libreoffice-commits] core.git: compilerplugins/clang

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 3 13:25:40 UTC 2021


 compilerplugins/clang/test/buriedassign.cxx           |    1 +
 compilerplugins/clang/test/constparams.cxx            |    3 +++
 compilerplugins/clang/test/convertlong.cxx            |    1 +
 compilerplugins/clang/test/expressionalwayszero.cxx   |    1 +
 compilerplugins/clang/test/implicitboolconversion.cxx |    1 +
 compilerplugins/clang/test/passparamsbyref.cxx        |    3 +++
 compilerplugins/clang/test/passstuffbyref.cxx         |    3 +++
 compilerplugins/clang/test/reducevarscope.cxx         |    3 +++
 compilerplugins/clang/test/redundantfcast.cxx         |    1 +
 compilerplugins/clang/test/sequentialassign.cxx       |    3 +++
 compilerplugins/clang/test/simplifybool.cxx           |    3 +++
 compilerplugins/clang/test/stringadd.cxx              |    4 ++++
 compilerplugins/clang/test/stringconcatliterals.cxx   |    3 +++
 compilerplugins/clang/test/stringliteralvar.cxx       |    1 +
 compilerplugins/clang/test/stringloop.cxx             |    3 +++
 compilerplugins/clang/test/stringview.cxx             |    1 +
 compilerplugins/clang/test/unoany.cxx                 |    3 +++
 compilerplugins/clang/test/unusedenumconstants.cxx    |    1 +
 compilerplugins/clang/test/unusedfields.cxx           |    1 +
 compilerplugins/clang/test/unusedindex.cxx            |    3 +++
 compilerplugins/clang/test/vclwidgets.cxx             |    1 +
 compilerplugins/clang/test/writeonlyvars.cxx          |    2 ++
 22 files changed, 46 insertions(+)

New commits:
commit 067603dbda470f4333979ad7027458fc22d6d403
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Jun 3 13:44:39 2021 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Jun 3 15:25:01 2021 +0200

    -Wunused-but-set-{parameter,variable} in CompilerTest_compilerplugins_clang
    
    ...new with Clang trunk 13.  As a rule of thumb, this change adds explicit
    cast-to-void silencing in those .cxx that already contained other such silencing
    casts and adds wholesale #pragma clang diagnostic ignored in all others.
    
    Change-Id: I1884496ee1aa81aaf3c8b3533534a4b69b185e9e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116660
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/compilerplugins/clang/test/buriedassign.cxx b/compilerplugins/clang/test/buriedassign.cxx
index d75c519f4c4a..0d9f011939a3 100644
--- a/compilerplugins/clang/test/buriedassign.cxx
+++ b/compilerplugins/clang/test/buriedassign.cxx
@@ -126,6 +126,7 @@ void main(OUString sUserAutoCorrFile, int* p2)
     // expected-error at +1 {{buried assignment, rather put on own line [loplugin:buriedassign]}}
     if ((p1 = p2) && sUserAutoCorrFile == "yyy")
         sRet = sUserAutoCorrFile;
+    (void)sRet;
 }
 }
 
diff --git a/compilerplugins/clang/test/constparams.cxx b/compilerplugins/clang/test/constparams.cxx
index 2cffd87fd5be..60d0148c1d69 100644
--- a/compilerplugins/clang/test/constparams.cxx
+++ b/compilerplugins/clang/test/constparams.cxx
@@ -9,6 +9,9 @@
 
 #include <string>
 
+#pragma clang diagnostic ignored "-Wunknown-warning-option" // for Clang < 13
+#pragma clang diagnostic ignored "-Wunused-but-set-variable"
+
 struct Class1
 {
     int const * m_f1;
diff --git a/compilerplugins/clang/test/convertlong.cxx b/compilerplugins/clang/test/convertlong.cxx
index 850da3edebf1..020cdbb68090 100644
--- a/compilerplugins/clang/test/convertlong.cxx
+++ b/compilerplugins/clang/test/convertlong.cxx
@@ -32,6 +32,7 @@ void main2()
 
     int tmp2 = (sal_uLong)1;
     tmp2 = (long)1;
+    (void)tmp2;
 
     sal_uIntPtr tmp3 = x + y;
     // expected-error-re at -1 {{rather replace type of decl 'sal_uIntPtr' (aka 'unsigned {{.+}}') with 'int' [loplugin:convertlong]}}
diff --git a/compilerplugins/clang/test/expressionalwayszero.cxx b/compilerplugins/clang/test/expressionalwayszero.cxx
index 4986e5d690f7..23d3e2652ce7 100644
--- a/compilerplugins/clang/test/expressionalwayszero.cxx
+++ b/compilerplugins/clang/test/expressionalwayszero.cxx
@@ -42,5 +42,6 @@ int main()
 
     auto v5 = Enum2::ONE;
     v5 &= Enum2::ZERO; // expected-error {{expression always evaluates to zero, lhs=unknown rhs=0 [loplugin:expressionalwayszero]}}
+    (void)v5;
 }
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/test/implicitboolconversion.cxx b/compilerplugins/clang/test/implicitboolconversion.cxx
index 31082d1d378b..8d669ed79959 100644
--- a/compilerplugins/clang/test/implicitboolconversion.cxx
+++ b/compilerplugins/clang/test/implicitboolconversion.cxx
@@ -31,6 +31,7 @@ void f()
     (void)a;
     bool b2 = true;
     b2 &= g();
+    (void)b2;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/test/passparamsbyref.cxx b/compilerplugins/clang/test/passparamsbyref.cxx
index e58aa79bcaa8..010556a67b6e 100644
--- a/compilerplugins/clang/test/passparamsbyref.cxx
+++ b/compilerplugins/clang/test/passparamsbyref.cxx
@@ -9,6 +9,9 @@
 
 #include <rtl/ustring.hxx>
 
+#pragma clang diagnostic ignored "-Wunknown-warning-option" // for Clang < 13
+#pragma clang diagnostic ignored "-Wunused-but-set-variable"
+
 struct S {
     OUString mv1;
     OUString mv2;
diff --git a/compilerplugins/clang/test/passstuffbyref.cxx b/compilerplugins/clang/test/passstuffbyref.cxx
index 3f0efb1d106e..d90d6f05ba9f 100644
--- a/compilerplugins/clang/test/passstuffbyref.cxx
+++ b/compilerplugins/clang/test/passstuffbyref.cxx
@@ -11,6 +11,9 @@
 #include <o3tl/cow_wrapper.hxx>
 #include <vector>
 
+#pragma clang diagnostic ignored "-Wunknown-warning-option" // for Clang < 13
+#pragma clang diagnostic ignored "-Wunused-but-set-variable"
+
 struct S1 {
     OUString mv1;
     OUString const & get() const { return mv1; }
diff --git a/compilerplugins/clang/test/reducevarscope.cxx b/compilerplugins/clang/test/reducevarscope.cxx
index ee600c988efe..ca4ed09be585 100644
--- a/compilerplugins/clang/test/reducevarscope.cxx
+++ b/compilerplugins/clang/test/reducevarscope.cxx
@@ -9,6 +9,9 @@
 
 #include <rtl/ustring.hxx>
 
+#pragma clang diagnostic ignored "-Wunknown-warning-option" // for Clang < 13
+#pragma clang diagnostic ignored "-Wunused-but-set-variable"
+
 void test1()
 {
     int i = 2; // expected-error {{can reduce scope of var [loplugin:reducevarscope]}}
diff --git a/compilerplugins/clang/test/redundantfcast.cxx b/compilerplugins/clang/test/redundantfcast.cxx
index 255c1d44b2a7..d9aad3619075 100644
--- a/compilerplugins/clang/test/redundantfcast.cxx
+++ b/compilerplugins/clang/test/redundantfcast.cxx
@@ -61,6 +61,7 @@ int main()
     OUString s2;
     s2 = OUString(
         s1); // expected-error at -1 {{redundant functional cast from 'rtl::OUString' to 'rtl::OUString' [loplugin:redundantfcast]}}
+    (void)s2;
 
     Color col1;
     Color col2 = Color(
diff --git a/compilerplugins/clang/test/sequentialassign.cxx b/compilerplugins/clang/test/sequentialassign.cxx
index e656e1a7a304..b7182db5c5b2 100644
--- a/compilerplugins/clang/test/sequentialassign.cxx
+++ b/compilerplugins/clang/test/sequentialassign.cxx
@@ -9,6 +9,9 @@
 
 #include <rtl/ustring.hxx>
 
+#pragma clang diagnostic ignored "-Wunknown-warning-option" // for Clang < 13
+#pragma clang diagnostic ignored "-Wunused-but-set-variable"
+
 namespace test1
 {
 void f(OUString s1)
diff --git a/compilerplugins/clang/test/simplifybool.cxx b/compilerplugins/clang/test/simplifybool.cxx
index 906feabee96f..a32acccd6c19 100644
--- a/compilerplugins/clang/test/simplifybool.cxx
+++ b/compilerplugins/clang/test/simplifybool.cxx
@@ -16,6 +16,9 @@
 
 #include <map>
 
+#pragma clang diagnostic ignored "-Wunknown-warning-option" // for Clang < 13
+#pragma clang diagnostic ignored "-Wunused-but-set-variable"
+
 namespace group1
 {
 void f1(int a, int b)
diff --git a/compilerplugins/clang/test/stringadd.cxx b/compilerplugins/clang/test/stringadd.cxx
index a18b562a052f..fb805ce519b9 100644
--- a/compilerplugins/clang/test/stringadd.cxx
+++ b/compilerplugins/clang/test/stringadd.cxx
@@ -12,6 +12,10 @@
 #include <rtl/ustrbuf.hxx>
 #include <rtl/ustring.hxx>
 
+#pragma clang diagnostic ignored "-Wunknown-warning-option" // for Clang < 13
+#pragma clang diagnostic ignored "-Wunused-but-set-parameter"
+#pragma clang diagnostic ignored "-Wunused-but-set-variable"
+
 // ---------------------------------------------------------------
 // += tests
 
diff --git a/compilerplugins/clang/test/stringconcatliterals.cxx b/compilerplugins/clang/test/stringconcatliterals.cxx
index d19ebb97c1c3..8b390f28fbbb 100644
--- a/compilerplugins/clang/test/stringconcatliterals.cxx
+++ b/compilerplugins/clang/test/stringconcatliterals.cxx
@@ -14,6 +14,9 @@
 #include <rtl/string.hxx>
 #include <rtl/ustring.hxx>
 
+#pragma clang diagnostic ignored "-Wunknown-warning-option" // for Clang < 13
+#pragma clang diagnostic ignored "-Wunused-but-set-variable"
+
 #define FOO "foo"
 #define FOOu u"foo"
 
diff --git a/compilerplugins/clang/test/stringliteralvar.cxx b/compilerplugins/clang/test/stringliteralvar.cxx
index b34274c45219..33d6b638629c 100644
--- a/compilerplugins/clang/test/stringliteralvar.cxx
+++ b/compilerplugins/clang/test/stringliteralvar.cxx
@@ -107,6 +107,7 @@ void f11(int nStreamType)
             sStreamType = sDocumentType;
             break;
     }
+    (void)sStreamType;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/test/stringloop.cxx b/compilerplugins/clang/test/stringloop.cxx
index 0e9183d42057..7a02cd9ceb07 100644
--- a/compilerplugins/clang/test/stringloop.cxx
+++ b/compilerplugins/clang/test/stringloop.cxx
@@ -11,6 +11,9 @@
 #include "rtl/string.hxx"
 #include "rtl/ustring.hxx"
 
+#pragma clang diagnostic ignored "-Wunknown-warning-option" // for Clang < 13
+#pragma clang diagnostic ignored "-Wunused-but-set-variable"
+
 struct Foo
 {
     OUString m_field; // expected-note {{field here [loplugin:stringloop]}}
diff --git a/compilerplugins/clang/test/stringview.cxx b/compilerplugins/clang/test/stringview.cxx
index 66d35975bf13..34accb6e6448 100644
--- a/compilerplugins/clang/test/stringview.cxx
+++ b/compilerplugins/clang/test/stringview.cxx
@@ -73,6 +73,7 @@ void f3(OUString s1)
     s2 = "xxx" + s1.copy(1);
     // expected-error at +1 {{rather than copy, pass with a view using subView() [loplugin:stringview]}}
     s2 += s1.copy(1);
+    (void)s2;
 }
 void f3(OString s1)
 {
diff --git a/compilerplugins/clang/test/unoany.cxx b/compilerplugins/clang/test/unoany.cxx
index 1b4bfaa2beec..15c4b3ae2436 100644
--- a/compilerplugins/clang/test/unoany.cxx
+++ b/compilerplugins/clang/test/unoany.cxx
@@ -11,6 +11,9 @@
 
 #include "com/sun/star/uno/Any.hxx"
 
+#pragma clang diagnostic ignored "-Wunknown-warning-option" // for Clang < 13
+#pragma clang diagnostic ignored "-Wunused-but-set-variable"
+
 css::uno::Any getAny() { return css::uno::Any(true); }
 
 int main()
diff --git a/compilerplugins/clang/test/unusedenumconstants.cxx b/compilerplugins/clang/test/unusedenumconstants.cxx
index 189a037670b8..3f69e8993f04 100644
--- a/compilerplugins/clang/test/unusedenumconstants.cxx
+++ b/compilerplugins/clang/test/unusedenumconstants.cxx
@@ -114,6 +114,7 @@ void test6()
     Enum6 foo = Enum6::Modules;
     foo &= ~Enum6::Top;
     foo &= (~Enum6::Top);
+    (void)foo;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/test/unusedfields.cxx b/compilerplugins/clang/test/unusedfields.cxx
index 42b49a5df832..5305b4aec964 100644
--- a/compilerplugins/clang/test/unusedfields.cxx
+++ b/compilerplugins/clang/test/unusedfields.cxx
@@ -127,6 +127,7 @@ struct Bar
     {
         css::uno::Any any;
         any <<= m_bar10;
+        (void)any;
     }
 
     // check that we see reads of the LHS when calling operator>>=
diff --git a/compilerplugins/clang/test/unusedindex.cxx b/compilerplugins/clang/test/unusedindex.cxx
index 7b98f8645b91..4d08b5be0d26 100644
--- a/compilerplugins/clang/test/unusedindex.cxx
+++ b/compilerplugins/clang/test/unusedindex.cxx
@@ -9,6 +9,9 @@
 
 #include <vector>
 
+#pragma clang diagnostic ignored "-Wunknown-warning-option" // for Clang < 13
+#pragma clang diagnostic ignored "-Wunused-but-set-variable"
+
 void func1()
 {
     std::vector<int> v1;
diff --git a/compilerplugins/clang/test/vclwidgets.cxx b/compilerplugins/clang/test/vclwidgets.cxx
index f08faaefecd9..1ff828e280ad 100644
--- a/compilerplugins/clang/test/vclwidgets.cxx
+++ b/compilerplugins/clang/test/vclwidgets.cxx
@@ -82,6 +82,7 @@ void bar3()
 {
     Widget* p;
     p = get<Widget>();
+    (void)p;
 }
 
 void bar4() {
diff --git a/compilerplugins/clang/test/writeonlyvars.cxx b/compilerplugins/clang/test/writeonlyvars.cxx
index 4c3732867a81..0fc141f62dd2 100644
--- a/compilerplugins/clang/test/writeonlyvars.cxx
+++ b/compilerplugins/clang/test/writeonlyvars.cxx
@@ -40,6 +40,7 @@ void test()
     int* m_bar3b;
     m_bar3 = nullptr;
     m_bar3b = m_bar3 = nullptr;
+    (void)m_bar3b;
 
     // check that we see reads of field when passed to a function pointer
     // check that we see read of a field that is a function pointer
@@ -91,6 +92,7 @@ void test()
     // expected-error at +1 {{read any2 [loplugin:writeonlyvars]}}
     css::uno::Any any2;
     any2 <<= m_bar10;
+    (void)any2;
 };
 };
 


More information about the Libreoffice-commits mailing list