summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-05-22 12:51:35 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2022-05-23 10:45:21 +0200
commitcd4976646dc2e5b28c3328a7fa96361e147b23b9 (patch)
treed2e41f3a32f0323f338a091b6fe0820785fcb642 /vcl
parent694db7d3e7be0caf81dd52dba1a865db206ac145 (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>
Diffstat (limited to 'vcl')
-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 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;
}