summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2023-08-02 10:48:31 +0200
committerStephan Bergmann <sbergman@redhat.com>2023-08-02 13:25:47 +0200
commit1c3c27bc2e42f70e588ef5dbc769a8a346042e04 (patch)
tree97d61de2bebe59233c6e30e651ba2e366d140954 /sc/source
parent37421677cea4969ffecdeb2a58488bae22f81782 (diff)
Silence some bogus -Werror=array-bounds etc. with GCC 12 and -std=c++20
...as witnessed with patch set 1 of <https://gerrit.libreoffice.org/c/core/+/155121/1> "Bump baseline to C++20", > In file included from /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/char_traits.h:46, > from /opt/rh/gcc-toolset-12/root/usr/include/c++/12/ios:40, > from /opt/rh/gcc-toolset-12/root/usr/include/c++/12/ostream:38, > from /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/include/rtl/ustring.hxx:34, > from /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/include/svl/gridprinter.hxx:13, > from /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/svl/source/misc/gridprinter.cxx:10: > In function ‘constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...) [with _Tp = long unsigned int; _Args = {const long unsigned int&}]’, > inlined from ‘static constexpr void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = long unsigned int; _Args = {const long unsigned int&}; _Tp = long unsigned int]’ at /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/alloc_traits.h:518:21, > inlined from ‘constexpr void std::vector<_Tp, _Alloc>::_M_realloc_insert(iterator, _Args&& ...) [with _Args = {const long unsigned int&}; _Tp = long unsigned int; _Alloc = std::allocator<long unsigned int>]’ at /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/vector.tcc:462:28, > inlined from ‘constexpr void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long unsigned int; _Alloc = std::allocator<long unsigned int>]’ at /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/stl_vector.h:1287:21, > inlined from ‘mdds::mtv::soa::multi_type_vector<Traits>::iterator mdds::mtv::soa::multi_type_vector<Traits>::set_cell_to_empty_block(size_type, size_type, const T&) [with T = rtl::OUString; Traits = mdds::multi_type_matrix<svl::{anonymous}::matrix_traits>::mtv_trait]’ at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/./multi_type_vector/soa/main_def.inl:2995:50, > inlined from ‘mdds::mtv::soa::multi_type_vector<Traits>::iterator mdds::mtv::soa::multi_type_vector<Traits>::set_impl(size_type, size_type, const T&) [with T = rtl::OUString; Traits = mdds::multi_type_matrix<svl::{anonymous}::matrix_traits>::mtv_trait]’ at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/./multi_type_vector/soa/main_def.inl:1240:72, > inlined from ‘mdds::mtv::soa::multi_type_vector<Traits>::iterator mdds::mtv::soa::multi_type_vector<Traits>::set(size_type, const T&) [with T = rtl::OUString; Traits = mdds::multi_type_matrix<svl::{anonymous}::matrix_traits>::mtv_trait]’ at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/./multi_type_vector/soa/main_def.inl:696:14, > inlined from ‘void mdds::multi_type_matrix<Traits>::set(size_type, size_type, const string_type&) [with Traits = svl::{anonymous}::matrix_traits]’ at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/workdir/UnpackedTarball/mdds/include/mdds/multi_type_matrix_def.inl:356:5, > inlined from ‘void svl::GridPrinter::set(size_t, size_t, const rtl::OUString&)’ at /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_gcc_release_64/svl/source/misc/gridprinter.cxx:68:25: > /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/stl_construct.h:97:14: error: array subscript 0 is outside array bounds of ‘long unsigned int [0]’ [-Werror=array-bounds] > 97 | { return ::new((void*)__location) _Tp(std::forward<_Args>(__args)...); } > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (<https://ci.libreoffice.org/job/gerrit_linux_gcc_release/148699/>), etc. (The curly braces in sw/source/core/doc/doc.cxx had to be added to avoid an ensuing bogus > sw/source/core/doc/doc.cxx: In static member function ‘static void SwDoc::CalculatePagePairsForProspectPrinting(const SwRootFrame&, SwRenderData&, const SwPrintUIOptions&, sal_Int32)’: > sw/source/core/doc/doc.cxx:1000:5: error: ‘else’ without a previous ‘if’ > 1000 | else > | ^~~~ ) Change-Id: I902f6d74d897b9bf281dc9c821aff30e7e72582a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155215 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/tool/scmatrix.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 3fdbf3438a47..f62990b76b18 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -582,7 +582,14 @@ void ScMatrixImpl::PutEmptyPath(SCSIZE nC, SCSIZE nR)
if (ValidColRow( nC, nR))
{
maMat.set_empty(nR, nC);
+#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 12 && __cplusplus == 202002L
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
maMatFlag.set(nR, nC, SC_MATFLAG_EMPTYPATH);
+#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 12 && __cplusplus == 202002L
+#pragma GCC diagnostic pop
+#endif
}
else
{