Commit 09d1db50 authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

closes #5485 #5368 clean up cmake and get darwin portability:

for 5485:
 - remove icc handling stuff from cmake
 - clean up remaining cmake files
 - create libtokudb_static.a in a cleaner way using cmake OBJECT libs (requires cmake 2.8.9)
 - use POSITION_INDEPENDENT_CODE property instead of manually setting -fPIC
for 5368:
 - fix compilation failures due to small differences between gcc and clang, mostly in tests
 - use toku_fileids_are_equal instead of memcmp to compare fileids (closes #5505)
 - create dummy implementation of partitioned_counter for osx (quick fix for, and closes #5506)
 - add mutex->valid bit under TOKU_PTHREAD_DEBUG
 - initialize mutex of DB_TXN created during recovery for 2PC (closes #5507)


git-svn-id: file:///svn/toku/tokudb@48024 c7de825b-a66e-492c-adef-691d508d4ae1
parent dfbaf479
cmake_minimum_required(VERSION 2.8.8)
cmake_minimum_required(VERSION 2.8.9 FATAL_ERROR)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules")
## this needs to happen before calling project(), when cmake detects some
## basic things about the compiler
include(TokuSetupIntelCompiler)
project(TokuDB)
# suppress -rdynamic
......@@ -23,13 +19,6 @@ include(TokuMergeLibs)
set(LIBTOKUPORTABILITY "tokuportability" CACHE STRING "Name of libtokuportability.so")
set(LIBTOKUDB "tokudb" CACHE STRING "Name of libtokudb.so")
## add an option for cilk
option(USE_CILK "Use cilk in tokudb." OFF)
## can't use cilk without icc
if (USE_CILK AND (NOT CMAKE_CXX_COMPILER_ID MATCHES Intel))
message(FATAL_ERROR "You specified USE_CILK=ON so you need INTEL_CC=ON.")
endif ()
include_directories(
${VALGRIND_INCLUDE_DIR}
)
......
......@@ -22,19 +22,6 @@ SET(STATIC_LIBS "@STATIC_LIBS@")
SET(CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@")
SET(CMAKE_AR "@CMAKE_AR@")
SET(CMAKE_RANLIB "@CMAKE_RANLIB@")
SET(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@")
SET(CMAKE_C_COMPILER_ID "@CMAKE_C_COMPILER_ID@")
SET(CMAKE_C_FLAGS "@CMAKE_C_FLAGS@")
SET(CMAKE_C_FLAGS_DEBUG "@CMAKE_C_FLAGS_DEBUG@")
SET(CMAKE_C_FLAGS_RELEASE "@CMAKE_C_FLAGS_RELEASE@")
SET(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@")
SET(CMAKE_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@")
SET(CMAKE_CXX_FLAGS "@CMAKE_CXX_FLAGS@")
SET(CMAKE_CXX_FLAGS_DEBUG "@CMAKE_CXX_FLAGS_DEBUG@")
SET(CMAKE_CXX_FLAGS_RELEASE "@CMAKE_CXX_FLAGS_RELEASE@")
SET(CMAKE_BUILD_TYPE "@CMAKE_BUILD_TYPE@")
SET(CMAKE_TOP_BINARY_DIR "@CMAKE_TOP_BINARY_DIR@")
SET(LIBTOKUPORTABILITY "@LIBTOKUPORTABILITY@")
SET(TEMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/merge_archives_${TARGET})
......@@ -49,12 +36,8 @@ FOREACH(LIB ${STATIC_LIBS})
WORKING_DIRECTORY ${TEMP_SUBDIR}
)
FILE(GLOB_RECURSE LIB_OBJECTS "${TEMP_SUBDIR}/*.ilo")
if (NOT LIB_OBJECTS)
FILE(GLOB_RECURSE NONIPO_LIB_OBJECTS "${TEMP_SUBDIR}/*.o")
ENDIF ()
FILE(GLOB_RECURSE LIB_OBJECTS "${TEMP_SUBDIR}/*.o")
SET(OBJECTS ${OBJECTS} ${LIB_OBJECTS})
SET(EXTRA_OBJECTS ${EXTRA_OBJECTS} ${NONIPO_LIB_OBJECTS})
ENDFOREACH()
# Use relative paths, makes command line shorter.
......@@ -64,30 +47,11 @@ FOREACH(OBJ ${OBJECTS})
FILE(TO_NATIVE_PATH ${OBJ} OBJ)
SET(ALL_OBJECTS ${ALL_OBJECTS} ${OBJ})
ENDFOREACH()
FOREACH(OBJ ${EXTRA_OBJECTS})
FILE(RELATIVE_PATH OBJ ${ABS_TEMP_DIR} ${OBJ})
FILE(TO_NATIVE_PATH ${OBJ} OBJ)
SET(ALL_EXTRA_OBJECTS ${ALL_EXTRA_OBJECTS} ${OBJ})
ENDFOREACH()
SET(TARGET_O ${TARGET}_combined.o)
IF(CMAKE_BUILD_TYPE STREQUAL Release AND CMAKE_CXX_COMPILER_ID STREQUAL Intel)
SET(flags "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")
SEPARATE_ARGUMENTS(flags)
EXECUTE_PROCESS(
COMMAND ${CMAKE_CXX_COMPILER} ${flags} -ipo1 -ipo-c -diag-disable 10015 -o ${TARGET_O} ${ALL_OBJECTS}
WORKING_DIRECTORY ${TEMP_DIR}
)
SET(TARGET_OBJECTS ${TARGET_O} ${ALL_EXTRA_OBJECTS})
ELSE()
SET(TARGET_OBJECTS ${ALL_OBJECTS} ${ALL_EXTRA_OBJECTS})
ENDIF()
FILE(TO_NATIVE_PATH ${TARGET_LOCATION} ${TARGET_LOCATION})
# Now pack the objects into library with ar.
EXECUTE_PROCESS(
COMMAND ${CMAKE_AR} -r ${TARGET_LOCATION} ${TARGET_OBJECTS}
COMMAND ${CMAKE_AR} -r ${TARGET_LOCATION} ${ALL_OBJECTS}
WORKING_DIRECTORY ${TEMP_DIR}
)
EXECUTE_PROCESS(
......
......@@ -22,6 +22,7 @@ check_include_files(libkern/OSByteOrder.h HAVE_LIBKERN_OSBYTEORDER_H)
check_include_files(limits.h HAVE_LIMITS_H)
check_include_files(machine/endian.h HAVE_MACHINE_ENDIAN_H)
check_include_files(malloc.h HAVE_MALLOC_H)
check_include_files(malloc/malloc.h HAVE_MALLOC_MALLOC_H)
check_include_files(pthread.h HAVE_PTHREAD_H)
check_include_files(stdint.h HAVE_STDINT_H)
check_include_files(stdlib.h HAVE_STDLIB_H)
......
......@@ -62,48 +62,9 @@ macro(hostname out)
string(REGEX REPLACE "\\.tokutek\\.com$" "" ${out} ${fullhostname})
endmacro(hostname)
## determines the current revision of ${svn_dir}
macro(get_svn_revision svn_dir out)
find_program(CMAKE_SVN_PROG svn)
if(CMAKE_SVN_PROG MATCHES "CMAKE_SVN_PROG-NOTFOUND")
message(ERROR "can't find svn")
endif()
find_program(CMAKE_AWK_PROG NAMES awk gawk)
if(CMAKE_AWK_PROG MATCHES "CMAKE_AWK_PROG-NOTFOUND")
message(ERROR "can't find awk or gawk")
endif()
execute_process(
COMMAND ${CMAKE_SVN_PROG} info ${svn_dir}
COMMAND ${CMAKE_AWK_PROG} "/Revision/ { print $2 }"
OUTPUT_VARIABLE revision
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(${out} ${revision})
endmacro(get_svn_revision)
## determines whether you have local changes in ${svn_dir} (${out} will be
## either the empty string if it's clean, or "-dirty" if you have changes)
macro(get_svn_wc_status svn_dir out)
find_program(CMAKE_SVN_PROG svn)
if(CMAKE_SVN_PROG MATCHES "CMAKE_SVN_PROG-NOTFOUND")
message(ERROR "can't find svn")
endif()
find_program(CMAKE_AWK_PROG NAMES awk gawk)
execute_process(
COMMAND ${CMAKE_SVN_PROG} status -q ${svn_dir}
OUTPUT_VARIABLE svn_status
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(svn_status MATCHES "^$")
set(${out} "")
else()
set(${out} "-dirty")
endif()
endmacro(get_svn_wc_status)
## gather machine info
uname("-m" machine_type)
real_executable_name("${CMAKE_CXX_COMPILER}" real_cxx_compiler)
#get_svn_revision("${CMAKE_CURRENT_SOURCE_DIR}" svn_revision) ## unused since it confuses cdash about history
#get_svn_wc_status("${CMAKE_CURRENT_SOURCE_DIR}" wc_status) ## unused since it confuses cdash about history
get_filename_component(branchname "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
hostname(host)
whoami(user)
......
This diff is collapsed.
option(INTEL_CC "Use the Intel compiler." OFF)
if (INTEL_CC)
find_program(CMAKE_C_COMPILER NAMES icc)
find_program(CMAKE_CXX_COMPILER NAMES icpc)
find_program(CMAKE_AR NAMES xiar)
find_program(CMAKE_LINKER NAMES xild)
if (CMAKE_C_COMPILER MATCHES CMAKE_C_COMPILER-NOTFOUND OR
CMAKE_CXX_COMPILER MATCHES CMAKE_CXX_COMPILER-NOTFOUND OR
CMAKE_AR MATCHES CMAKE_AR-NOTFOUND OR
CMAKE_LINKER MATCHES CMAKE_LINKER-NOTFOUND)
message(FATAL_ERROR "Cannot find Intel compiler. You may need to run `source /opt/intel/bin/compilervars.sh intel64'")
endif ()
endif (INTEL_CC)
\ No newline at end of file
......@@ -3,18 +3,14 @@ set(TOKU_SVNROOT "${TokuDB_SOURCE_DIR}/../.." CACHE FILEPATH "The top of the tok
## add lzma with an external project
include(ExternalProject)
set(xz_configure_opts --with-pic)
if (CMAKE_SYSTEM_NAME MATCHES Darwin)
## lzma has some assembly that doesn't work on osx
set(xz_configure_opts --with-pic --enable-static)
if (APPLE)
## lzma has some assembly that doesn't work on darwin
list(APPEND xz_configure_opts --disable-assembler)
endif ()
list(APPEND xz_configure_opts CC=${CMAKE_C_COMPILER})
if (CMAKE_BUILD_TYPE MATCHES Release)
if (CMAKE_C_COMPILER_ID MATCHES Intel)
list(APPEND xz_configure_opts "CFLAGS=-O2 -g -ip -ipo1" AR=xiar)
endif ()
else ()
if (NOT CMAKE_BUILD_TYPE MATCHES Release)
list(APPEND xz_configure_opts --enable-debug)
endif ()
......
......@@ -76,7 +76,7 @@ static int inserter(struct keygen *keygen, DB_ENV *env, DB *db) {
if (r != 0)
break;
if (verbose) printf("%d: %" PRIu64 "\n", (int) pthread_self(), k);
if (verbose) printf("%" PRIdPTR ": %" PRIu64 "\n", (intptr_t) pthread_self(), k);
DB_TXN *txn;
r = env->txn_begin(env, NULL, &txn, 0);
......@@ -95,7 +95,7 @@ static int inserter(struct keygen *keygen, DB_ENV *env, DB *db) {
}
static void *inserter_wrap(void *arg) {
if (verbose) printf("%d\n", (int) pthread_self());
if (verbose) printf("%" PRIdPTR "\n", (intptr_t) pthread_self());
struct inserter_arg *inserter_arg = (struct inserter_arg *) arg;
int r = inserter(inserter_arg->keygen, inserter_arg->env, inserter_arg->db);
assert(r == 0);
......
......@@ -11,6 +11,7 @@
#include <toku_assert.h>
#include <db.h>
#include <errno.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
......@@ -292,7 +293,7 @@ static int counttotalbytes (DBT const *key, DBT const *data, void *extrav) {
struct extra_count *CAST_FROM_VOIDP(e, extrav);
e->totalbytes += key->size + data->size;
e->rowcounter++;
if (do_mysql && 0) {
if (do_mysql && false) {
static uint64_t expect_key = 0;
uint64_t k = mysql_get_bigint((unsigned char*)key->data+1);
if (k != expect_key)
......
......@@ -79,14 +79,15 @@ set(FT_SOURCES
)
add_library(ft SHARED ${FT_SOURCES})
add_library(ft_static STATIC ${FT_SOURCES})
add_library(ft_objects OBJECT ${FT_SOURCES})
## we're going to link this into libtokudb.so so it needs to have PIC
add_space_separated_property(TARGET ft_static COMPILE_FLAGS -fPIC)
maybe_add_gcov_to_libraries(ft ft_static)
set_target_properties(ft_objects PROPERTIES POSITION_INDEPENDENT_CODE ON)
maybe_add_gcov_to_libraries(ft ft_objects)
add_library(ft_static STATIC $<TARGET_OBJECTS:ft_objects>)
## depend on other generated targets
add_dependencies(ft install_tdb_h generate_log_code build_lzma)
add_dependencies(ft_static install_tdb_h generate_log_code build_lzma)
add_dependencies(ft_objects install_tdb_h generate_log_code build_lzma)
## link with lzma (which should be static) and link dependers with zlib
target_link_libraries(ft LINK_PRIVATE lzma ${LIBTOKUPORTABILITY})
......
......@@ -332,7 +332,7 @@ int toku_cachetable_openfd_with_filenum (CACHEFILE *cfptr, CACHETABLE ct, int fd
}
ct->cf_list.write_lock();
for (extant = ct->cf_list.m_head; extant; extant = extant->next) {
if (memcmp(&extant->fileid, &fileid, sizeof(fileid))==0) {
if (toku_fileids_are_equal(&extant->fileid, &fileid)) {
// Clients must serialize cachefile open, close, and unlink
// So, during open, we should never see a closing cachefile
// or one that has been marked as unlink on close.
......
......@@ -12,6 +12,42 @@
#include "doubly_linked_list.h"
#include "growable_array.h"
#ifdef __APPLE__
// TODO(leif): The __thread declspec is broken in ways I don't understand
// on Darwin. Partitioned counters use them and it would be prohibitive
// to tease them apart before a week after 6.5.0, so instead, we're just
// not going to use them in the most brutal way possible. This is a
// terrible implementation of the API in partitioned_counter.h but it
// should be correct enough to release a non-performant version on OSX for
// development. Soon, we need to either make portable partitioned
// counters, or we need to do this disabling in a portable way.
struct partitioned_counter {
uint64_t v;
};
PARTITIONED_COUNTER create_partitioned_counter(void) {
PARTITIONED_COUNTER XCALLOC(counter);
return counter;
}
void destroy_partitioned_counter(PARTITIONED_COUNTER counter) {
toku_free(counter);
}
void increment_partitioned_counter(PARTITIONED_COUNTER counter, uint64_t delta) {
(void) __sync_fetch_and_add(&counter->v, delta);
}
uint64_t read_partitioned_counter(PARTITIONED_COUNTER counter) {
return counter->v;
}
void partitioned_counters_init(void) {}
void partitioned_counters_destroy(void) {}
#else // __APPLE__
//******************************************************************************
//
// Representation: The representation of a partitioned counter comprises a
......@@ -333,3 +369,5 @@ void partitioned_counters_destroy(void)
destroy_counters();
pc_unlock();
}
#endif // __APPLE__
......@@ -1503,7 +1503,7 @@ static int do_recovery(RECOVER_ENV renv, const char *env_dir, const char *log_di
{
// write a recovery log entry
BYTESTRING recover_comment = { strlen("recover"), (char *) "recover" };
BYTESTRING recover_comment = { static_cast<uint32_t>(strlen("recover")), (char *) "recover" };
r = toku_log_comment(renv->logger, NULL, true, 0, recover_comment);
assert(r == 0);
}
......
......@@ -126,11 +126,11 @@ static void cachetable_prefetch_maybegetandpin_test (bool do_partial_fetch) {
r = toku_cachetable_get_and_pin(f1, key, fullhash, &v, &size, wc, fetch, pf_req_callback, pf_callback, true, NULL);
assert(r == 0 && v == 0 && size == 2);
struct timeval tend;
struct timeval tend;
gettimeofday(&tend, NULL);
assert(tdelta_usec(&tend, &tstart) >= 2000000);
assert(tdelta_usec(&tend, &tstart) >= 1900000);
toku_cachetable_verify(ct);
r = toku_test_cachetable_unpin(f1, key, fullhash, CACHETABLE_CLEAN, make_pair_attr(1));
......
......@@ -63,9 +63,6 @@ struct item {
const char *something;
};
static volatile int expect_n_flushes=0;
static CACHEFILE expect_f;
static void maybe_flush(CACHETABLE t) {
......
......@@ -24,7 +24,7 @@ static void copy_dbt(DBT *dest, const DBT *src) {
}
static int generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; dest_val = dest_val; src_key = src_key; src_val = src_val;
(void) dest_db; (void) src_db; (void) dest_key; (void) dest_val; (void) src_key; (void) src_val;
copy_dbt(dest_key, src_key);
copy_dbt(dest_val, src_val);
......
......@@ -43,7 +43,7 @@ test_main (int argc, const char *argv[]) {
r = toku_log_comment(logger, &lsn, 0, now(), bs0);
assert(r == 0);
sleep(10);
sleep(11);
BYTESTRING bs1 = { .len = 5, .data = (char *) "world" };
r = toku_log_comment(logger, &lsn, 0, now(), bs1);
......
......@@ -27,25 +27,29 @@ namespace test {
static inline uint32_t fudge(const uint32_t x) { return x + 300; }
static inline uint32_t defudge(const uint32_t fx) { return fx - 300; }
static int test_iterator(const uint32_t &v, const uint32_t idx, bool *const UU(unused)) {
int test_iterator(const uint32_t &v, const uint32_t idx, bool *const UU(unused));
int test_iterator(const uint32_t &v, const uint32_t idx, bool *const UU(unused)) {
invariant(defudge(v) == idx);
return 0;
}
static int check_iterator_before(const uint32_t &v, const uint32_t idx, bool *const called) {
int check_iterator_before(const uint32_t &v, const uint32_t idx, bool *const called);
int check_iterator_before(const uint32_t &v, const uint32_t idx, bool *const called) {
invariant(defudge(v) == idx);
invariant(idx % 10 < 5);
called[idx] = true;
return 0;
}
static int check_iterator_after(const uint32_t &v, const uint32_t UU(idx), bool *const called) {
int check_iterator_after(const uint32_t &v, const uint32_t UU(idx), bool *const called);
int check_iterator_after(const uint32_t &v, const uint32_t UU(idx), bool *const called) {
invariant(defudge(v) % 10 >= 5);
called[defudge(v)] = true;
return 0;
}
static int die(const uint32_t &UU(v), const uint32_t UU(idx), void *const UU(unused)) {
int die(const uint32_t &UU(v), const uint32_t UU(idx), void *const UU(unused));
int die(const uint32_t &UU(v), const uint32_t UU(idx), void *const UU(unused)) {
abort();
return 0; // hahaha
}
......@@ -109,7 +113,8 @@ static void run_test(uint32_t nelts) {
typedef omt<uint32_t, uint32_t, true> stress_omt;
static int int_heaviside(const uint32_t &v, const uint32_t &target) {
int int_heaviside(const uint32_t &v, const uint32_t &target);
int int_heaviside(const uint32_t &v, const uint32_t &target) {
return (v > target) - (v < target);
}
......@@ -145,7 +150,7 @@ static void generate_range(struct random_data *rng, const struct stress_shared &
if (range_limit > 1000) {
range_limit = 1000;
}
*begin = rand_choices(rng, nelts);
*begin = rand_choices(rng, nelts - 1);
if (*begin + range_limit > nelts) {
range_limit = nelts - *begin;
}
......@@ -157,7 +162,8 @@ struct pair {
uint32_t limit;
};
static int mark_read_iterator(const uint32_t &UU(v), const uint32_t idx, struct pair * const pair) {
int mark_read_iterator(const uint32_t &UU(v), const uint32_t idx, struct pair * const pair);
int mark_read_iterator(const uint32_t &UU(v), const uint32_t idx, struct pair * const pair) {
invariant(defudge(v) == idx);
invariant(idx >= pair->begin);
invariant(idx < pair->limit);
......@@ -211,7 +217,8 @@ public:
}
};
static int use_array_ftor(const uint32_t &v, const uint32_t UU(idx), array_ftor<uint32_t> *const fp) {
int use_array_ftor(const uint32_t &v, const uint32_t UU(idx), array_ftor<uint32_t> *const fp);
int use_array_ftor(const uint32_t &v, const uint32_t UU(idx), array_ftor<uint32_t> *const fp) {
array_ftor<uint32_t> &f = *fp;
f(v);
return 0;
......@@ -266,7 +273,8 @@ static void simulate_reader_marks_on_array(struct reader_extra *const reader, co
}
}
static int copy_marks(const uint32_t &v, const uint32_t idx, bool * const is_marked) {
int copy_marks(const uint32_t &v, const uint32_t idx, bool * const is_marked);
int copy_marks(const uint32_t &v, const uint32_t idx, bool * const is_marked) {
invariant(defudge(v) == idx);
is_marked[idx] = true;
return 0;
......
......@@ -5,11 +5,7 @@
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#if defined(__ICL) || defined(__ICC)
# define static_assert(foo, bar)
#else
# include <type_traits>
#endif
#include <type_traits>
#include <toku_portability.h>
#include <toku_assert.h>
#include <toku_time.h>
......@@ -26,7 +22,8 @@ namespace test {
TXNID one, two, three, four;
};
static inline int find_xid_one(const struct four_xids &xids, const TXNID &find) {
inline int find_xid_one(const struct four_xids &xids, const TXNID &find);
inline int find_xid_one(const struct four_xids &xids, const TXNID &find) {
if (xids.one > find) {
return 1;
}
......@@ -36,7 +33,8 @@ namespace test {
return 0;
}
static inline int find_xid_two(const struct four_xids &xids, const TXNID &find) {
inline int find_xid_two(const struct four_xids &xids, const TXNID &find);
inline int find_xid_two(const struct four_xids &xids, const TXNID &find) {
if (xids.two > find) {
return 1;
}
......@@ -46,15 +44,17 @@ namespace test {
return 0;
}
static inline int fx_iter(const struct four_xids &UU(xids), const uint32_t UU(idx), void *const UU(unused)) {
inline int fx_iter(const struct four_xids &UU(xids), const uint32_t UU(idx), void *const UU(unused));
inline int fx_iter(const struct four_xids &UU(xids), const uint32_t UU(idx), void *const UU(unused)) {
return 0;
}
typedef omt<four_xids, four_xids *> fx_omt_t;
static_assert(std::is_pod<fx_omt_t>::value, "fx_omt_t isn't POD");
ENSURE_POD(fx_omt_t);
static_assert(24 == sizeof(fx_omt_t), "fx_omt_t is bigger than 24 bytes");
static inline int find_by_xid(const TOKUTXN &txn, const TXNID &findid) {
inline int find_by_xid(const TOKUTXN &txn, const TXNID &findid);
inline int find_by_xid(const TOKUTXN &txn, const TXNID &findid) {
if (txn->txnid64 > findid) {
return 1;
}
......@@ -64,12 +64,13 @@ namespace test {
return 0;
}
static inline int txn_iter(const TOKUTXN &UU(txn), const uint32_t UU(idx), void *const UU(unused)) {
inline int txn_iter(const TOKUTXN &UU(txn), const uint32_t UU(idx), void *const UU(unused));
inline int txn_iter(const TOKUTXN &UU(txn), const uint32_t UU(idx), void *const UU(unused)) {
return 0;
}
typedef omt<TOKUTXN> txn_omt_t;
static_assert(std::is_pod<txn_omt_t>::value, "txn_omt_t isn't POD");
ENSURE_POD(txn_omt_t);
static_assert(24 == sizeof(txn_omt_t), "txn_omt_t is bigger than 24 bytes");
const int NTXNS = 1<<13;
......@@ -183,7 +184,8 @@ namespace test {
printf("memused: %" PRId64 "\n", maxrss);
}
static inline int intcmp(const int &a, const int &b) {
inline int intcmp(const int &a, const int &b);
inline int intcmp(const int &a, const int &b) {
if (a < b) {
return -1;
}
......@@ -196,7 +198,8 @@ namespace test {
typedef omt<int> int_omt_t;
static int intiter_magic = 0xdeadbeef;
static int intiter(const int &value __attribute__((__unused__)), const uint32_t idx __attribute__((__unused__)), int *const extra) {
inline int intiter(const int &value __attribute__((__unused__)), const uint32_t idx __attribute__((__unused__)), int *const extra);
inline int intiter(const int &value __attribute__((__unused__)), const uint32_t idx __attribute__((__unused__)), int *const extra) {
invariant(*extra == intiter_magic);
return 0;
}
......@@ -205,7 +208,8 @@ namespace test {
int count;
int last;
};
static int intiter2(const int &value, const uint32_t idx __attribute__((__unused__)), struct intiter2extra *const extra) {
inline int intiter2(const int &value, const uint32_t idx __attribute__((__unused__)), struct intiter2extra *const extra);
inline int intiter2(const int &value, const uint32_t idx __attribute__((__unused__)), struct intiter2extra *const extra) {
extra->count++;
invariant(extra->last < value);
extra->last = value;
......
......@@ -29,8 +29,8 @@ static inline DBT *dbt_init(DBT *dbt, void *data, uint32_t size) {
}
static void err_cb(DB *db, int which_db, int err, DBT *key, DBT *val, void *extra) {
db = db; which_db = which_db; err = err; extra = extra;
val = val;
(void) db; (void) which_db; (void) err; (void) extra;
(void) val;
found_dup = *(int *)key->data;
if (verbose) printf("err_cb : key <%d> val <%d>\n", *(int *)key->data, *(int *)val->data);
}
......
......@@ -292,7 +292,7 @@ static void *reader_test_fun (void *ta_v) {
assert(lastval <= thisval);
assert(thisval <= ta->limit+2);
lastval = thisval;
if (verboseness_cmdarg && (0==(thisval & (thisval-1)))) printf("ufc=%ld Thisval=%ld\n", ta->unfinished_count,thisval);
if (verboseness_cmdarg && (0==(thisval & (thisval-1)))) printf("ufc=%" PRIu64 " Thisval=%" PRIu64 "\n", ta->unfinished_count,thisval);
}
uint64_t thisval = read_partitioned_counter(ta->pc);
assert(thisval==ta->limit+2); // we incremented two extra times in the test
......
......@@ -13,7 +13,7 @@ int
test_main (int argc, const char *argv[]) {
default_parse_args(argc, argv);
char *XMALLOC_N(5, m);
m=m;
(void)m;
toku_free(m);
return 0;
}
......@@ -14,7 +14,7 @@ add_library(${LIBTOKUPORTABILITY} SHARED ${tokuportability_srcs})
add_library(${LIBTOKUPORTABILITY}_static STATIC ${tokuportability_srcs})
maybe_add_gcov_to_libraries(${LIBTOKUPORTABILITY} ${LIBTOKUPORTABILITY}_static)
set_property(TARGET ${LIBTOKUPORTABILITY} ${LIBTOKUPORTABILITY}_static APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE)
add_space_separated_property(TARGET ${LIBTOKUPORTABILITY}_static COMPILE_FLAGS -fPIC)
set_target_properties(${LIBTOKUPORTABILITY}_static PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_link_libraries(${LIBTOKUPORTABILITY} LINK_PUBLIC ${CMAKE_THREAD_LIBS_INIT} dl)
if (CMAKE_CXX_COMPILER_ID STREQUAL Intel)
......
......@@ -26,12 +26,7 @@ if(BUILD_TESTING)
foreach(test ${tests})
add_executable(${test} ${test})
target_link_libraries(${test} ${LIBTOKUPORTABILITY})
if(${test} STREQUAL test-fair-rwlock)
add_space_separated_property(TARGET ${test} COMPILE_FLAGS -fPIC)
add_space_separated_property(TARGET ${test} LINK_FLAGS -fPIC)
else()
add_common_options_to_binary_targets(${test})
endif()
set_target_properties(${test} PROPERTIES POSITION_INDEPENDENT_CODE ON)
if(HAVE_CLOCK_REALTIME)
target_link_libraries(${test} rt)
else()
......
......@@ -6,7 +6,7 @@
#if !defined(TOKU_OS_TYPES_H)
#define TOKU_OS_TYPES_H
#include <stdbool.h>
#include <sys/types.h>
#include <sys/stat.h>
......@@ -17,6 +17,11 @@ struct fileid {
ino_t st_ino;
};
__attribute__((const, nonnull, warn_unused_result))
static inline bool toku_fileids_are_equal(struct fileid *a, struct fileid *b) {
return a->st_dev == b->st_dev && a->st_ino == b->st_ino;
}
typedef struct stat toku_struct_stat;
// windows compat
......
......@@ -31,8 +31,9 @@ typedef struct timespec toku_timespec_t;
typedef struct toku_mutex {
pthread_mutex_t pmutex;
#if TOKU_PTHREAD_DEBUG
bool locked;
pthread_t owner; // = pthread_self(); // for debugging
bool locked;
bool valid;
#endif
} toku_mutex_t;
......@@ -50,12 +51,16 @@ toku_mutex_init(toku_mutex_t *mutex, const toku_pthread_mutexattr_t *attr) {
assert_zero(r);
#if TOKU_PTHREAD_DEBUG
mutex->locked = false;
invariant(!mutex->valid);
mutex->valid = true;
#endif
}
static inline void
toku_mutex_destroy(toku_mutex_t *mutex) {
#if TOKU_PTHREAD_DEBUG
invariant(mutex->valid);
mutex->valid = false;
invariant(!mutex->locked);
#endif
int r = pthread_mutex_destroy(&mutex->pmutex);
......@@ -67,6 +72,7 @@ toku_mutex_lock(toku_mutex_t *mutex) {
int r = pthread_mutex_lock(&mutex->pmutex);
assert_zero(r);
#if TOKU_PTHREAD_DEBUG
invariant(mutex->valid);
invariant(!mutex->locked);
mutex->locked = true;
mutex->owner = pthread_self();
......@@ -76,6 +82,7 @@ toku_mutex_lock(toku_mutex_t *mutex) {
static inline void
toku_mutex_unlock(toku_mutex_t *mutex) {
#if TOKU_PTHREAD_DEBUG
invariant(mutex->valid);
invariant(mutex->locked);
mutex->locked = false;
mutex->owner = 0;
......
......@@ -26,21 +26,9 @@ target_link_libraries(${LIBTOKUDB} LINK_PUBLIC z)
## make the static library
add_library(tokudb_static_conv STATIC ${tokudb_srcs})
add_dependencies(tokudb_static_conv install_tdb_h generate_log_code)
add_space_separated_property(TARGET tokudb_static_conv COMPILE_FLAGS -fPIC)
set(tokudb_required_libs tokudb_static_conv lock_tree_static range_tree_static
ft_static lzma ${LIBTOKUPORTABILITY} z ${CMAKE_THREAD_LIBS_INIT} dl)
if (CMAKE_CXX_COMPILER_ID STREQUAL Intel)
find_library(IRC_LIBRARIES NAMES libirc.a irc PATHS ENV LIBRARY_PATH)
add_library(irc_fullpath STATIC IMPORTED)
set_target_properties(irc_fullpath PROPERTIES IMPORTED_LOCATION ${IRC_LIBRARIES})
list(APPEND tokudb_required_libs irc_fullpath)
endif ()
set(CMAKE_TOP_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
merge_static_libs(${LIBTOKUDB}_static ${LIBTOKUDB}_static "${tokudb_required_libs}")
if (CMAKE_CXX_COMPILER_ID STREQUAL Intel)
target_link_libraries(${LIBTOKUDB} LINK_PRIVATE -nodefaultlibs)
endif ()
set_target_properties(tokudb_static_conv PROPERTIES POSITION_INDEPENDENT_CODE ON)
set(tokudb_source_libs tokudb_static_conv lock_tree_static range_tree_static ft_static lzma ${LIBTOKUPORTABILITY} z ${CMAKE_THREAD_LIBS_INIT} dl)
merge_static_libs(${LIBTOKUDB}_static ${LIBTOKUDB}_static "${tokudb_source_libs}")
## add a version script and set -fvisibility=hidden for the shared library
configure_file(export.map . COPYONLY)
......@@ -50,10 +38,8 @@ if (NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
endif ()
## add gcov and define _GNU_SOURCE
maybe_add_gcov_to_libraries(${LIBTOKUDB} tokudb_static_conv)
set_property(TARGET ${LIBTOKUDB} tokudb_static_conv APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE)
set_targets_need_intel_libs(${LIBTOKUDB})
maybe_add_gcov_to_libraries(${LIBTOKUDB} ${LIBTOKUDB}_static)
set_property(TARGET ${LIBTOKUDB} ${LIBTOKUDB}_static APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE)
install(
TARGETS ${LIBTOKUDB} ${LIBTOKUDB}_static
......
......@@ -14,20 +14,16 @@ set_property(TARGET lock_tree_tlog APPEND PROPERTY
target_link_libraries(lock_tree_tlog range_tree_tlog)
add_dependencies(lock_tree_tlog install_tdb_h)
set_targets_need_intel_libs(lock_tree_lin lock_tree_tlog)
if (CMAKE_CXX_COMPILER_ID STREQUAL Intel)
add_space_separated_property(TARGET lock_tree_lin LINK_FLAGS "-diag-disable 10237")
add_space_separated_property(TARGET lock_tree_tlog LINK_FLAGS "-diag-disable 10237")
endif ()
## make the real library, it's going to go into libtokudb.so so it needs
## to be PIC
add_library(lock_tree_static STATIC ${lock_tree_srcs})
add_space_separated_property(TARGET lock_tree_static COMPILE_FLAGS "-fvisibility=hidden -fPIC")
set_property(TARGET lock_tree_static APPEND PROPERTY
add_library(lock_tree_objects OBJECT ${lock_tree_srcs})
set_target_properties(lock_tree_objects PROPERTIES POSITION_INDEPENDENT_CODE ON)
add_space_separated_property(TARGET lock_tree_objects COMPILE_FLAGS "-fvisibility=hidden")
set_property(TARGET lock_tree_objects APPEND PROPERTY
COMPILE_DEFINITIONS TOKU_RT_NOOVERLAPS)
add_dependencies(lock_tree_static install_tdb_h)
add_dependencies(lock_tree_objects install_tdb_h)
maybe_add_gcov_to_libraries(lock_tree_lin lock_tree_tlog lock_tree_static)
maybe_add_gcov_to_libraries(lock_tree_lin lock_tree_tlog lock_tree_objects)
add_library(lock_tree_static STATIC $<TARGET_OBJECTS:lock_tree_objects>)
add_subdirectory(tests)
......@@ -17,6 +17,9 @@
# include <malloc.h>
#elif defined(HAVE_SYS_MALLOC_H)
# include <sys/malloc.h>
# if defined(HAVE_MALLOC_MALLOC_H)
# include <malloc/malloc.h>
# endif
#endif
#include "test.h"
#include <toku_byteswap.h>
......@@ -30,12 +33,12 @@ static uint64_t htonl64(uint64_t x) {
#endif
}
typedef size_t (*malloc_usable_size_fun_t)(void *p);
#if defined(HAVE_MALLOC_USABLE_SIZE)
typedef size_t (*malloc_usable_size_fun_t)(void *p);
size_t malloc_usable_size(void *p) __THROW;
static malloc_usable_size_fun_t malloc_usable_size_f = malloc_usable_size;
#elif defined(HAVE_MALLOC_SIZE)
size_t malloc_size(void *p) __THROW;
typedef size_t (*malloc_usable_size_fun_t)(const void *p);
static malloc_usable_size_fun_t malloc_usable_size_f = malloc_size;
#endif
......
......@@ -17,6 +17,9 @@
# include <malloc.h>
#elif defined(HAVE_SYS_MALLOC_H)
# include <sys/malloc.h>
# if defined(HAVE_MALLOC_MALLOC_H)
# include <malloc/malloc.h>
# endif
#endif
#include "test.h"
#include <toku_byteswap.h>
......@@ -30,12 +33,12 @@ static uint64_t htonl64(uint64_t x) {
#endif
}
typedef size_t (*malloc_usable_size_fun_t)(void *p);
#if defined(HAVE_MALLOC_USABLE_SIZE)
typedef size_t (*malloc_usable_size_fun_t)(void *p);
size_t malloc_usable_size(void *p) __THROW;
static malloc_usable_size_fun_t malloc_usable_size_f = malloc_usable_size;
#elif defined(HAVE_MALLOC_SIZE)
size_t malloc_size(void *p) __THROW;
typedef size_t (*malloc_usable_size_fun_t)(const void *p);
static malloc_usable_size_fun_t malloc_usable_size_f = malloc_size;
#endif
......
......@@ -10,18 +10,15 @@ add_library(range_tree_tlog SHARED log_nooverlap)
target_link_libraries(range_tree_tlog ft ${LIBTOKUPORTABILITY})
add_dependencies(range_tree_tlog install_tdb_h)
set_targets_need_intel_libs(range_tree_lin range_tree_tlog)
if (CMAKE_CXX_COMPILER_ID STREQUAL Intel)
add_space_separated_property(TARGET range_tree_lin LINK_FLAGS "-diag-disable 10237")
add_space_separated_property(TARGET range_tree_tlog LINK_FLAGS "-diag-disable 10237")
endif ()
## make the real library, it's going to go into libtokudb.so so it needs
## to be PIC
add_library(range_tree_static STATIC log_nooverlap)
add_space_separated_property(TARGET range_tree_static COMPILE_FLAGS "-fvisibility=hidden -fPIC")
add_dependencies(range_tree_static install_tdb_h)
add_library(range_tree_objects OBJECT log_nooverlap)
set_target_properties(range_tree_objects PROPERTIES POSITION_INDEPENDENT_CODE ON)
add_space_separated_property(TARGET range_tree_objects COMPILE_FLAGS "-fvisibility=hidden")
add_dependencies(range_tree_objects install_tdb_h)
maybe_add_gcov_to_libraries(range_tree_lin range_tree_tlog range_tree_objects)
maybe_add_gcov_to_libraries(range_tree_lin range_tree_tlog range_tree_static)
add_library(range_tree_static STATIC $<TARGET_OBJECTS:range_tree_objects>)
add_subdirectory(tests)
......@@ -22,7 +22,7 @@ get_data(int *v, int i, int ndbs) {
static int
del_callback(DB *dest_db, DB *src_db, DBT *dest_key, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) src_key; (void) src_data;
assert(src_db == NULL);
unsigned int dbnum;
......
......@@ -22,7 +22,7 @@ get_data(int *v, int i, int ndbs) {
static int
del_callback(DB *dest_db, DB *src_db, DBT *dest_key, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) src_key; (void) src_data;
unsigned int dbnum;
assert(dest_db->descriptor->dbt.size == sizeof dbnum);
......
......@@ -22,7 +22,7 @@ get_data(int *v, int i, int ndbs) {
static int
del_callback(DB *dest_db, DB *src_db, DBT *dest_key, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) src_key; (void) src_data;
assert(src_db == NULL);
unsigned int dbnum;
......
......@@ -30,7 +30,7 @@ DBT dest_vals[MAX_DBS];
static int
put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) {
src_db = src_db;
(void) src_db;
uint32_t which = *(uint32_t*)dest_db->app_private;
assert(which < MAX_DBS);
......
......@@ -21,7 +21,7 @@ struct kv_pair kv_pairs[NUM_KV_PAIRS] = {{1,4},
static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) {
src_db = src_db;
(void) src_db;
uint32_t which = (uint32_t) (intptr_t) dest_db->app_private;
assert(which == 0);
......@@ -37,8 +37,8 @@ static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *de
}
static int poll_print(void *extra, float progress) {
progress = progress;
extra = extra;
(void) progress;
(void) extra;
if ( verbose ) printf("poll_print %f\n", progress);
return 0;
}
......
......@@ -21,7 +21,7 @@ struct kv_pair kv_pairs[NUM_KV_PAIRS] = {{1,4},
static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) {
src_db = src_db;
(void) src_db;
uint32_t which = (uint32_t) (intptr_t) dest_db->app_private;
assert(which == 0);
......@@ -37,8 +37,8 @@ static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *de
}
static int poll_print(void *extra, float progress) {
progress = progress;
extra = extra;
(void) progress;
(void) extra;
if ( verbose ) printf("poll_print %f\n", progress);
return 0;
}
......
......@@ -21,7 +21,7 @@ struct kv_pair kv_pairs[NUM_KV_PAIRS] = {{1,4},
static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) {
src_db = src_db;
(void) src_db;
uint32_t which = (uint32_t) (intptr_t) dest_db->app_private;
assert(which == 0);
......@@ -37,8 +37,8 @@ static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *de
}
static int poll_print(void *extra, float progress) {
progress = progress;
extra = extra;
(void) progress;
(void) extra;
if ( verbose ) printf("poll_print %f\n", progress);
return 0;
}
......
......@@ -21,7 +21,7 @@ struct kv_pair kv_pairs[NUM_KV_PAIRS] = {{1,4},
static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) {
src_db = src_db;
(void) src_db;
uint32_t which = (uint32_t) (intptr_t) dest_db->app_private;
assert(which == 0);
......@@ -37,8 +37,8 @@ static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *de
}
static int poll_print(void *extra, float progress) {
progress = progress;
extra = extra;
(void) progress;
(void) extra;
if ( verbose ) printf("poll_print %f\n", progress);
return 0;
}
......
......@@ -21,7 +21,7 @@ struct kv_pair kv_pairs[NUM_KV_PAIRS] = {{1,4},
static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) {
src_db = src_db;
(void) src_db;
uint32_t which = (uint32_t) (intptr_t) dest_db->app_private;
assert(which == 0);
......@@ -37,8 +37,8 @@ static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *de
}
static int poll_print(void *extra, float progress) {
progress = progress;
extra = extra;
(void) progress;
(void) extra;
if ( verbose ) printf("poll_print %f\n", progress);
return 0;
}
......
......@@ -13,8 +13,7 @@
static int
put_callback(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_data, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; dest_data = dest_data; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) dest_data; (void) src_key; (void) src_data;
lazy_assert(src_db != NULL && dest_db != NULL);
if (dest_key->flags == DB_DBT_REALLOC) {
......
......@@ -13,7 +13,7 @@
static int
put_callback(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_data, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; dest_data = dest_data; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) dest_data; (void) src_key; (void) src_data;
lazy_assert(src_db != NULL && dest_db != NULL);
......
......@@ -21,7 +21,7 @@ struct kv_pair kv_pairs[NUM_KV_PAIRS] = {{1,4},
static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) {
src_db = src_db;
(void) src_db;
uint32_t which = (uint32_t) (intptr_t) dest_db->app_private;
......@@ -42,8 +42,8 @@ static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *de
}
static int poll_print(void *extra, float progress) {
progress = progress;
extra = extra;
(void) progress;
(void) extra;
if ( verbose ) printf("poll_print %f\n", progress);
return 0;
}
......
......@@ -7,8 +7,7 @@
static int
put_callback(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_data, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; dest_data = dest_data; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) dest_data; (void) src_key; (void) src_data;
lazy_assert(src_db != NULL && dest_db != NULL);
dest_key->data = toku_xmemdup(src_data->data, src_data->size);
......
......@@ -7,7 +7,7 @@
static int
put_callback(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_data, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; dest_data = dest_data; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) dest_data; (void) src_key; (void) src_data;
lazy_assert(src_db != NULL && dest_db != NULL);
......
......@@ -164,7 +164,7 @@ print_dbt(DBT *dbt) {
static int
put_callback(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_data, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; dest_data = dest_data; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) dest_data; (void) src_key; (void) src_data;
lazy_assert(src_db != NULL && dest_db != NULL);
......@@ -201,7 +201,7 @@ put_callback(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_data, const DBT *
static int
del_callback(DB *dest_db, DB *src_db, DBT *dest_key, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) src_key; (void) src_data;
lazy_assert(src_db != NULL && dest_db != NULL);
......
......@@ -92,7 +92,7 @@ static uint32_t UU() pkey_for_val(int key, int i) {
// for the handlerton's generate_row_for_put().
static int UU() put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) {
src_db = src_db;
(void) src_db;
uint32_t which = *(uint32_t*)dest_db->app_private;
......@@ -155,7 +155,7 @@ static int UU() poll_print(void *extra, float progress) {
last_progress = progress;
}
}
extra = extra;
(void) extra;
return 0;
}
......
......@@ -462,7 +462,7 @@ static unsigned int pkey_for_val(int key, int i) {
// for the handlerton's generate_row_for_put().
static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) {
src_db = src_db;
(void) src_db;
uint32_t which = *(uint32_t*)dest_db->app_private;
......
......@@ -91,7 +91,7 @@ static unsigned int pkey_for_val(int key, int i) {
// for the handlerton's generate_row_for_put().
static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) {
src_db = src_db;
(void) src_db;
uint32_t which = *(uint32_t*)dest_db->app_private;
......@@ -188,7 +188,7 @@ static void error_callback (DB *db, int which_db, int err, DBT *key, DBT *val, v
assert(which_db==0);
struct error_extra *e =(struct error_extra *)extra;
assert(e->bad_i == *(int*)key->data);
val=val;
(void)val;
assert(e->error_count==0);
e->error_count++;
}
......
......@@ -25,7 +25,7 @@ struct kv_pair kv_pairs[NUM_KV_PAIRS] = {{1,4},
static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) {
src_db = src_db;
(void) src_db;
uint32_t which = *(uint32_t*)dest_db->app_private;
assert(which == 0);
......
......@@ -26,7 +26,7 @@ static uint32_t block_size = 0;
static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) {
src_db = src_db;
(void) src_db;
uint32_t which = *(uint32_t*)dest_db->app_private;
assert(which == 0);
......
......@@ -169,7 +169,7 @@ static unsigned int pkey_for_val(int key, int i) {
// for the handlerton's generate_row_for_put().
static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) {
src_db = src_db;
(void) src_db;
uint32_t which = *(uint32_t*)dest_db->app_private;
......
......@@ -177,7 +177,7 @@ static unsigned int pkey_for_val(int key, int i) {
// for the handlerton's generate_row_for_put().
static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) {
src_db = src_db;
(void) src_db;
uint32_t which = *(uint32_t*)dest_db->app_private;
......
......@@ -97,8 +97,8 @@ static int generate_rows_for_region(DB *dest_db, DB *src_db, DBT *dest_key, DBT
{
// not used
src_db = src_db;
src_key = src_key;
(void) src_db;
(void) src_key;
assert(*(uint32_t*)dest_db->app_private == 0);
// region fields
......@@ -148,8 +148,8 @@ static int generate_rows_for_region(DB *dest_db, DB *src_db, DBT *dest_key, DBT
static int generate_rows_for_lineitem(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val)
{
// not used
src_db = src_db;
src_key = src_key;
(void) src_db;
(void) src_key;
// lineitem fields
char orderkey[16];
......
......@@ -54,7 +54,7 @@ static void close_dbs (void) {
}
static long shuffle (long l, int i) {
i=i;
(void)i;
return l;
}
......
......@@ -22,7 +22,7 @@ get_data(int *v, int i, int ndbs) {
static int
put_callback(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_data, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; dest_data = dest_data; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) dest_data; (void) src_key; (void) src_data;
assert(src_db == NULL);
unsigned int dbnum;
......
......@@ -23,7 +23,7 @@ get_data(int *v, int i, int ndbs) {
static int
put_callback(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_data, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; dest_data = dest_data; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) dest_data; (void) src_key; (void) src_data;
assert(src_db == NULL);
unsigned int dbnum;
......
......@@ -23,7 +23,7 @@ get_data(int *v, int i, int ndbs) {
static int
put_callback(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_data, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; dest_data = dest_data; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) dest_data; (void) src_key; (void) src_data;
assert(src_db != NULL);
unsigned int dbnum;
......
......@@ -23,7 +23,7 @@ get_data(int *v, int i, int ndbs) {
static int
put_callback(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_data, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; dest_data = dest_data; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) dest_data; (void) src_key; (void) src_data;
assert(src_db == NULL);
unsigned int dbnum;
......
......@@ -7,7 +7,7 @@
static int
put_callback(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_data, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; dest_data = dest_data; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) dest_data; (void) src_key; (void) src_data;
lazy_assert(src_db != NULL && dest_db != NULL);
......
......@@ -225,7 +225,7 @@ static unsigned int generate_val(int key, int i) {
// for the handlerton's generate_row_for_put().
static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) {
src_db = src_db;
(void) src_db;
uint32_t which = *(uint32_t*)dest_db->app_private;
......
......@@ -23,7 +23,7 @@ get_data(int *v, int i, int ndbs) {
static int
put_callback(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_data, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; dest_data = dest_data; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) dest_data; (void) src_key; (void) src_data;
assert(src_db == NULL);
unsigned int dbnum;
......
......@@ -23,7 +23,7 @@ get_data(int *v, int i, int ndbs) {
static int
put_callback(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_data, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; dest_data = dest_data; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) dest_data; (void) src_key; (void) src_data;
assert(src_db == NULL);
unsigned int dbnum;
......
......@@ -26,7 +26,7 @@ static void test_checkpoint_callback(void *extra) {
}
static void test_checkpoint_callback2(void *extra) {
extra = extra;
(void) extra;
}
static void run_test (bool do_commit, bool do_abort) {
......@@ -63,7 +63,7 @@ static void run_test (bool do_commit, bool do_abort) {
}
static void run_recover (bool did_commit) {
did_commit = did_commit;
(void) did_commit;
int r;
DB_ENV *env = NULL;
r = db_env_create(&env, 0); CKERR(r);
......
......@@ -30,7 +30,7 @@ DB_TXN *child;
// for the handlerton's generate_row_for_put().
static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) {
src_db = src_db;
(void) src_db;
uint32_t which = *(uint32_t*)dest_db->app_private;
......
......@@ -30,7 +30,7 @@ DB_TXN *child;
// for the handlerton's generate_row_for_put().
static int put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) {
src_db = src_db;
(void) src_db;
uint32_t which = *(uint32_t*)dest_db->app_private;
......
......@@ -38,7 +38,7 @@ get_new_data(int *v, int i, int ndbs) {
static int
put_callback(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_data, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; dest_data = dest_data; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) dest_data; (void) src_key; (void) src_data;
assert(src_db == NULL);
unsigned int dbnum;
......
......@@ -38,7 +38,7 @@ get_new_data(int *v, int i, int ndbs) {
static int
put_callback(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_data, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; dest_data = dest_data; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) dest_data; (void) src_key; (void) src_data;
assert(src_db == NULL);
unsigned int dbnum;
......
......@@ -151,8 +151,8 @@ check_results(DB_ENV *env, DB **dbs, const int num_dbs, const int num_rows)
static int UU()
put_multiple_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val, void *extra) {
src_db = src_db;
extra = extra;
(void) src_db;
(void) extra;
uint32_t which = *(uint32_t*)dest_db->app_private;
......
......@@ -36,7 +36,7 @@ get_new_data(int *v, int i, int ndbs) {
static int
put_callback(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_data, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; dest_data = dest_data; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) dest_data; (void) src_key; (void) src_data;
unsigned int dbnum;
assert(dest_db->descriptor->dbt.size == sizeof dbnum);
......
......@@ -21,7 +21,7 @@ get_data(int *v, int i, int ndbs) {
static int
put_callback(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_data, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; dest_data = dest_data; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) dest_data; (void) src_key; (void) src_data;
unsigned int dbnum;
assert(dest_db->descriptor->dbt.size == sizeof dbnum);
......
......@@ -21,7 +21,7 @@ get_data(int *v, int i, int ndbs) {
static int
put_callback(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_data, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; dest_data = dest_data; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) dest_data; (void) src_key; (void) src_data;
unsigned int dbnum;
assert(dest_db->descriptor->dbt.size == sizeof dbnum);
......
......@@ -36,7 +36,7 @@ get_new_data(int *v, int i, int ndbs) {
static int
put_callback(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_data, const DBT *src_key, const DBT *src_data) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; dest_data = dest_data; src_key = src_key; src_data = src_data;
(void) dest_db; (void) src_db; (void) dest_key; (void) dest_data; (void) src_key; (void) src_data;
unsigned int dbnum;
assert(dest_db->descriptor->dbt.size == sizeof dbnum);
......
......@@ -485,8 +485,7 @@ toku_txn_begin(DB_ENV *env, DB_TXN * stxn, DB_TXN ** txn, uint32_t flags) {
}
void toku_keep_prepared_txn_callback (DB_ENV *env, TOKUTXN tokutxn) {
struct __toku_db_txn_external *XMALLOC(eresult);
memset(eresult, 0, sizeof(*eresult));
struct __toku_db_txn_external *XCALLOC(eresult);
DB_TXN *result = &eresult->external_part;
result->mgrp = env;
txn_func_init(result);
......@@ -494,13 +493,12 @@ void toku_keep_prepared_txn_callback (DB_ENV *env, TOKUTXN tokutxn) {
result->parent = NULL;
#if !TOKUDB_NATIVE_H
MALLOC(db_txn_struct_i(result));
CALLOC(db_txn_struct_i(result));
if (!db_txn_struct_i(result)) {
toku_free(result);
return ENOMEM;
}
#endif
memset(db_txn_struct_i(result), 0, sizeof *db_txn_struct_i(result));
{
int r = toku_lth_create(&db_txn_struct_i(result)->lth);
......@@ -511,6 +509,7 @@ void toku_keep_prepared_txn_callback (DB_ENV *env, TOKUTXN tokutxn) {
toku_txn_set_container_db_txn(tokutxn, result);
toku_mutex_init(&db_txn_struct_i(result)->txn_mutex, NULL);
(void) __sync_fetch_and_add(&env->i->open_txns, 1);
}
......
......@@ -19,6 +19,7 @@
#cmakedefine HAVE_LIMITS_H 1
#cmakedefine HAVE_MACHINE_ENDIAN_H 1
#cmakedefine HAVE_MALLOC_H 1
#cmakedefine HAVE_MALLOC_MALLOC_H 1
#cmakedefine HAVE_PTHREAD_H 1
#cmakedefine HAVE_STDINT_H 1
#cmakedefine HAVE_STDLIB_H 1
......
......@@ -10,8 +10,7 @@ foreach(util ${utils})
add_executable(${util}_static ${util})
set_target_properties(${util}_static PROPERTIES
COMPILE_DEFINITIONS "IS_TDB=1;USE_TDB=1;TDB_IS_STATIC=1")
target_link_libraries(${util}_static ${LIBTOKUDB}_static lock_tree_static range_tree_static ft_static z lzma ${LIBTOKUPORTABILITY}_static ${CMAKE_THREAD_LIBS_INIT} dl)
set_targets_need_intel_libs(${util}_static)
target_link_libraries(${util}_static ${LIBTOKUDB}_static z lzma ${LIBTOKUPORTABILITY}_static ${CMAKE_THREAD_LIBS_INIT} dl)
add_common_options_to_binary_targets(${util} ${util}_static)
......@@ -22,7 +21,6 @@ foreach(util ${utils})
set_target_properties(${util}.bdb PROPERTIES
INCLUDE_DIRECTORIES "${BDB_INCLUDE_DIR};${CMAKE_CURRENT_BINARY_DIR}/../toku_include;${CMAKE_CURRENT_SOURCE_DIR}/../toku_include;${CMAKE_CURRENT_SOURCE_DIR}/../portability;${CMAKE_CURRENT_SOURCE_DIR}/..")
target_link_libraries(${util}.bdb ${LIBTOKUPORTABILITY} ${BDB_LIBRARIES})
set_targets_need_intel_libs(${util}.bdb)
add_common_options_to_binary_targets(${util}.bdb)
endif()
endforeach(util)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment