external/mysql-connector-cpp/Library_mysqlcppconn.mk | 2 + include/rtl/stringutils.hxx | 21 ++++++++++++++++--- sal/osl/unx/nlsupport.cxx | 1 sal/qa/rtl/strings/test_oustring_stringliterals.cxx | 3 ++ 4 files changed, 24 insertions(+), 3 deletions(-)
New commits: commit fd71427f6502f4540053c10d8eb9b495451d959d Author: Stephan Bergmann <[email protected]> AuthorDate: Mon Aug 20 21:41:26 2018 +0200 Commit: Stephan Bergmann <[email protected]> CommitDate: Tue Aug 21 07:36:00 2018 +0200 external/mysql-connector-cpp uses std::auto_ptr, must not be compiled as C++17 But gb_CXX03FLAGS may contain -Werror=c++11-extensions and would thus fail with > [CXX] workdir/UnpackedTarball/mysql-connector-cpp/driver/mysql_connection.cpp > In file included from workdir/UnpackedTarball/mysql-connector-cpp/driver/mysql_connection.cpp:44: > In file included from workdir/UnpackedTarball/mysql-connector-cpp/driver/mysql_util.h:30: > In file included from workdir/UnpackedTarball/mysql-connector-cpp/driver/nativeapi/mysql_private_iface.h:63: > workdir/UnpackedTarball/mariadb-connector-c/include/mysql.h:223:45: error: commas at the end of enumerator lists are a C++11 extension [-Werror,-Wc++11-extensions] > MYSQL_STATUS_QUIT_SENT, /* object is "destroyed" at this stage */ > ^ (And otherwise the code appears to build fine with gb_CXX03FLAGS, so just stick with that instead of coming up with yet another way of compiling as >= C++11 and < C++17.) Change-Id: I924d906e34c073672f2038072743197d3f7fef5f Reviewed-on: https://gerrit.libreoffice.org/59368 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> diff --git a/external/mysql-connector-cpp/Library_mysqlcppconn.mk b/external/mysql-connector-cpp/Library_mysqlcppconn.mk index 152aee8c0764..8efe63be8b05 100644 --- a/external/mysql-connector-cpp/Library_mysqlcppconn.mk +++ b/external/mysql-connector-cpp/Library_mysqlcppconn.mk @@ -32,6 +32,8 @@ $(eval $(call gb_Library_use_externals,mysqlcppconn,\ endif endif +$(eval $(call gb_Library_add_cxxflags,mysqlcppconn,$(filter-out -Werror=%,$(gb_CXX03FLAGS)))) + $(eval $(call gb_Library_set_external_code,mysqlcppconn)) $(eval $(call gb_Library_set_warnings_not_errors,mysqlcppconn)) commit f0fcbcadac148a5bfd36b2a26795d45aef8eace4 Author: Stephan Bergmann <[email protected]> AuthorDate: Mon Aug 20 20:20:22 2018 +0200 Commit: Stephan Bergmann <[email protected]> CommitDate: Tue Aug 21 07:35:50 2018 +0200 Make OUStringLiteral ctor actually constexpr ...which had accidentally been broken with 87707670c993794ab12b0fad0f048f11429269c2 "Make OUStringLiteral more useful". (std::strlen unfortunately isn't constexpr, so need to use an explicit loop instead.) Change-Id: I9a820e2940b99a0c37124477810ef879d82c8325 Reviewed-on: https://gerrit.libreoffice.org/59344 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> diff --git a/include/rtl/stringutils.hxx b/include/rtl/stringutils.hxx index c6a5fcb64917..53f7554ee132 100644 --- a/include/rtl/stringutils.hxx +++ b/include/rtl/stringutils.hxx @@ -13,10 +13,13 @@ #include "sal/config.h" #include <cstddef> -#include <cstring> #include "sal/types.h" +#if defined LIBO_INTERNAL_ONLY +#include "config_global.h" +#endif + // The unittest uses slightly different code to help check that the proper // calls are made. The class is put into a different namespace to make // sure the compiler generates a different (if generating also non-inline) @@ -165,8 +168,20 @@ struct ConstCharArrayDetector< const char[ N ], T > typedef T Type; static const std::size_t length = N - 1; static const bool ok = true; - static bool isValid(char const (& literal)[N]) - { return std::strlen(literal) == length; } +#if defined LIBO_INTERNAL_ONLY && HAVE_CXX14_CONSTEXPR + constexpr +#endif + static bool isValid(char const (& literal)[N]) { + for (std::size_t i = 0; i != N - 1; ++i) { + if (literal[i] == '\0') { + return false; + } + } + return literal[N - 1] == '\0'; + } +#if defined LIBO_INTERNAL_ONLY + constexpr +#endif static char const * toPointer(char const (& literal)[N]) { return literal; } }; #if defined LIBO_INTERNAL_ONLY diff --git a/sal/osl/unx/nlsupport.cxx b/sal/osl/unx/nlsupport.cxx index e1d7e393822c..c9377040894a 100644 --- a/sal/osl/unx/nlsupport.cxx +++ b/sal/osl/unx/nlsupport.cxx @@ -20,6 +20,7 @@ #include <sal/config.h> #include <algorithm> +#include <cstring> #include <osl/nlsupport.h> #include <osl/diagnose.h> diff --git a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx index 58a938ae9328..687f6b3e5146 100644 --- a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx +++ b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx @@ -41,6 +41,9 @@ private: void testcall( const char str[] ); + // Check that OUStringLiteral ctor is actually constexpr: + static constexpr rtlunittest::OUStringLiteral dummy{"dummy"}; + CPPUNIT_TEST_SUITE(StringLiterals); CPPUNIT_TEST(checkCtors); CPPUNIT_TEST(checkUsage); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
