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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 10 13:42:54 UTC 2020


 compilerplugins/clang/test/unusedfields.cxx  |    2 +-
 compilerplugins/clang/test/writeonlyvars.cxx |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 2a82ea5c04f76af330686cd31e68f6f0d628db74
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Jun 10 11:07:32 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Jun 10 15:42:19 2020 +0200

    Adapt to new Clang trunk -Wuninitialized-const-reference
    
    > error: 'error' diagnostics seen but not expected:
    >   File compilerplugins/clang/test/unusedfields.cxx Line 143: variable 'x' is uninitialized when passed as a const reference argument here
    
    and
    
    > error: 'error' diagnostics seen but not expected:
    >   File compilerplugins/clang/test/writeonlyvars.cxx Line 93: variable 'm_bar10' is uninitialized when passed as a const reference argument here
    
    since <https://github.com/llvm/llvm-project/commit/
    170b6869b563dd3393d99f3e03d389b9058d5f24> " [Clang] Add a new warning to warn
    when passing uninitialized variables as const reference parameters to a
    function"
    
    Change-Id: I27136e387f7a14fd24a3639187b668d6ed283070
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95994
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/compilerplugins/clang/test/unusedfields.cxx b/compilerplugins/clang/test/unusedfields.cxx
index 6b54b4f7acf1..42b49a5df832 100644
--- a/compilerplugins/clang/test/unusedfields.cxx
+++ b/compilerplugins/clang/test/unusedfields.cxx
@@ -139,7 +139,7 @@ struct Bar
     // check that we see writes of the LHS when calling operator<<=
     void bar12()
     {
-        int x;
+        int x = 0;
         m_bar12 <<= x;
     }
 };
diff --git a/compilerplugins/clang/test/writeonlyvars.cxx b/compilerplugins/clang/test/writeonlyvars.cxx
index c2f78bddda88..a596c864c3a8 100644
--- a/compilerplugins/clang/test/writeonlyvars.cxx
+++ b/compilerplugins/clang/test/writeonlyvars.cxx
@@ -86,7 +86,7 @@ void test()
 
     // check that we see don't see writes when calling operator<<=
     // expected-error at +1 {{read m_bar10 [loplugin:writeonlyvars]}}
-    sal_Int32 m_bar10;
+    sal_Int32 m_bar10 = 0;
     // expected-error at +2 {{write any2 [loplugin:writeonlyvars]}}
     // expected-error at +1 {{read any2 [loplugin:writeonlyvars]}}
     css::uno::Any any2;


More information about the Libreoffice-commits mailing list