mirror of
https://github.com/MariaDB/server.git
synced 2025-11-28 17:36:30 +03:00
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
This commit is contained in:
@@ -17,6 +17,12 @@ IF(NOT LIBJEMALLOC)
|
||||
MESSAGE(WARNING "TokuDB is enabled, but jemalloc is not. This configuration is not supported")
|
||||
ENDIF()
|
||||
|
||||
CHECK_C_COMPILER_FLAG("-Wshadow" HAVE_WSHADOW)
|
||||
IF (HAVE_WSHADOW)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-shadow")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-shadow")
|
||||
ENDIF()
|
||||
|
||||
IF (HAVE_WVLA)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-vla")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-vla")
|
||||
|
||||
@@ -160,7 +160,7 @@ size_t toku_malloc_usable_size(void *p) __attribute__((__visibility__("default")
|
||||
#define XMALLOC(v) CAST_FROM_VOIDP(v, toku_xmalloc(sizeof(*v)))
|
||||
#define XMALLOC_N(n,v) CAST_FROM_VOIDP(v, toku_xmalloc((n)*sizeof(*v)))
|
||||
#define XCALLOC_N(n,v) CAST_FROM_VOIDP(v, toku_xcalloc((n), (sizeof(*v))))
|
||||
#define XCALLOC(v) XCALLOC_N(1,(v))
|
||||
#define XCALLOC(v) XCALLOC_N(1,v)
|
||||
#define XREALLOC(v,s) CAST_FROM_VOIDP(v, toku_xrealloc(v, s))
|
||||
#define XREALLOC_N(n,v) CAST_FROM_VOIDP(v, toku_xrealloc(v, (n)*sizeof(*v)))
|
||||
|
||||
|
||||
@@ -638,7 +638,7 @@ int main(int argc, char *argv[]) {
|
||||
it == candidate_strategies.begin() ? &stats : &dummy_stats);
|
||||
|
||||
struct fragmentation_report aggregate_report;
|
||||
memset(&aggregate_report, 0, sizeof(aggregate_report));
|
||||
memset(static_cast<void *>(&aggregate_report), 0, sizeof(aggregate_report));
|
||||
for (map<uint64_t, struct fragmentation_report>::iterator rp = reports.begin();
|
||||
rp != reports.end(); rp++) {
|
||||
const struct fragmentation_report &report = rp->second;
|
||||
|
||||
@@ -132,8 +132,8 @@ void dmt<dmtdata_t, dmtdataout_t, dmtwriter_t>::create_from_sorted_memory_of_fix
|
||||
paranoid_invariant(numvalues > 0);
|
||||
void *ptr = toku_mempool_malloc(&this->mp, aligned_memsize);
|
||||
paranoid_invariant_notnull(ptr);
|
||||
uint8_t * const CAST_FROM_VOIDP(dest, ptr);
|
||||
const uint8_t * const CAST_FROM_VOIDP(src, mem);
|
||||
uint8_t * CAST_FROM_VOIDP(dest, ptr);
|
||||
const uint8_t * CAST_FROM_VOIDP(src, mem);
|
||||
if (pad_bytes == 0) {
|
||||
paranoid_invariant(aligned_memsize == mem_length);
|
||||
memcpy(dest, src, aligned_memsize);
|
||||
|
||||
Reference in New Issue
Block a user