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

New commits:
commit cd4976646dc2e5b28c3328a7fa96361e147b23b9
Author:     Michael Stahl <[email protected]>
AuthorDate: Sun May 22 12:51:35 2022 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Mon May 23 10:45:21 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 <[email protected]>

diff --git a/vcl/source/helper/strhelper.cxx b/vcl/source/helper/strhelper.cxx
index e44ba8530542..9d05b2c9811e 100644
--- a/vcl/source/helper/strhelper.cxx
+++ b/vcl/source/helper/strhelper.cxx
@@ -363,9 +363,15 @@ OString WhitespaceToSpace(std::string_view rLine)
     // there might be a space at beginning or end
     assert(pLeap > pBuffer);
     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