aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-12-03 13:46:24 +0100
committerThorsten Behrens <thorsten.behrens@allotropia.de>2021-04-20 23:40:52 +0200
commit3b9646b509fd02a37c53e77f84e37105e233440b (patch)
treee51abc863805ecc358e14e3514967540dadef124
parent690d078f2b91d769f31e048b8a1d523af18e6d11 (diff)
Adapt CPPUNIT_ASSERT to C++20 deleted ostream << for sal_Unicode (aka char16_t)
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1423r3.html> "char8_t backward compatibility remediation", as implemented now by <https://gcc.gnu.org/ git/?p=gcc.git;a=commit;h=0c5b35933e5b150df0ab487efb2f11ef5685f713> "libstdc++: P1423R3 char8_t remediation (2/4)" for -std=c++2a, deletes operator << overloads that would print an integer rather than a (presumably expected) character. But for simplicity (and to avoid issues with non-printing characters), keep printing an integer here. Change-Id: I751b99ee32d418eb488131ffa130d6f7d6d38dc7 Reviewed-on: https://gerrit.libreoffice.org/84348 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> (cherry picked from commit 5d8f0fad50f90195a11873c70ddab4644f5839ea) Conflicts: cppu/qa/test_any.cxx svl/qa/unit/lockfiles/test_lockfiles.cxx sw/qa/extras/ooxmlimport/ooxmlimport.cxx sw/qa/extras/rtfexport/rtfexport4.cxx sw/qa/extras/uiwriter/uiwriter.cxx
-rw-r--r--cppu/qa/cppumaker/test_cppumaker.cxx1
-rw-r--r--cppu/qa/test_any.cxx1
-rw-r--r--i18npool/qa/cppunit/test_breakiterator.cxx1
-rw-r--r--include/o3tl/cppunittraitshelper.hxx27
-rw-r--r--sal/qa/rtl/oustring/rtl_OUString2.cxx2
-rw-r--r--sal/qa/rtl/oustringbuffer/test_oustringbuffer_appendchar.cxx3
-rw-r--r--sal/qa/rtl/strings/test_oustring_stringliterals.cxx1
-rw-r--r--sal/qa/rtl/textenc/rtl_textcvt.cxx1
-rw-r--r--starmath/qa/cppunit/test_node.cxx1
-rw-r--r--starmath/qa/extras/mmlexport-test.cxx2
-rw-r--r--svl/qa/unit/test_lngmisc.cxx3
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx1
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport5.cxx1
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx1
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx2
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx2
-rw-r--r--vcl/qa/cppunit/mnemonic.cxx3
17 files changed, 52 insertions, 1 deletions
diff --git a/cppu/qa/cppumaker/test_cppumaker.cxx b/cppu/qa/cppumaker/test_cppumaker.cxx
index e73a502333f8..0ac7f854fe76 100644
--- a/cppu/qa/cppumaker/test_cppumaker.cxx
+++ b/cppu/qa/cppumaker/test_cppumaker.cxx
@@ -360,6 +360,7 @@
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/plugin/TestPlugIn.h>
+#include <o3tl/cppunittraitshelper.hxx>
#include <rtl/ustring.hxx>
#include <cstddef>
diff --git a/cppu/qa/test_any.cxx b/cppu/qa/test_any.cxx
index 7787176ffd3b..ea4013b2e2bc 100644
--- a/cppu/qa/test_any.cxx
+++ b/cppu/qa/test_any.cxx
@@ -50,6 +50,7 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/uno/Type.hxx>
#include <com/sun/star/uno/XInterface.hpp>
+#include <o3tl/cppunittraitshelper.hxx>
#include <osl/interlck.h>
#include <rtl/string.h>
#include <rtl/ustring.h>
diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx
index 0c132acf3a43..71858daa617e 100644
--- a/i18npool/qa/cppunit/test_breakiterator.cxx
+++ b/i18npool/qa/cppunit/test_breakiterator.cxx
@@ -13,6 +13,7 @@
#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
#include <com/sun/star/i18n/ScriptType.hpp>
#include <com/sun/star/i18n/WordType.hpp>
+#include <o3tl/cppunittraitshelper.hxx>
#include <unotest/bootstrapfixturebase.hxx>
#include <unicode/uversion.h>
diff --git a/include/o3tl/cppunittraitshelper.hxx b/include/o3tl/cppunittraitshelper.hxx
new file mode 100644
index 000000000000..d9f75a61b4c8
--- /dev/null
+++ b/include/o3tl/cppunittraitshelper.hxx
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_O3TL_CPPUNITTRAITSHELPER_HXX
+#define INCLUDED_O3TL_CPPUNITTRAITSHELPER_HXX
+
+#include <sal/config.h>
+
+#include <string>
+
+#include <cppunit/TestAssert.h>
+
+// ostream << char16_t is deleted since C++20 (but just keep outputting numeric values):
+template <> inline std::string CppUnit::assertion_traits<char16_t>::toString(char16_t const& x)
+{
+ return assertion_traits<unsigned>::toString(unsigned(x));
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/sal/qa/rtl/oustring/rtl_OUString2.cxx b/sal/qa/rtl/oustring/rtl_OUString2.cxx
index b932e371be3d..20fe5e02991c 100644
--- a/sal/qa/rtl/oustring/rtl_OUString2.cxx
+++ b/sal/qa/rtl/oustring/rtl_OUString2.cxx
@@ -30,6 +30,8 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/plugin/TestPlugIn.h>
+#include <o3tl/cppunittraitshelper.hxx>
+
#include <stringhelper.hxx>
#include <valueequal.hxx>
diff --git a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_appendchar.cxx b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_appendchar.cxx
index f1a151fdc836..80ce83b1d2d0 100644
--- a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_appendchar.cxx
+++ b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_appendchar.cxx
@@ -7,6 +7,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <sal/config.h>
+
+#include <o3tl/cppunittraitshelper.hxx>
#include <sal/types.h>
#include <cppunit/TestFixture.h>
#include <cppunit/TestAssert.h>
diff --git a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
index a98401351a7f..c09dfe99451b 100644
--- a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
+++ b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
@@ -14,6 +14,7 @@
#include <utility>
+#include <o3tl/cppunittraitshelper.hxx>
#include <sal/types.h>
#include <config_global.h>
#include <cppunit/TestFixture.h>
diff --git a/sal/qa/rtl/textenc/rtl_textcvt.cxx b/sal/qa/rtl/textenc/rtl_textcvt.cxx
index 339075decba3..3c8539640522 100644
--- a/sal/qa/rtl/textenc/rtl_textcvt.cxx
+++ b/sal/qa/rtl/textenc/rtl_textcvt.cxx
@@ -27,6 +27,7 @@
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
+#include <o3tl/cppunittraitshelper.hxx>
#include <rtl/string.hxx>
#include <rtl/ustring.hxx>
#include <rtl/tencinfo.h>
diff --git a/starmath/qa/cppunit/test_node.cxx b/starmath/qa/cppunit/test_node.cxx
index cb24bbdff78b..19cb5167cc2f 100644
--- a/starmath/qa/cppunit/test_node.cxx
+++ b/starmath/qa/cppunit/test_node.cxx
@@ -10,6 +10,7 @@
#include <sal/config.h>
#include <test/bootstrapfixture.hxx>
+#include <o3tl/cppunittraitshelper.hxx>
#include <sfx2/sfxmodelfactory.hxx>
#include <document.hxx>
diff --git a/starmath/qa/extras/mmlexport-test.cxx b/starmath/qa/extras/mmlexport-test.cxx
index 8fdaa566a778..cbcc1d040c26 100644
--- a/starmath/qa/extras/mmlexport-test.cxx
+++ b/starmath/qa/extras/mmlexport-test.cxx
@@ -8,6 +8,8 @@
*/
#include <sal/config.h>
+
+#include <o3tl/cppunittraitshelper.hxx>
#include <test/bootstrapfixture.hxx>
#include <test/xmltesttools.hxx>
#include <unotools/tempfile.hxx>
diff --git a/svl/qa/unit/test_lngmisc.cxx b/svl/qa/unit/test_lngmisc.cxx
index b4ba30c6c63b..e8daf852ddf2 100644
--- a/svl/qa/unit/test_lngmisc.cxx
+++ b/svl/qa/unit/test_lngmisc.cxx
@@ -7,6 +7,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <sal/config.h>
+
+#include <o3tl/cppunittraitshelper.hxx>
#include <sal/types.h>
#include <cppunit/TestAssert.h>
#include <cppunit/TestFixture.h>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 3c84ed37e97e..ebc8da1bb79c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -19,6 +19,7 @@
#include <com/sun/star/text/XTextRangeCompare.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
#include <com/sun/star/text/TableColumnSeparator.hpp>
+#include <o3tl/cppunittraitshelper.hxx>
#include <oox/drawingml/drawingmltypes.hxx>
#include <config_features.h>
#include <string>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 64b9adc07ff9..09bc82a493ce 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -48,6 +48,7 @@
#include <com/sun/star/drawing/Hatch.hpp>
#include <com/sun/star/rdf/URI.hpp>
#include <com/sun/star/rdf/Statement.hpp>
+#include <o3tl/cppunittraitshelper.hxx>
#include <string>
#include <config_features.h>
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index e05d7490519a..20d769bf77e3 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -53,6 +53,7 @@
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/document/XImporter.hpp>
#include <vcl/bitmapaccess.hxx>
+#include <o3tl/cppunittraitshelper.hxx>
#include <unotools/fltrcfg.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <com/sun/star/text/GraphicCrop.hpp>
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 263b9aef0e5d..df71b2359cea 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -39,7 +39,7 @@
#include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/text/VertOrientation.hpp>
#include <com/sun/star/text/XFormField.hpp>
-
+#include <o3tl/cppunittraitshelper.hxx>
#include <rtl/ustring.hxx>
#include <vcl/settings.hxx>
#include <comphelper/sequenceashashmap.hxx>
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index e16e78beba22..b007d50ff4a1 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -91,6 +91,8 @@
#include <com/sun/star/chart2/data/XDataSource.hpp>
#include <com/sun/star/document/XEmbeddedObjectSupplier2.hpp>
#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/linguistic2/XLinguProperties.hpp>
+#include <o3tl/cppunittraitshelper.hxx>
#include <o3tl/deleter.hxx>
#include <o3tl/make_unique.hxx>
#include <osl/file.hxx>
diff --git a/vcl/qa/cppunit/mnemonic.cxx b/vcl/qa/cppunit/mnemonic.cxx
index 0109c1cd0279..b846d72334dd 100644
--- a/vcl/qa/cppunit/mnemonic.cxx
+++ b/vcl/qa/cppunit/mnemonic.cxx
@@ -7,6 +7,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <sal/config.h>
+
+#include <o3tl/cppunittraitshelper.hxx>
#include <test/bootstrapfixture.hxx>
#include <cppunit/TestAssert.h>
#include <cppunit/TestFixture.h>