Skip to content

Commit 2124606

Browse files
committed
Make TokuDB compile with GCC-8
GCC-8 introduced multiple warnings and increased the level of strictness. * -Wshadow will warn if a local variable shadows a typedef. * GCC will also warn when memsetting a non-trivial type. In this case a non-trivial type can not have a custom constructor. For all intents and purposes, the class is trivially-copyable. * GCC will also warn if you use too many paranthesses which are not necessary
1 parent 7fca4b5 commit 2124606

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

storage/tokudb/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ IF(NOT LIBJEMALLOC)
1717
MESSAGE(WARNING "TokuDB is enabled, but jemalloc is not. This configuration is not supported")
1818
ENDIF()
1919

20+
CHECK_C_COMPILER_FLAG("-Wshadow" HAVE_WSHADOW)
21+
IF (HAVE_WSHADOW)
22+
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-shadow")
23+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-shadow")
24+
ENDIF()
25+
2026
IF (HAVE_WVLA)
2127
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-vla")
2228
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-vla")

storage/tokudb/ft-index/portability/memory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ size_t toku_malloc_usable_size(void *p) __attribute__((__visibility__("default")
160160
#define XMALLOC(v) CAST_FROM_VOIDP(v, toku_xmalloc(sizeof(*v)))
161161
#define XMALLOC_N(n,v) CAST_FROM_VOIDP(v, toku_xmalloc((n)*sizeof(*v)))
162162
#define XCALLOC_N(n,v) CAST_FROM_VOIDP(v, toku_xcalloc((n), (sizeof(*v))))
163-
#define XCALLOC(v) XCALLOC_N(1,(v))
163+
#define XCALLOC(v) XCALLOC_N(1,v)
164164
#define XREALLOC(v,s) CAST_FROM_VOIDP(v, toku_xrealloc(v, s))
165165
#define XREALLOC_N(n,v) CAST_FROM_VOIDP(v, toku_xrealloc(v, (n)*sizeof(*v)))
166166

storage/tokudb/ft-index/tools/ba_replay.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ int main(int argc, char *argv[]) {
638638
it == candidate_strategies.begin() ? &stats : &dummy_stats);
639639

640640
struct fragmentation_report aggregate_report;
641-
memset(&aggregate_report, 0, sizeof(aggregate_report));
641+
memset(static_cast<void *>(&aggregate_report), 0, sizeof(aggregate_report));
642642
for (map<uint64_t, struct fragmentation_report>::iterator rp = reports.begin();
643643
rp != reports.end(); rp++) {
644644
const struct fragmentation_report &report = rp->second;

storage/tokudb/ft-index/util/dmt.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ void dmt<dmtdata_t, dmtdataout_t, dmtwriter_t>::create_from_sorted_memory_of_fix
132132
paranoid_invariant(numvalues > 0);
133133
void *ptr = toku_mempool_malloc(&this->mp, aligned_memsize);
134134
paranoid_invariant_notnull(ptr);
135-
uint8_t * const CAST_FROM_VOIDP(dest, ptr);
136-
const uint8_t * const CAST_FROM_VOIDP(src, mem);
135+
uint8_t * CAST_FROM_VOIDP(dest, ptr);
136+
const uint8_t * CAST_FROM_VOIDP(src, mem);
137137
if (pad_bytes == 0) {
138138
paranoid_invariant(aligned_memsize == mem_length);
139139
memcpy(dest, src, aligned_memsize);

0 commit comments

Comments
 (0)