View | Details | Raw Unified | Return to bug 269442
Collapse All | Expand All

(-)b/databases/mysql80-server/files/patch-llvm15-fix (+103 lines)
Added Link Here
1
From 69fb953b55474f32d0e1e35b043599c34e516349 Mon Sep 17 00:00:00 2001
2
From: Gabor Buella <gabor.buella@oracle.com>
3
Date: Sat, 12 Nov 2022 01:05:54 +0100
4
Subject: [PATCH] Bug #34638573 Compile MySQL with clang 15
5
6
Fixing two compile errors, that are triggered when using libcxx from LLVM15
7
8
https://reviews.llvm.org/D104002
9
10
std::unary_function is not available in libcxx under C++17, see:
11
https://en.cppreference.com/w/cpp/utility/functional/unary_function
12
Boost uses std::unary_function, but it has a workaround for using
13
Boost headers in C++17, triggered by the macro BOOST_NO_CXX98_FUNCTION_BASE
14
15
See:
16
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_
17
18
https://reviews.llvm.org/D130538
19
20
A new assert in libcxx is triggered in include/varlen_sort.h
21
22
std::iterator_traits<varlen_iterator>::reference should match the return type of varlen_iterator::operator*()
23
24
include/c++/v1/__algorithm/iterator_operations.h:100:5: error: static assertion failed due to requirement 'is_same<varlen_element, varlen_element &>::value': It looks like your iterator's `iterator_traits<It>::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.
25
static_assert(is_same<__deref_t<_Iter>, typename iterator_traits<__remove_cvref_t<_Iter> >::reference>::value,
26
^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27
28
Fix a few warnings:
29
Remove some explicitly defined "=defau.t" constructors, destructors.
30
warning: definition of implicit copy assignment operator for 'Row' is deprecated because it has a user-declared destructor [-Wdeprecated-copy-with-dtor]
31
32
Mark a variable potentially unuses in tests (unuses when __aarch64__)
33
34
Change-Id: Iad346bd0cdb1d25d958377b9c7a0dd5da7a45fad
35
---
36
 cmake/boost.cmake                   | 3 +++
37
 include/varlen_sort.h               | 5 +++--
38
 storage/innobase/include/ddl0impl.h | 8 --------
39
 unittest/gunit/innodb/ut0new-t.cc   | 2 --
40
 unittest/gunit/mysys_my_rdtsc-t.cc  | 2 +-
41
 5 files changed, 7 insertions(+), 13 deletions(-)
42
43
diff --git a/cmake/boost.cmake b/cmake/boost.cmake
44
index 64e5cd6a1950..e879484a9d9e 100644
45
--- cmake/boost.cmake
46
+++ cmake/boost.cmake
47
@@ -330,6 +330,9 @@ ELSE()
48
 ENDIF()
49
 
50
 IF(NOT WIN32)
51
+# Needed to use Boost header container_hash/hash.hpp in C++17
52
+  ADD_DEFINITIONS(-DBOOST_NO_CXX98_FUNCTION_BASE)
53
+
54
   FILE(GLOB_RECURSE BOOST_PATCHES_LIST
55
     RELATIVE ${BOOST_PATCHES_DIR}
56
     ${BOOST_PATCHES_DIR}/*.hpp
57
diff --git a/include/varlen_sort.h b/include/varlen_sort.h
58
index 433ab7e493b0..380274e418cf 100644
59
--- include/varlen_sort.h
60
+++ include/varlen_sort.h
61
@@ -184,8 +184,9 @@ namespace std {
62
 
63
 // Required for Iterator.
64
 template <>
65
-struct iterator_traits<varlen_iterator> : iterator_traits<varlen_element *> {};
66
-
67
+struct iterator_traits<varlen_iterator> : iterator_traits<varlen_element *> {
68
+  using reference = varlen_element;
69
+};
70
 }  // namespace std
71
 
72
 /*
73
diff --git a/storage/innobase/include/ddl0impl.h b/storage/innobase/include/ddl0impl.h
74
index 2276c8d2f40d..0e5d8e428997 100644
75
--- storage/innobase/include/ddl0impl.h
76
+++ storage/innobase/include/ddl0impl.h
77
@@ -119,13 +119,5 @@ struct Fetch_sequence : public Context::FTS::Sequence {
78
 /** Physical row context. */
79
 struct Row {
80
-  /** Constructor. */
81
-  Row() = default;
82
-
83
-  Row(const Row &) = default;
84
-
85
-  /** Destructor. */
86
-  ~Row() = default;
87
-
88
   /** Build a row from a raw record.
89
   @param[in,out] ctx            DDL context.
90
   @param[in,out] index          Index the record belongs to.
91
diff --git a/unittest/gunit/mysys_my_rdtsc-t.cc b/unittest/gunit/mysys_my_rdtsc-t.cc
92
index 6bec618475fe..e8d2fe1662b6 100644
93
--- unittest/gunit/mysys_my_rdtsc-t.cc
94
+++ unittest/gunit/mysys_my_rdtsc-t.cc
95
@@ -113,7 +113,7 @@ TEST_F(RDTimeStampCounter, TestCycle) {
96
   ulonglong t1 = my_timer_cycles();
97
   ulonglong t2;
98
   int i;
99
-  int backward = 0;
100
+  int backward [[maybe_unused]] = 0;
101
   int nonzero = 0;
102
 
103
   for (i = 0; i < LOOP_COUNT; i++) {

Return to bug 269442