diff options
author | Khem Raj <raj.khem@gmail.com> | 2018-05-11 20:07:58 -0700 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2018-05-17 08:28:20 -0700 |
commit | 1d41179dd034d1ddcf1e1ac615fa707ca4c2d8a1 (patch) | |
tree | 7bf11553c2d3c29df0ed583195dc54ff1af3c51d /meta-oe/recipes-dbs/rocksdb | |
parent | ebe6c9570c16defaa68628e57b537ce426ec09ec (diff) | |
download | meta-openembedded-1d41179dd034d1ddcf1e1ac615fa707ca4c2d8a1.tar.gz |
rocksdb: Fix build with gcc8
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'meta-oe/recipes-dbs/rocksdb')
-rw-r--r-- | meta-oe/recipes-dbs/rocksdb/rocksdb/0001-Fix-GitHub-issue-3716-gcc-8-warnings.patch | 194 | ||||
-rw-r--r-- | meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb | 4 |
2 files changed, 197 insertions, 1 deletions
diff --git a/meta-oe/recipes-dbs/rocksdb/rocksdb/0001-Fix-GitHub-issue-3716-gcc-8-warnings.patch b/meta-oe/recipes-dbs/rocksdb/rocksdb/0001-Fix-GitHub-issue-3716-gcc-8-warnings.patch new file mode 100644 index 000000000..be498974a --- /dev/null +++ b/meta-oe/recipes-dbs/rocksdb/rocksdb/0001-Fix-GitHub-issue-3716-gcc-8-warnings.patch | |||
@@ -0,0 +1,194 @@ | |||
1 | From 8d65d70b54d1d306a0a0b00e036bc8ddd39d8ec1 Mon Sep 17 00:00:00 2001 | ||
2 | From: "przemyslaw.skibinski@percona.com" <przemyslaw.skibinski@percona.com> | ||
3 | Date: Fri, 20 Apr 2018 13:28:05 -0700 | ||
4 | Subject: [PATCH] Fix GitHub issue #3716: gcc-8 warnings | ||
5 | |||
6 | Summary: | ||
7 | Fix the following gcc-8 warnings: | ||
8 | - conflicting C language linkage declaration [-Werror] | ||
9 | - writing to an object with no trivial copy-assignment [-Werror=class-memaccess] | ||
10 | - array subscript -1 is below array bounds [-Werror=array-bounds] | ||
11 | |||
12 | Solves https://github.com/facebook/rocksdb/issues/3716 | ||
13 | Closes https://github.com/facebook/rocksdb/pull/3736 | ||
14 | |||
15 | Differential Revision: D7684161 | ||
16 | |||
17 | Pulled By: yiwu-arbug | ||
18 | |||
19 | fbshipit-source-id: 47c0423d26b74add251f1d3595211eee1e41e54a | ||
20 | --- | ||
21 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
22 | Upstream-Status: Backport [https://github.com/facebook/rocksdb/commit/dee95a1afc6c63515e7d94dec33acdb79638b6d7.patch] | ||
23 | |||
24 | db/c.cc | 77 ++++++++++++++------------------------- | ||
25 | memtable/inlineskiplist.h | 12 +++--- | ||
26 | 2 files changed, 33 insertions(+), 56 deletions(-) | ||
27 | |||
28 | diff --git a/db/c.cc b/db/c.cc | ||
29 | index 064103ed4..0d485d096 100644 | ||
30 | --- a/db/c.cc | ||
31 | +++ b/db/c.cc | ||
32 | @@ -1388,23 +1388,24 @@ void rocksdb_writebatch_put_log_data( | ||
33 | b->rep.PutLogData(Slice(blob, len)); | ||
34 | } | ||
35 | |||
36 | +class H : public WriteBatch::Handler { | ||
37 | + public: | ||
38 | + void* state_; | ||
39 | + void (*put_)(void*, const char* k, size_t klen, const char* v, size_t vlen); | ||
40 | + void (*deleted_)(void*, const char* k, size_t klen); | ||
41 | + virtual void Put(const Slice& key, const Slice& value) override { | ||
42 | + (*put_)(state_, key.data(), key.size(), value.data(), value.size()); | ||
43 | + } | ||
44 | + virtual void Delete(const Slice& key) override { | ||
45 | + (*deleted_)(state_, key.data(), key.size()); | ||
46 | + } | ||
47 | +}; | ||
48 | + | ||
49 | void rocksdb_writebatch_iterate( | ||
50 | rocksdb_writebatch_t* b, | ||
51 | void* state, | ||
52 | void (*put)(void*, const char* k, size_t klen, const char* v, size_t vlen), | ||
53 | void (*deleted)(void*, const char* k, size_t klen)) { | ||
54 | - class H : public WriteBatch::Handler { | ||
55 | - public: | ||
56 | - void* state_; | ||
57 | - void (*put_)(void*, const char* k, size_t klen, const char* v, size_t vlen); | ||
58 | - void (*deleted_)(void*, const char* k, size_t klen); | ||
59 | - virtual void Put(const Slice& key, const Slice& value) override { | ||
60 | - (*put_)(state_, key.data(), key.size(), value.data(), value.size()); | ||
61 | - } | ||
62 | - virtual void Delete(const Slice& key) override { | ||
63 | - (*deleted_)(state_, key.data(), key.size()); | ||
64 | - } | ||
65 | - }; | ||
66 | H handler; | ||
67 | handler.state_ = state; | ||
68 | handler.put_ = put; | ||
69 | @@ -1649,18 +1650,6 @@ void rocksdb_writebatch_wi_iterate( | ||
70 | void* state, | ||
71 | void (*put)(void*, const char* k, size_t klen, const char* v, size_t vlen), | ||
72 | void (*deleted)(void*, const char* k, size_t klen)) { | ||
73 | - class H : public WriteBatch::Handler { | ||
74 | - public: | ||
75 | - void* state_; | ||
76 | - void (*put_)(void*, const char* k, size_t klen, const char* v, size_t vlen); | ||
77 | - void (*deleted_)(void*, const char* k, size_t klen); | ||
78 | - virtual void Put(const Slice& key, const Slice& value) override { | ||
79 | - (*put_)(state_, key.data(), key.size(), value.data(), value.size()); | ||
80 | - } | ||
81 | - virtual void Delete(const Slice& key) override { | ||
82 | - (*deleted_)(state_, key.data(), key.size()); | ||
83 | - } | ||
84 | - }; | ||
85 | H handler; | ||
86 | handler.state_ = state; | ||
87 | handler.put_ = put; | ||
88 | @@ -3109,20 +3098,21 @@ void rocksdb_slicetransform_destroy(rocksdb_slicetransform_t* st) { | ||
89 | delete st; | ||
90 | } | ||
91 | |||
92 | +struct Wrapper : public rocksdb_slicetransform_t { | ||
93 | + const SliceTransform* rep_; | ||
94 | + ~Wrapper() { delete rep_; } | ||
95 | + const char* Name() const override { return rep_->Name(); } | ||
96 | + Slice Transform(const Slice& src) const override { | ||
97 | + return rep_->Transform(src); | ||
98 | + } | ||
99 | + bool InDomain(const Slice& src) const override { | ||
100 | + return rep_->InDomain(src); | ||
101 | + } | ||
102 | + bool InRange(const Slice& src) const override { return rep_->InRange(src); } | ||
103 | + static void DoNothing(void*) { } | ||
104 | +}; | ||
105 | + | ||
106 | rocksdb_slicetransform_t* rocksdb_slicetransform_create_fixed_prefix(size_t prefixLen) { | ||
107 | - struct Wrapper : public rocksdb_slicetransform_t { | ||
108 | - const SliceTransform* rep_; | ||
109 | - ~Wrapper() { delete rep_; } | ||
110 | - const char* Name() const override { return rep_->Name(); } | ||
111 | - Slice Transform(const Slice& src) const override { | ||
112 | - return rep_->Transform(src); | ||
113 | - } | ||
114 | - bool InDomain(const Slice& src) const override { | ||
115 | - return rep_->InDomain(src); | ||
116 | - } | ||
117 | - bool InRange(const Slice& src) const override { return rep_->InRange(src); } | ||
118 | - static void DoNothing(void*) { } | ||
119 | - }; | ||
120 | Wrapper* wrapper = new Wrapper; | ||
121 | wrapper->rep_ = rocksdb::NewFixedPrefixTransform(prefixLen); | ||
122 | wrapper->state_ = nullptr; | ||
123 | @@ -3131,19 +3121,6 @@ rocksdb_slicetransform_t* rocksdb_slicetransform_create_fixed_prefix(size_t pref | ||
124 | } | ||
125 | |||
126 | rocksdb_slicetransform_t* rocksdb_slicetransform_create_noop() { | ||
127 | - struct Wrapper : public rocksdb_slicetransform_t { | ||
128 | - const SliceTransform* rep_; | ||
129 | - ~Wrapper() { delete rep_; } | ||
130 | - const char* Name() const override { return rep_->Name(); } | ||
131 | - Slice Transform(const Slice& src) const override { | ||
132 | - return rep_->Transform(src); | ||
133 | - } | ||
134 | - bool InDomain(const Slice& src) const override { | ||
135 | - return rep_->InDomain(src); | ||
136 | - } | ||
137 | - bool InRange(const Slice& src) const override { return rep_->InRange(src); } | ||
138 | - static void DoNothing(void*) { } | ||
139 | - }; | ||
140 | Wrapper* wrapper = new Wrapper; | ||
141 | wrapper->rep_ = rocksdb::NewNoopTransform(); | ||
142 | wrapper->state_ = nullptr; | ||
143 | diff --git a/memtable/inlineskiplist.h b/memtable/inlineskiplist.h | ||
144 | index 702a7336d..eadda1dc1 100644 | ||
145 | --- a/memtable/inlineskiplist.h | ||
146 | +++ b/memtable/inlineskiplist.h | ||
147 | @@ -280,7 +280,7 @@ struct InlineSkipList<Comparator>::Node { | ||
148 | // next_[0]. This is used for passing data from AllocateKey to Insert. | ||
149 | void StashHeight(const int height) { | ||
150 | assert(sizeof(int) <= sizeof(next_[0])); | ||
151 | - memcpy(&next_[0], &height, sizeof(int)); | ||
152 | + memcpy(static_cast<void*>(&next_[0]), &height, sizeof(int)); | ||
153 | } | ||
154 | |||
155 | // Retrieves the value passed to StashHeight. Undefined after a call | ||
156 | @@ -300,30 +300,30 @@ struct InlineSkipList<Comparator>::Node { | ||
157 | assert(n >= 0); | ||
158 | // Use an 'acquire load' so that we observe a fully initialized | ||
159 | // version of the returned Node. | ||
160 | - return (next_[-n].load(std::memory_order_acquire)); | ||
161 | + return ((&next_[0] - n)->load(std::memory_order_acquire)); | ||
162 | } | ||
163 | |||
164 | void SetNext(int n, Node* x) { | ||
165 | assert(n >= 0); | ||
166 | // Use a 'release store' so that anybody who reads through this | ||
167 | // pointer observes a fully initialized version of the inserted node. | ||
168 | - next_[-n].store(x, std::memory_order_release); | ||
169 | + (&next_[0] - n)->store(x, std::memory_order_release); | ||
170 | } | ||
171 | |||
172 | bool CASNext(int n, Node* expected, Node* x) { | ||
173 | assert(n >= 0); | ||
174 | - return next_[-n].compare_exchange_strong(expected, x); | ||
175 | + return (&next_[0] - n)->compare_exchange_strong(expected, x); | ||
176 | } | ||
177 | |||
178 | // No-barrier variants that can be safely used in a few locations. | ||
179 | Node* NoBarrier_Next(int n) { | ||
180 | assert(n >= 0); | ||
181 | - return next_[-n].load(std::memory_order_relaxed); | ||
182 | + return (&next_[0] - n)->load(std::memory_order_relaxed); | ||
183 | } | ||
184 | |||
185 | void NoBarrier_SetNext(int n, Node* x) { | ||
186 | assert(n >= 0); | ||
187 | - next_[-n].store(x, std::memory_order_relaxed); | ||
188 | + (&next_[0] - n)->store(x, std::memory_order_relaxed); | ||
189 | } | ||
190 | |||
191 | // Insert node after prev on specific level. | ||
192 | -- | ||
193 | 2.17.0 | ||
194 | |||
diff --git a/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb b/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb index 1e6cbae38..9a2f9dd1c 100644 --- a/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb +++ b/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb | |||
@@ -10,7 +10,9 @@ SRCREV = "8969445642039566214d650cc6614849e7dd5e17" | |||
10 | SRCBRANCH = "5.12.fb" | 10 | SRCBRANCH = "5.12.fb" |
11 | PV = "5.12.2" | 11 | PV = "5.12.2" |
12 | 12 | ||
13 | SRC_URI = "git://github.com/facebook/${BPN}.git;branch=${SRCBRANCH}" | 13 | SRC_URI = "git://github.com/facebook/${BPN}.git;branch=${SRCBRANCH} \ |
14 | file://0001-Fix-GitHub-issue-3716-gcc-8-warnings.patch \ | ||
15 | " | ||
14 | 16 | ||
15 | S = "${WORKDIR}/git" | 17 | S = "${WORKDIR}/git" |
16 | 18 | ||