summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-05-22 12:51:35 +0200
committerAndras Timar <andras.timar@collabora.com>2022-06-24 13:26:34 +0200
commitf19b356bf436dcf33aae415a6b42161e77af56f2 (patch)
treee7d1828b348445ff1d53283eb98a969c8a053fdb /vcl/source
parentc643d9913b84bcef13cc4174ada2241b73a54b1f (diff)
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.stahl@allotropia.de> (cherry picked from commit cd4976646dc2e5b28c3328a7fa96361e147b23b9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134631 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/helper/strhelper.cxx8
1 files changed, 7 insertions, 1 deletions
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;
}