[Libreoffice-commits] core.git: chart2/qa external/cppunit io/qa test/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Feb 1 18:04:02 UTC 2019


 chart2/qa/extras/charttest.hxx                                  |    1 
 external/cppunit/0001-Unconditionally-use-C-11-noreturn.patch.1 |   57 ++++++++++
 external/cppunit/UnpackedTarball_cppunit.mk                     |    3 
 io/qa/textinputstream.cxx                                       |    2 
 test/source/xmltesttools.cxx                                    |    3 
 5 files changed, 61 insertions(+), 5 deletions(-)

New commits:
commit 07d04fd3ae72dc1c9998f83a4131407ecc39cda9
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Feb 1 14:17:42 2019 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Feb 1 19:03:36 2019 +0100

    Better fix for missing [[noreturn]] of CPPUNIT_FAIL
    
    This includes a revert of commit 9808486a89c6368f836579f8d8c0dda63fd0063c "Avoid
    -Werror,-Wimplicit-fallthrough with clang-cl", and also undoes older MSVC
    workarounds (that would start to cause "warning C4702: unreachable code" now).
    
    Change-Id: If72bf336e12e0a2db589857e8875003dae861977
    Reviewed-on: https://gerrit.libreoffice.org/67248
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx
index a2b8efd2c427..84d74de2c117 100644
--- a/chart2/qa/extras/charttest.hxx
+++ b/chart2/qa/extras/charttest.hxx
@@ -340,7 +340,6 @@ Reference< chart2::data::XDataSequence > getLabelDataSequenceFromDoc(
     }
 
     CPPUNIT_FAIL("no Label sequence found");
