summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-01-26 12:02:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-01-26 13:08:25 +0100
commit6661ea398523aaadb252abce0eac8a1f4f701ce7 (patch)
treeadf004fdca4f4faa070a7c4bfbb4a49b320e4609 /sw
parent4935bb372e3618eca105997c83101aa2b3d422e3 (diff)
suppress spurious gcc 10 warning
/home/noel/libo3/sw/source/core/txtnode/modeltoviewhelper.cxx: In constructor ‘ModelToViewHelper::ModelToViewHelper(const SwTextNode&, const SwRootFrame*, ExpandMode)’: /home/noel/libo3/sw/source/core/txtnode/modeltoviewhelper.cxx:182:44: error: ‘*(int*)((char*)&oStartHidden + offsetof(std::optional<int>,std::optional<int>::<unnamed>.std::_Optional_base<int, true, true>::<unnamed>))’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 182 | aHiddenMulti.Select({*oStartHidden, i}, true); | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ Change-Id: I88480daee070c77463b33dd1387865cc4ebf01cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128976 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/txtnode/modeltoviewhelper.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/sw/source/core/txtnode/modeltoviewhelper.cxx b/sw/source/core/txtnode/modeltoviewhelper.cxx
index 846e4d1a51b1..2572cf7d1a74 100644
--- a/sw/source/core/txtnode/modeltoviewhelper.cxx
+++ b/sw/source/core/txtnode/modeltoviewhelper.cxx
@@ -178,9 +178,17 @@ ModelToViewHelper::ModelToViewHelper(const SwTextNode &rNode,
if (::std::all_of(startedFields.begin(), startedFields.end(),
[](auto const& it) { return it.second; }))
{
+// prevent -Werror=maybe-uninitialized under gcc 11.2.0
+#if defined __GNUC__ && !defined __clang_ && __GNUC__ == 11
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
// i is still hidden but the Range end is oddly "-1"
aHiddenMulti.Select({*oStartHidden, i}, true);
oStartHidden.reset();
+#if defined __GNUC__ && !defined __clang_ && __GNUC__ == 11
+#pragma GCC diagnostic pop
+#endif
}
break;
}