vcl/source/helper/strhelper.cxx |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 0a49da180c1e071360bb1b5bf664cb6264173885
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Sun May 22 12:51:35 2022 +0200
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Tue Jun 7 17:34:09 2022 +0200

    vcl: WhitespaceToSpace() spurious -Werror=maybe-uninitialized
    
    vcl/source/helper/strhelper.cxx:366:9: error: ‘pBuffer[-1]’ may be used 
uninitialized [-Werror=maybe-uninitialized]
    
    Change-Id: I37250b0790bd9c33eb01c552c8267251bc0026f0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134738
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit cd4976646dc2e5b28c3328a7fa96361e147b23b9)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134631
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/vcl/source/helper/strhelper.cxx b/vcl/source/helper/strhelper.cxx
index 782c9ce123e1..81648d9a7a43 100644
--- a/vcl/source/helper/strhelper.cxx
+++ b/vcl/source/helper/strhelper.cxx
@@ -360,9 +360,15 @@ OString WhitespaceToSpace(const OString& rLine)
 
     // there might be a space at beginning or end
     pLeap--;
+#if defined(__GNUC__) && __GNUC__ == 12
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
     if( *pLeap == ' ' )
         *pLeap = 0;
-
+#if defined(__GNUC__) && __GNUC__ == 12
+#pragma GCC diagnostic pop
+#endif
     return *pBuffer == ' ' ? pBuffer+1 : pBuffer;
 }
 

Reply via email to