From c2339a0d1bc5944c7b408371536848ac14c4b41a Mon Sep 17 00:00:00 2001 From: Herman Lee Date: Tue, 25 Apr 2023 09:11:32 -0700 Subject: [PATCH] [mysql-5.6][PR] Bug #34638573 Compile MySQL with clang 15 Summary: Fixing two compile errors, that are triggered when using libcxx from LLVM15 https://reviews.llvm.org/D104002 std::unary_function is not available in libcxx under C++17, see: https://en.cppreference.com/w/cpp/utility/functional/unary_function Boost uses std::unary_function, but it has a workaround for using Boost headers in C++17, triggered by the macro BOOST_NO_CXX98_FUNCTION_BASE See: https://www.boost.org/doc/libs/master/libs/config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_features_that_have_been_removed_from_the_standard_ https://reviews.llvm.org/D130538 A new assert in libcxx is triggered in include/varlen_sort.h std::iterator_traits::reference should match the return type of varlen_iterator::operator*() include/c++/v1/__algorithm/iterator_operations.h:100:5: error: static assertion failed due to requirement 'is_same::value': It looks like your iterator's `iterator_traits::reference` does not match the return type of dereferencing the iterator, i.e., calling `*it`. This is undefined behavior according to [input.iterators] and can lead to dangling reference issues at runtime, so we are flagging this. static_assert(is_same<__deref_t<_Iter>, typename iterator_traits<__remove_cvref_t<_Iter> >::reference>::value, ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fix a few warnings: Remove some explicitly defined "=defau.t" constructors, destructors. warning: definition of implicit copy assignment operator for 'Row' is deprecated because it has a user-declared destructor [-Wdeprecated-copy-with-dtor] Mark a variable potentially unuses in tests (unuses when __aarch64__) Porting Notes: Drop when rebasing to 8.0.32 Change-Id: Iad346bd0cdb1d25d958377b9c7a0dd5da7a45fad Pull Request resolved: https://github.com/facebook/mysql-5.6/pull/1293 GitHub Author: Gabor Buella Test Plan: Imported from GitHub, without a `Test Plan:` line. Reviewers: chni Reviewed By: chni Subscribers: webscalesql-eng@fb.com Differential Revision: https://phabricator.intern.facebook.com/D45277622 Tags: aarch64, accept2ship --- cmake/boost.cmake | 3 +++ include/varlen_sort.h | 5 +++-- storage/innobase/include/ddl0impl.h | 11 ++--------- unittest/gunit/mysys_my_rdtsc-t.cc | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/cmake/boost.cmake b/cmake/boost.cmake index 40c4d948c3af..9cd259c38bce 100644 --- a/cmake/boost.cmake +++ b/cmake/boost.cmake @@ -329,6 +329,9 @@ ELSE() ENDIF() IF(NOT WIN32) +# Needed to use Boost header container_hash/hash.hpp in C++17 + ADD_DEFINITIONS(-DBOOST_NO_CXX98_FUNCTION_BASE) + FILE(GLOB_RECURSE BOOST_PATCHES_LIST RELATIVE ${BOOST_PATCHES_DIR} ${BOOST_PATCHES_DIR}/*.hpp diff --git a/include/varlen_sort.h b/include/varlen_sort.h index 80f97ada86f7..e45d4f0bbd45 100644 --- a/include/varlen_sort.h +++ b/include/varlen_sort.h @@ -184,8 +184,9 @@ namespace std { // Required for Iterator. template <> -struct iterator_traits : iterator_traits {}; - +struct iterator_traits : iterator_traits { + using reference = varlen_element; +}; } // namespace std /* diff --git a/storage/innobase/include/ddl0impl.h b/storage/innobase/include/ddl0impl.h index 75028c81e021..cf0d1bd807d4 100644 --- a/storage/innobase/include/ddl0impl.h +++ b/storage/innobase/include/ddl0impl.h @@ -118,15 +118,8 @@ struct Fetch_sequence : public Context::FTS::Sequence { /** Physical row context. */ struct Row { - /** Constructor. */ - Row() = default; - - Row(const Row &) = default; - - /** Destructor. */ - ~Row() = default; - - /** Build a row from a raw record. + /** Build a row for the given index using the available clustered index + record (member m_rec). @param[in,out] ctx DDL context. @param[in,out] index Index the record belongs to. @param[in,out] heap Heap to use for allocation. diff --git a/unittest/gunit/mysys_my_rdtsc-t.cc b/unittest/gunit/mysys_my_rdtsc-t.cc index 81462b09783d..221c508b701d 100644 --- a/unittest/gunit/mysys_my_rdtsc-t.cc +++ b/unittest/gunit/mysys_my_rdtsc-t.cc @@ -113,7 +113,7 @@ TEST_F(RDTimeStampCounter, TestCycle) { ulonglong t1 = my_timer_cycles(); ulonglong t2; int i; - int backward = 0; + int backward [[maybe_unused]] = 0; int nonzero = 0; for (i = 0; i < LOOP_COUNT; i++) {