Commit 97f4c9ad authored by Yoni Fogel's avatar Yoni Fogel

Removed all warnings.

git-svn-id: file:///svn/tokudb@2020 c7de825b-a66e-492c-adef-691d508d4ae1
parent f42468b2
...@@ -16,12 +16,9 @@ else ...@@ -16,12 +16,9 @@ else
GCOV_FLAGS = GCOV_FLAGS =
endif endif
CFLAGS = -W -Wall -Werror -fPIC $(OPTFLAGS) $(GCOV_FLAGS) CFLAGS = -W -Wall -Wextra -Werror -fPIC $(OPTFLAGS) $(GCOV_FLAGS)
CFLAGS += -Wbad-function-cast -Wcast-align -Wconversion -Waggregate-return CFLAGS += -Wbad-function-cast -Wcast-align -Wconversion -Waggregate-return
CFLAGS += -Wmissing-noreturn -Wmissing-format-attribute CFLAGS += -Wmissing-noreturn -Wmissing-format-attribute -Wunreachable-code
ifneq ($(W),)
CFLAGS+= -Wunreachable-code
endif
CPPFLAGS = -I../../include -I../../newbrt CPPFLAGS = -I../../include -I../../newbrt
CPPFLAGS += -D_GNU_SOURCE -D_THREAD_SAFE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE CPPFLAGS += -D_GNU_SOURCE -D_THREAD_SAFE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
......
...@@ -22,7 +22,9 @@ endif ...@@ -22,7 +22,9 @@ endif
LIBNAME=librt.$(LIBEXT) LIBNAME=librt.$(LIBEXT)
# GCOV_FLAGS = -fprofile-arcs -ftest-coverage # GCOV_FLAGS = -fprofile-arcs -ftest-coverage
CFLAGS = -Wall -Werror $(OPTFLAGS) -g3 -ggdb3 $(GCOV_FLAGS) CFLAGS = -Wall -Wextra -Werror $(OPTFLAGS) -g3 -ggdb3 $(GCOV_FLAGS)
CFLAGS += -Wbad-function-cast -Wcast-align -Wconversion -Waggregate-return
CFLAGS += -Wmissing-noreturn -Wmissing-format-attribute -Wunreachable-code
CPPFLAGS += -L../ -I../ -I../../../newbrt -I../../../include -lpthread CPPFLAGS += -L../ -I../ -I../../../newbrt -I../../../include -lpthread
......
...@@ -22,7 +22,7 @@ int main(int argc, const char *argv[]) { ...@@ -22,7 +22,7 @@ int main(int argc, const char *argv[]) {
unsigned found; unsigned found;
toku_range* buf = (toku_range*)toku_malloc(2*sizeof(toku_range)); toku_range* buf = (toku_range*)toku_malloc(2*sizeof(toku_range));
unsigned bufsize = 2; unsigned bufsize = 2;
int i; unsigned i;
parse_args(argc, argv); parse_args(argc, argv);
......
...@@ -154,7 +154,9 @@ void tests(BOOL allow_overlaps) { ...@@ -154,7 +154,9 @@ void tests(BOOL allow_overlaps) {
} }
int main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
int i; parse_args(argc, argv);
unsigned i;
for (i = 0; i < sizeof(nums) / sizeof(nums[0]); i++) nums[i] = i; for (i = 0; i < sizeof(nums) / sizeof(nums[0]); i++) nums[i] = i;
buflen = 2; buflen = 2;
buf = (toku_range*)toku_malloc(2 * sizeof(toku_range)); buf = (toku_range*)toku_malloc(2 * sizeof(toku_range));
......
...@@ -154,6 +154,8 @@ void tests(BOOL allow_overlaps) { ...@@ -154,6 +154,8 @@ void tests(BOOL allow_overlaps) {
} }
int main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
parse_args(argc, argv);
buflen = 2; buflen = 2;
buf = (toku_range*)toku_malloc(2 * sizeof(toku_range)); buf = (toku_range*)toku_malloc(2 * sizeof(toku_range));
tests(FALSE); tests(FALSE);
......
...@@ -13,14 +13,15 @@ void verify_all_overlap(toku_range* query, toku_range* list, unsigned listlen) { ...@@ -13,14 +13,15 @@ void verify_all_overlap(toku_range* query, toku_range* list, unsigned listlen) {
} }
int nums[64 << 3]; int nums[64 << 3];
const int numlen = sizeof(nums) / sizeof(nums[0]); const size_t numlen = sizeof(nums) / sizeof(nums[0]);
char letters[2] = {'A','B'}; char letters[2] = {'A','B'};
toku_range_tree *tree; toku_range_tree *tree;
toku_range* buf; toku_range* buf;
unsigned buflen; unsigned buflen;
toku_range* init_range(toku_range* range, int left, int right, int data) { toku_range* init_range(toku_range* range, unsigned left, unsigned right,
int data) {
range->left = &nums[left]; range->left = &nums[left];
range->right = &nums[right]; range->right = &nums[right];
if (data < 0) range->data = NULL; if (data < 0) range->data = NULL;
...@@ -28,14 +29,15 @@ toku_range* init_range(toku_range* range, int left, int right, int data) { ...@@ -28,14 +29,15 @@ toku_range* init_range(toku_range* range, int left, int right, int data) {
return range; return range;
} }
void setup_tree(BOOL allow_overlaps, BOOL insert, int left, int right, int data) { void setup_tree(BOOL allow_overlaps, BOOL insert,
unsigned left, unsigned right, unsigned data) {
int r; int r;
toku_range range; toku_range range;
r = toku_rt_create(&tree, int_cmp, char_cmp, allow_overlaps, malloc, free, realloc); r = toku_rt_create(&tree, int_cmp, char_cmp, allow_overlaps, malloc, free, realloc);
CKERR(r); CKERR(r);
if (insert) { if (insert) {
r = toku_rt_insert(tree, init_range(&range, left, right, data)); r = toku_rt_insert(tree, init_range(&range, left, right, (int)data));
CKERR(r); CKERR(r);
} }
} }
...@@ -100,7 +102,9 @@ void tests(BOOL allow_overlaps) { ...@@ -100,7 +102,9 @@ void tests(BOOL allow_overlaps) {
} }
int main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
int i; parse_args(argc, argv);
unsigned i;
for (i = 0; i < sizeof(nums) / sizeof(nums[0]); i++) nums[i] = i; for (i = 0; i < sizeof(nums) / sizeof(nums[0]); i++) nums[i] = i;
buflen = 2; buflen = 2;
buf = (toku_range*)toku_malloc(2 * sizeof(toku_range)); buf = (toku_range*)toku_malloc(2 * sizeof(toku_range));
......
...@@ -25,8 +25,7 @@ toku_range* init_range(toku_range* range, int left, int right, int data) { ...@@ -25,8 +25,7 @@ toku_range* init_range(toku_range* range, int left, int right, int data) {
return range; return range;
} }
void* init_point(int left) { void* init_point(unsigned left) {
assert(left >= 0);
assert(left < sizeof(nums) / sizeof(nums[0])); assert(left < sizeof(nums) / sizeof(nums[0]));
return (&nums[left]); return (&nums[left]);
} }
...@@ -77,13 +76,13 @@ void runlimitsearch(toku_range* query, unsigned limit, unsigned findexpect) { ...@@ -77,13 +76,13 @@ void runlimitsearch(toku_range* query, unsigned limit, unsigned findexpect) {
typedef enum {PRED=0, SUCC=1} predsucc; typedef enum {PRED=0, SUCC=1} predsucc;
void runtest(predsucc testtype, void* query, BOOL findexpect, void runtest(predsucc testtype, void* query, BOOL findexpect,
int left, int right, int data) { unsigned left, unsigned right, unsigned data) {
int r; int r;
BOOL found; BOOL found;
toku_range out; toku_range out;
assert(data >= 0 && data < sizeof(letters) / sizeof(letters[0])); assert(data < sizeof(letters) / sizeof(letters[0]));
assert(left >= 0 && left < sizeof(nums) / sizeof(nums[0])); assert(left < sizeof(nums) / sizeof(nums[0]));
assert(right >= 0 && right < sizeof(nums) / sizeof(nums[0])); assert(right < sizeof(nums) / sizeof(nums[0]));
if (testtype == PRED) { if (testtype == PRED) {
r = toku_rt_predecessor(tree, query, &out, &found); r = toku_rt_predecessor(tree, query, &out, &found);
...@@ -258,7 +257,9 @@ void tests(BOOL allow_overlaps) { ...@@ -258,7 +257,9 @@ void tests(BOOL allow_overlaps) {
} }
int main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
int i; parse_args(argc, argv);
unsigned i;
for (i = 0; i < sizeof(nums) / sizeof(nums[0]); i++) nums[i] = i; for (i = 0; i < sizeof(nums) / sizeof(nums[0]); i++) nums[i] = i;
buflen = 2; buflen = 2;
......
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