Commit 4267767f authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul Committed by Yoni Fogel

Get rid of some compiler warnings. brt-test runs under valgrind. Addresses #1185.

git-svn-id: file:///svn/tokudb.1131b+1080a+1185@6374 c7de825b-a66e-492c-adef-691d508d4ae1
parent 0d2788eb
......@@ -31,8 +31,8 @@ FPICFLAGS = -fPIC
# valgrind is not present on cygwin
VGRIND = valgrind --quiet --error-exitcode=1 --leak-check=yes
VISIBILITY=-fvisibility=hidden
SHADOW=-Wshadow
ifneq ($(CC),icc)
SHADOW=-Wshadow
FORMAT=-Wmissing-format-attribute
endif
endif
......@@ -42,10 +42,10 @@ ifneq ($(CC),icc)
CFLAGS += -Werror -Wextra -Wcast-align -Wbad-function-cast -Wmissing-noreturn -g3 -ggdb3
else
CFLAGS += -g
CFLAGS += -diag-disable 177 # Don't complain about static variables that are not used.
CFLAGS += -diag-disable 1324 # Don't complain about rdtsc clobbering its registers more than once.
CFLAGS += -diag-disable 981 # Don't complain about "operands are evaluated in unspecified order". This seems to be generated whenever more than one argument to a function or operand is computed by function call.
CFLAGS += -diag-disable 589 # Don't complain about goto into a block that skips initializing variables. GCC catches the actual uninitialized variables.
CFLAGS += -diag-disable 177 # Don't complain about static variables that are not used.
CFLAGS += -diag-disable 589 # Don't complain about goto into a block that skips initializing variables. GCC catches the actual uninitialized variables.
CFLAGS += -diag-disable 981 # Don't complain about "operands are evaluated in unspecified order". This seems to be generated whenever more than one argument to a function or operand is computed by function call.
CFLAGS += -diag-disable 1324 # Don't complain about rdtsc clobbering its registers more than once.
endif
LDFLAGS = $(OPTFLAGS) -g $(GCOV_FLAGS) $(PROF_FLAGS) -lz -lpthread
CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=500
......
......@@ -52,6 +52,7 @@ static void maybe_preallocate_in_file (int fd, u_int64_t size) {
assert(start_write >= sbuf.st_size);
ssize_t r = pwrite(fd, wbuf, N, start_write);
assert(r==N);
toku_free(wbuf);
}
}
......
......@@ -28,11 +28,20 @@ FPICFLAGS = -fPIC
# valgrind is not present on cygwin
VGRIND = valgrind --quiet --error-exitcode=1 --leak-check=yes --suppressions=../valgrind.suppressions
VISIBILITY=-fvisibility=hidden
SHADOW=-Wshadow
FORMAT=-Wmissing-format-attribute
ifneq ($(CC),icc)
SHADOW=-Wshadow
FORMAT=-Wmissing-format-attribute
endif
endif
CFLAGS = -Wall -Wextra -Wcast-align -Wbad-function-cast -Wmissing-noreturn $(FORMAT) $(OPTFLAGS) -g3 -ggdb3 $(GCOV_FLAGS) $(PROF_FLAGS) $(FPICFLAGS) $(SHADOW) $(VISIBILITY)
CFLAGS = -Wall $(FORMAT) $(OPTFLAGS) $(GCOV_FLAGS) $(PROF_FLAGS) $(FPICFLAGS) $(SHADOW) $(VISIBILITY)
ifneq ($(CC),icc)
CFLAGS += -Wextra -Wcast-align -Wbad-function-cast -Wmissing-noreturn -g3 -ggdb3
else
CFLAGS += -g
CFLAGS += -diag-disable 177 # Don't complain about static variables that are not used.
CFLAGS += -diag-disable 981 # Don't complain about "operands are evaluated in unspecified order". This seems to be generated whenever more than one argument to a function or operand is computed by function call.
endif
LDFLAGS = $(OPTFLAGS) -g $(GCOV_FLAGS) $(PROF_FLAGS) -lpthread -lz
CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -I..
......
......@@ -501,10 +501,10 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) {
r = toku_open_brt(fname, 0, 1, &brt, 1<<20, ct, null_txn, wrong_p ? wrong_compare_fun : toku_default_compare_fun, &nonce_db); assert(r==0);
for (i=1; i<257; i+=255) {
unsigned char a[4],b[4];
b[3] = a[0] = i&255;
b[2] = a[1] = (i>>8)&255;
b[1] = a[2] = (i>>16)&255;
b[0] = a[3] = (i>>24)&255;
b[3] = a[0] = (unsigned char)(i&255);
b[2] = a[1] = (unsigned char)((i>>8)&255);
b[1] = a[2] = (unsigned char)((i>>16)&255);
b[0] = a[3] = (unsigned char)((i>>24)&255);
toku_fill_dbt(&kbt, a, sizeof(a));
toku_fill_dbt(&vbt, b, sizeof(b));
if (verbose)
......@@ -538,10 +538,10 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) {
for (i=0; i<N; i++) {
unsigned char a[4],b[4];
b[3] = a[0] = i&255;
b[2] = a[1] = (i>>8)&255;
b[1] = a[2] = (i>>16)&255;
b[0] = a[3] = (i>>24)&255;
b[3] = a[0] = (unsigned char)(i&255);
b[2] = a[1] = (unsigned char)((i>>8)&255);
b[1] = a[2] = (unsigned char)((i>>16)&255);
b[0] = a[3] = (unsigned char)((i>>24)&255);
toku_fill_dbt(&kbt, a, sizeof(a));
toku_fill_dbt(&vbt, b, sizeof(b));
if (0) printf("%s:%d insert: %02x%02x%02x%02x -> %02x%02x%02x%02x\n", __FILE__, __LINE__,
......@@ -986,7 +986,7 @@ static void test_brt_delete() {
test_insert_delete_lookup(512); toku_memory_check_all_free();
}
static void test_new_brt_cursor_create_close() {
static void test_new_brt_cursor_create_close (void) {
int r;
BRT brt=0;
int n = 8;
......@@ -1420,7 +1420,7 @@ static void test_new_brt_cursor_set(int n, int cursor_op, DB *db) {
}
static void test_new_brt_cursors(int dup_mode) {
test_new_brt_cursor_create_close(dup_mode); toku_memory_check_all_free();
test_new_brt_cursor_create_close(); toku_memory_check_all_free();
test_new_brt_cursor_first(8, dup_mode); toku_memory_check_all_free();
test_new_brt_cursor_last(8, dup_mode); toku_memory_check_all_free();
test_new_brt_cursor_last(512, dup_mode); toku_memory_check_all_free();
......@@ -1430,7 +1430,7 @@ static void test_new_brt_cursors(int dup_mode) {
test_new_brt_cursor_next(512, dup_mode); toku_memory_check_all_free();
test_new_brt_cursor_set_range(512, dup_mode); toku_memory_check_all_free();
test_new_brt_cursor_set(512, DB_SET, 0); toku_memory_check_all_free();
};
}
static void brt_blackbox_test (void) {
toku_memory_check = 1;
......
......@@ -4,7 +4,8 @@
int verbose=0;
void default_parse_args (int argc, const char *argv[]) {
static void
default_parse_args (int argc, const char *argv[]) {
const char *progname=argv[0];
argc--; argv++;
while (argc>0) {
......
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