-    return Reference< chart2::data::XDataSequence > ();
 }
 
 Reference< chart2::data::XDataSequence > getDataSequenceFromDocByRole(
diff --git a/external/cppunit/0001-Unconditionally-use-C-11-noreturn.patch.1 b/external/cppunit/0001-Unconditionally-use-C-11-noreturn.patch.1
new file mode 100644
index 000000000000..70ede229a3e6
--- /dev/null
+++ b/external/cppunit/0001-Unconditionally-use-C-11-noreturn.patch.1
@@ -0,0 +1,57 @@
+From c955b1041b9e3ebe7ee8a620340b78bddc820682 Mon Sep 17 00:00:00 2001
+From: Stephan Bergmann <sbergman at redhat.com>
+Date: Fri, 1 Feb 2019 13:37:59 +0100
+Subject: [PATCH] Unconditionally use C++11 [[noreturn]]
+
+This helps avoid issues like <https://gerrit.libreoffice.org/plugins/gitiles/
+core/+/9808486a89c6368f836579f8d8c0dda63fd0063c%5E%21> "Avoid
+-Werror,-Wimplicit-fallthrough with clang-cl ...where CPPUNIT_FAIL is marked as
+noreturn only for __GNUC__".
+
+Change-Id: Idb33af7375f103f2dd7a7b4c3dbf20ce731b17ad
+---
+ include/cppunit/Asserter.h | 12 +++---------
+ 1 file changed, 3 insertions(+), 9 deletions(-)
+
+diff --git a/include/cppunit/Asserter.h b/include/cppunit/Asserter.h
+index 3321b87..dd39ead 100644
+--- a/include/cppunit/Asserter.h
++++ b/include/cppunit/Asserter.h
+@@ -43,23 +43,17 @@ class Message;
+  * \endcode
+  */
+ 
+-#if defined __GNUC__
+-#   define NORETURN __attribute__((noreturn))
+-#else
+-#   define NORETURN
+-#endif
+-
+ struct Asserter
+ {
+   /*! \brief Throws a Exception with the specified message and location.
+    */
+-  NORETURN static void CPPUNIT_API fail( const Message &message, 
++  [[noreturn]] static void CPPUNIT_API fail( const Message &message, 
+                                 const SourceLine &sourceLine = SourceLine() );
+ 
+   /*! \brief Throws a Exception with the specified message and location.
+    * \deprecated Use fail( Message, SourceLine ) instead.
+    */
+-  NORETURN static void CPPUNIT_API fail( std::string message, 
++  [[noreturn]] static void CPPUNIT_API fail( std::string message, 
+                                 const SourceLine &sourceLine = SourceLine() );
+ 
+   /*! \brief Throws a Exception with the specified message and location.
+@@ -165,7 +159,7 @@ struct Asserter
+    *                          what are the differences between the expected and actual value.
+    * \param shortDescription Short description for the failure message.
+    */
+-  NORETURN static void CPPUNIT_API failNotEqual( std::string expected, 
++  [[noreturn]] static void CPPUNIT_API failNotEqual( std::string expected, 
+                                         std::string actual, 
+                                         const SourceLine &sourceLine,
+                                         const AdditionalMessage &additionalMessage = AdditionalMessage(),
+-- 
+2.20.1
+
diff --git a/external/cppunit/UnpackedTarball_cppunit.mk b/external/cppunit/UnpackedTarball_cppunit.mk
index 053a6020cd4f..649ba8fc4063 100644
--- a/external/cppunit/UnpackedTarball_cppunit.mk
+++ b/external/cppunit/UnpackedTarball_cppunit.mk
@@ -15,6 +15,8 @@ $(eval $(call gb_UnpackedTarball_update_autoconf_configs,cppunit))
 
 # gcc9.patch.0 addressed upstream with <https://gerrit.libreoffice.org/58690> "Avoid GCC 9
 #  -Wdeprecated-copy":
+# 0001-Unconditionally-use-C-11-noreturn.patch.1 upstream at <https://gerrit.libreoffice.org/67247>
+#  "Unconditionally use C++11 [[noreturn]]"
 $(eval $(call gb_UnpackedTarball_add_patches,cppunit,\
 	external/cppunit/windows.patch \
 	external/cppunit/unix.patch \
@@ -22,6 +24,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,cppunit,\
 	external/cppunit/enable-win32-debug.patch \
 	external/cppunit/rtti.patch.0 \
 	external/cppunit/gcc9.patch.0 \
+	external/cppunit/0001-Unconditionally-use-C-11-noreturn.patch.1 \
 ))
 ifeq ($(DISABLE_DYNLOADING),TRUE)
 $(eval $(call gb_UnpackedTarball_add_patches,cppunit,\
diff --git a/io/qa/textinputstream.cxx b/io/qa/textinputstream.cxx
index 75371a0d3863..6e67f5e986ed 100644
--- a/io/qa/textinputstream.cxx
+++ b/io/qa/textinputstream.cxx
@@ -43,7 +43,7 @@ private:
 
     sal_Int32 SAL_CALL readBytes(css::uno::Sequence<sal_Int8> &, sal_Int32)
         override
-    { CPPUNIT_FAIL("readLine is supposed to call readSomeBytes instead"); return 0;}
+    { CPPUNIT_FAIL("readLine is supposed to call readSomeBytes instead"); }
 
     sal_Int32 SAL_CALL readSomeBytes(
         css::uno::Sequence<sal_Int8 > & aData, sal_Int32 nMaxBytesToRead) override
diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx
index b104599f4b9d..7fd6a4ee9e0d 100644
--- a/test/source/xmltesttools.cxx
+++ b/test/source/xmltesttools.cxx
@@ -11,7 +11,6 @@
 
 #include <memory>
 
-#include <o3tl/unreachable.hxx>
 #include <vcl/mtfxmldump.hxx>
 
 namespace {
@@ -97,7 +96,6 @@ OUString XmlTestTools::getXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath)
     {
         case XPATH_UNDEFINED:
             CPPUNIT_FAIL("Undefined XPath type");
-            O3TL_UNREACHABLE;
         case XPATH_NODESET:
         {
             xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
@@ -132,7 +130,6 @@ OUString XmlTestTools::getXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath)
     }
 
     CPPUNIT_FAIL("Invalid XPath type");
-    return OUString(); // to suppress "Not all control paths return a value" warning on MSVC
 }
 
 void XmlTestTools::assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rAttribute, const OUString& rExpectedValue)


More information about the Libreoffice-commits mailing list