From 5411370da57bb7f43469ac25b65c2adb05bf1ba3 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 3 Dec 2019 13:46:24 +0100 Subject: [PATCH] Adapt CPPUNIT_ASSERT to C++20 deleted ostream << for sal_Unicode (aka char16_t) "char8_t backward compatibility remediation", as implemented now by "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 --- cppu/qa/cppumaker/test_cppumaker.cxx | 1 + cppu/qa/test_any.cxx | 1 + i18npool/qa/cppunit/test_breakiterator.cxx | 1 + include/o3tl/cppunittraitshelper.hxx | 27 +++++++++++++++++++ sal/qa/rtl/oustring/rtl_OUString2.cxx | 2 ++ .../test_oustringbuffer_appendchar.cxx | 3 +++ .../strings/test_oustring_stringliterals.cxx | 1 + sal/qa/rtl/textenc/rtl_textcvt.cxx | 1 + starmath/qa/cppunit/test_node.cxx | 1 + starmath/qa/extras/mmlexport-test.cxx | 2 ++ svl/qa/unit/lockfiles/test_lockfiles.cxx | 1 + svl/qa/unit/test_lngmisc.cxx | 3 +++ sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 1 + sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 1 + sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 1 + sw/qa/extras/rtfexport/rtfexport4.cxx | 2 +- sw/qa/extras/rtfimport/rtfimport.cxx | 2 +- sw/qa/extras/uiwriter/uiwriter.cxx | 1 + vcl/qa/cppunit/mnemonic.cxx | 3 +++ 19 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 include/o3tl/cppunittraitshelper.hxx diff --git a/cppu/qa/cppumaker/test_cppumaker.cxx b/cppu/qa/cppumaker/test_cppumaker.cxx index 3ea46f5..1b8efda 100644 --- a/cppu/qa/cppumaker/test_cppumaker.cxx +++ b/cppu/qa/cppumaker/test_cppumaker.cxx @@ -360,6 +360,7 @@ #include #include #include +#include #include #include diff --git a/cppu/qa/test_any.cxx b/cppu/qa/test_any.cxx index f5fbc0c..7dfed7a 100644 --- a/cppu/qa/test_any.cxx +++ b/cppu/qa/test_any.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include #include diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index a1d4238..a41cd82 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -11,6 +11,7 @@ #include #include #include +#include #include #include diff --git a/include/o3tl/cppunittraitshelper.hxx b/include/o3tl/cppunittraitshelper.hxx new file mode 100644 index 0000000..d9f75a6 --- /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 + +#include + +#include + +// ostream << char16_t is deleted since C++20 (but just keep outputting numeric values): +template <> inline std::string CppUnit::assertion_traits::toString(char16_t const& x) +{ + return assertion_traits::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 52e8656..4a3a405 100644 --- a/sal/qa/rtl/oustring/rtl_OUString2.cxx +++ b/sal/qa/rtl/oustring/rtl_OUString2.cxx @@ -30,6 +30,8 @@ #include #include +#include + #include #include diff --git a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_appendchar.cxx b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_appendchar.cxx index f1a151f..80ce83b 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 + +#include #include #include #include diff --git a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx index 33902e2..9c7116e 100644 --- a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx +++ b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx @@ -14,6 +14,7 @@ #include +#include #include #include #include diff --git a/sal/qa/rtl/textenc/rtl_textcvt.cxx b/sal/qa/rtl/textenc/rtl_textcvt.cxx index 795950a..0bf6c56 100644 --- a/sal/qa/rtl/textenc/rtl_textcvt.cxx +++ b/sal/qa/rtl/textenc/rtl_textcvt.cxx @@ -27,6 +27,7 @@ #include #include +#include #include #include #include diff --git a/starmath/qa/cppunit/test_node.cxx b/starmath/qa/cppunit/test_node.cxx index 1bcb32a..dba0b9f 100644 --- a/starmath/qa/cppunit/test_node.cxx +++ b/starmath/qa/cppunit/test_node.cxx @@ -10,6 +10,7 @@ #include #include +#include #include #include diff --git a/starmath/qa/extras/mmlexport-test.cxx b/starmath/qa/extras/mmlexport-test.cxx index b26fcc1..737885d 100644 --- a/starmath/qa/extras/mmlexport-test.cxx +++ b/starmath/qa/extras/mmlexport-test.cxx @@ -8,6 +8,8 @@ */ #include + +#include #include #include #include diff --git a/svl/qa/unit/lockfiles/test_lockfiles.cxx b/svl/qa/unit/lockfiles/test_lockfiles.cxx index 9192034..a14a89f 100644 --- a/svl/qa/unit/lockfiles/test_lockfiles.cxx +++ b/svl/qa/unit/lockfiles/test_lockfiles.cxx @@ -13,6 +13,7 @@ #include #include +#include #include #include #include diff --git a/svl/qa/unit/test_lngmisc.cxx b/svl/qa/unit/test_lngmisc.cxx index f307111..5193eb3 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 + +#include #include #include #include diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 1fd030a..10cb429 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include class Test : public SwModelTestBase diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 2560cf8..0537b62 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -16,6 +16,7 @@ #include #include #include +#include #include #include diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 26b0b56..dddb41f 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx index 92b672c..fdfdc07 100644 --- a/sw/qa/extras/rtfexport/rtfexport4.cxx +++ b/sw/qa/extras/rtfexport/rtfexport4.cxx @@ -12,7 +12,7 @@ #include #include #include - +#include #include #include diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index a88dddf..0688b24 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -42,7 +42,7 @@ #include #include #include - +#include #include #include #include diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 52003fe..266e8ac 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -99,6 +99,7 @@ #include #include #include +#include #include #include #include diff --git a/vcl/qa/cppunit/mnemonic.cxx b/vcl/qa/cppunit/mnemonic.cxx index f2ed9e5..e870e1d 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 + +#include #include #include -- 2.24.1