Commit 1db6edfa authored by Yoni Fogel's avatar Yoni Fogel

Addresses #1976 refs[t:1976] Add warnings for code hygiene that windows compiler requires.

Cleaned up code to remove warnings.

git-svn-id: file:///svn/toku/tokudb@14306 c7de825b-a66e-492c-adef-691d508d4ae1
parent 221739e6
......@@ -65,7 +65,7 @@ void test_reverse_compare(int n, int dup_flags) {
int i;
system("rm -rf " DIR);
mkdir(DIR, 0777);
toku_os_mkdir(DIR, 0777);
/* create the dup database file */
db = new Db(null_env, 0);
......
......@@ -107,7 +107,7 @@ static void biginsert (long long n_elements, struct timeval *starttime) {
}
}
static void usage() {
static void usage(void) {
printf("benchmark-test [OPTIONS] [ITERATIONS]\n");
printf("[-v]\n");
printf("[-q]\n");
......
......@@ -483,7 +483,7 @@ static void test_large_kv(int bsize, int ksize, int vsize) {
* test the key and value limits
* the current implementation crashes when kvsize == bsize/2 rather than fails
*/
static void test_brt_limits() {
static void test_brt_limits(void) {
int bsize = 1024;
int kvsize = 4;
while (kvsize < bsize/2) {
......@@ -495,7 +495,7 @@ static void test_brt_limits() {
/*
* verify that a delete on an empty tree fails
*/
static void test_brt_delete_empty() {
static void test_brt_delete_empty(void) {
if (verbose) printf("test_brt_delete_empty\n");
BRT t;
......@@ -840,7 +840,7 @@ static void test_brt_delete_both(int n) {
r = toku_cachetable_close(&ct); assert(r==0);
}
static void test_brt_delete() {
static void test_brt_delete(void) {
test_brt_delete_empty(); toku_memory_check_all_free();
test_brt_delete_present(1); toku_memory_check_all_free();
test_brt_delete_present(100); toku_memory_check_all_free();
......
......@@ -10,19 +10,19 @@
toku_pthread_mutex_t test_mutex;
static inline void test_mutex_init() {
static inline void test_mutex_init(void) {
int r = toku_pthread_mutex_init(&test_mutex, 0); assert(r == 0);
}
static inline void test_mutex_destroy() {
static inline void test_mutex_destroy(void) {
int r = toku_pthread_mutex_destroy(&test_mutex); assert(r == 0);
}
static inline void test_mutex_lock() {
static inline void test_mutex_lock(void) {
int r = toku_pthread_mutex_lock(&test_mutex); assert(r == 0);
}
static inline void test_mutex_unlock() {
static inline void test_mutex_unlock(void) {
int r = toku_pthread_mutex_unlock(&test_mutex); assert(r == 0);
}
......
......@@ -10,19 +10,19 @@
toku_pthread_mutex_t test_mutex;
static inline void test_mutex_init() {
static inline void test_mutex_init(void) {
int r = toku_pthread_mutex_init(&test_mutex, 0); assert(r == 0);
}
static inline void test_mutex_destroy() {
static inline void test_mutex_destroy(void) {
int r = toku_pthread_mutex_destroy(&test_mutex); assert(r == 0);
}
static inline void test_mutex_lock() {
static inline void test_mutex_lock(void) {
int r = toku_pthread_mutex_lock(&test_mutex); assert(r == 0);
}
static inline void test_mutex_unlock() {
static inline void test_mutex_unlock(void) {
int r = toku_pthread_mutex_unlock(&test_mutex); assert(r == 0);
}
......@@ -452,7 +452,7 @@ static int test_dirty_fetch(CACHEFILE f, CACHEKEY key, u_int32_t fullhash, void
return 0;
}
static void test_dirty() {
static void test_dirty(void) {
if (verbose) printf("test_dirty\n");
CACHETABLE t;
......@@ -577,7 +577,7 @@ static void test_size_flush_callback(CACHEFILE f,
}
}
static void test_size_resize() {
static void test_size_resize(void) {
if (verbose) printf("test_size_resize\n");
CACHETABLE t;
......@@ -633,7 +633,7 @@ static void test_size_resize() {
static int min2(int a, int b) { return a < b ? a : b; }
static void test_size_flush() {
static void test_size_flush(void) {
if (verbose) printf("test_size_flush\n");
CACHETABLE t;
......
......@@ -10,19 +10,19 @@
toku_pthread_mutex_t test_mutex;
static inline void test_mutex_init() {
static inline void test_mutex_init(void) {
int r = toku_pthread_mutex_init(&test_mutex, 0); assert(r == 0);
}
static inline void test_mutex_destroy() {
static inline void test_mutex_destroy(void) {
int r = toku_pthread_mutex_destroy(&test_mutex); assert(r == 0);
}
static inline void test_mutex_lock() {
static inline void test_mutex_lock(void) {
int r = toku_pthread_mutex_lock(&test_mutex); assert(r == 0);
}
static inline void test_mutex_unlock() {
static inline void test_mutex_unlock(void) {
int r = toku_pthread_mutex_unlock(&test_mutex); assert(r == 0);
}
......
......@@ -14,7 +14,7 @@
#define NUM_LOGGERS 10
TOKULOGGER logger[NUM_LOGGERS];
void setup_logger(int which) {
static void setup_logger(int which) {
char dnamewhich[200];
int r;
sprintf(dnamewhich, "%s_%d", dname, which);
......@@ -31,7 +31,7 @@ void setup_logger(int which) {
assert(r == 0);
}
void play_with_logger(int which) {
static void play_with_logger(int which) {
int r;
{
r = ml_lock(&logger[which]->input_lock);
......@@ -59,7 +59,7 @@ void play_with_logger(int which) {
}
}
void tear_down_logger(int which) {
static void tear_down_logger(int which) {
int r;
r = toku_logger_close(&logger[which]);
assert(r == 0);
......
#include <test.h>
int main() {
int main(void) {
int r;
toku_lock_tree* lt = NULL;
toku_ltm* mgr = NULL;
......
......@@ -7,7 +7,7 @@
#include <sys/stat.h>
#include <memory.h>
void do_1381_maybe_lock (int do_table_lock, u_int64_t *raw_count) {
static void do_1381_maybe_lock (int do_table_lock, u_int64_t *raw_count) {
int r;
DB_TXN * const null_txn = 0;
......@@ -78,7 +78,7 @@ void do_1381_maybe_lock (int do_table_lock, u_int64_t *raw_count) {
}
}
void
static void
do_1381 (void) {
int do_table_lock;
u_int64_t raw_counts[2];
......
......@@ -101,7 +101,7 @@ checkpoint_test_2(u_int32_t flags, u_int32_t n) {
// Purpose is to scribble over test db while checkpoint is
// in progress.
void checkpoint_callback_1(void * extra) {
static void checkpoint_callback_1(void * extra) {
DICTIONARY d = *(DICTIONARY*) extra;
int i;
char name[MAX_NAME*2];
......@@ -117,7 +117,7 @@ void checkpoint_callback_1(void * extra) {
}
void checkpoint_callback_2(void * extra) {
static void checkpoint_callback_2(void * extra) {
DICTIONARY d = *(DICTIONARY*) extra;
assert(d==test_dictionary);
char name[MAX_NAME*2];
......
......@@ -134,7 +134,7 @@ drop_dead(void) {
}
void
static void
verify_and_insert (DB* db, int iter) {
int64_t firstkey; // first key to verify/insert
......@@ -163,7 +163,7 @@ verify_and_insert (DB* db, int iter) {
// Purpose of this function is to perform a variety of random acts.
// This will simulate normal database operations. The idea is for the
// the crash to occur sometimes during an insert, sometimes during a query, etc.
void *
static void *
random_acts(void * d) {
void * intothevoid = NULL;
DICTIONARY dictionaries = (DICTIONARY) d;
......@@ -197,7 +197,7 @@ random_acts(void * d) {
u_int64_t max_windows_cachesize = 256 << 20;
void
static void
run_test (int iter, int die) {
u_int32_t flags = DB_DUP|DB_DUPSORT;
......
......@@ -66,7 +66,7 @@ checkpoint_truncate_test(u_int32_t flags, u_int32_t n) {
// Purpose is to truncate test db while checkpoint is
// in progress.
void *
static void *
truncate_thread(void * extra) {
DICTIONARY d = *(DICTIONARY*) extra;
char name[MAX_NAME*2];
......@@ -86,7 +86,7 @@ truncate_thread(void * extra) {
}
void checkpoint_callback_1(void * extra) {
static void checkpoint_callback_1(void * extra) {
int r = toku_pthread_create(&thread, 0, truncate_thread, extra);
CKERR(r);
}
......
......@@ -6,11 +6,11 @@
#include <pthread.h>
int x;
void *starta(void* ignore __attribute__((__unused__))) {
static void *starta(void* ignore __attribute__((__unused__))) {
x++;
return 0;
}
void *startb(void* ignore __attribute__((__unused__))) {
static void *startb(void* ignore __attribute__((__unused__))) {
x++;
return 0;
}
......
......@@ -13,7 +13,7 @@
DB_ENV *env;
DB *db;
void initialize (void) {
static void initialize (void) {
int r;
system("rm -rf " ENVDIR);
toku_os_mkdir(ENVDIR, 0777);
......@@ -51,13 +51,13 @@ void initialize (void) {
}
}
void finish (void) {
static void finish (void) {
int r;
r = db->close(db, 0); assert(r==0);
r = env->close(env, 0); assert(r==0);
}
void *starta(void* ignore __attribute__((__unused__))) {
static void *starta(void* ignore __attribute__((__unused__))) {
DB_TXN *txn = 0;
DBT key, val;
memset(&key, 0, sizeof(key));
......@@ -71,7 +71,7 @@ void *starta(void* ignore __attribute__((__unused__))) {
toku_free(val.data);
return 0;
}
void *startb(void* ignore __attribute__((__unused__))) {
static void *startb(void* ignore __attribute__((__unused__))) {
DB_TXN *txn = 0;
DBT key, val;
memset(&key, 0, sizeof(key));
......
......@@ -13,7 +13,7 @@
DB_ENV *env;
DB *db;
void initialize (void) {
static void initialize (void) {
int r;
system("rm -rf " ENVDIR);
toku_os_mkdir(ENVDIR, 0777);
......@@ -51,13 +51,13 @@ void initialize (void) {
}
}
void finish (void) {
static void finish (void) {
int r;
r = db->close(db, 0); assert(r==0);
r = env->close(env, 0); assert(r==0);
}
void *starta(void* ignore __attribute__((__unused__))) {
static void *starta(void* ignore __attribute__((__unused__))) {
DB_TXN *txn = 0;
DBT key, val;
char data[10];
......@@ -71,7 +71,7 @@ void *starta(void* ignore __attribute__((__unused__))) {
//printf("val.data=%p\n", val.data);
return 0;
}
void *startb(void* ignore __attribute__((__unused__))) {
static void *startb(void* ignore __attribute__((__unused__))) {
DB_TXN *txn = 0;
DBT key, val;
memset(&key, 0, sizeof(key));
......
......@@ -9,7 +9,7 @@
#error This test only works for TokuDB.
#endif
void mkfile (const char *fname) {
static void mkfile (const char *fname) {
mode_t mode = S_IRWXU|S_IRWXG|S_IRWXO;
int fd = open(fname, O_WRONLY | O_CREAT | O_BINARY, mode);
if (fd<0) perror("opening");
......@@ -18,7 +18,7 @@ void mkfile (const char *fname) {
r = close(fd); assert(r==0);
}
void
static void
do_1324 (int moreflags)
{
const char fname[] = ENVDIR "/__rolltmp.12345";
......
......@@ -7,7 +7,7 @@
DB_TXN *null_txn=0;
void do_test1753 (int do_create_on_reopen) {
static void do_test1753 (int do_create_on_reopen) {
if (IS_TDB==0 && DB_VERSION_MAJOR==4 && DB_VERSION_MINOR<7 && do_create_on_reopen==0) {
return; // do_create_on_reopen==0 segfaults in 4.6
......
......@@ -9,7 +9,7 @@ DB_TXN * const null_txn = 0;
const char * const fname = ENVDIR "/" "test_db_remove.brt";
void test_db_remove (void) {
static void test_db_remove (void) {
int r;
system("rm -rf " ENVDIR);
r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
......
......@@ -37,7 +37,7 @@ brealloc (void*p, size_t s)
return realloc(p,s);
}
void
static void
test1 (void)
{
DB_ENV *env=0;
......
......@@ -10,7 +10,7 @@
#include <db.h>
#include <toku_pthread.h>
static inline unsigned int getmyid() {
static inline unsigned int getmyid(void) {
return toku_os_gettid();
}
......
......@@ -124,7 +124,7 @@ verify_val(u_int8_t nest_level) {
}
static u_int8_t
randomize_no_placeholder_type() {
randomize_no_placeholder_type(void) {
int r;
r = random() % 2;
switch (r) {
......@@ -138,7 +138,7 @@ randomize_no_placeholder_type() {
}
static u_int8_t
randomize_type() {
randomize_type(void) {
int r;
do {
r = random() % 4;
......
......@@ -130,7 +130,7 @@ verify_val(u_int8_t nest_level) {
}
static u_int8_t
randomize_no_placeholder_type() {
randomize_no_placeholder_type(void) {
int r;
r = random() % 2;
switch (r) {
......@@ -144,7 +144,7 @@ randomize_no_placeholder_type() {
}
static u_int8_t
randomize_type() {
randomize_type(void) {
int r;
r = random() % 4;
switch (r) {
......
......@@ -80,11 +80,11 @@ ydb_getf_do_nothing(DBT const* UU(key), DBT const* UU(val), void* UU(extra)) {
/* the ydb reference is used to cleanup the library when there are no more references to it */
static int toku_ydb_refs = 0;
static inline void ydb_add_ref() {
static inline void ydb_add_ref(void) {
++toku_ydb_refs;
}
static inline void ydb_unref() {
static inline void ydb_unref(void) {
assert(toku_ydb_refs > 0);
if (--toku_ydb_refs == 0) {
/* call global destructors */
......
......@@ -96,7 +96,7 @@ WERROR =
else
WERROR = -Werror
endif
WALL = -Wall -Wextra -Wcast-align -Wbad-function-cast -Wno-missing-noreturn
WALL = -Wall -Wextra -Wcast-align -Wbad-function-cast -Wno-missing-noreturn -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
FORMAT = -Wmissing-format-attribute #-Wformat=2 #Stronger printf warnings once logger.c cleaned up
ifeq ($(SYSTEM),sunos)
......
......@@ -9,7 +9,7 @@
#define USE_RDTSC 1
static inline unsigned long long rdtsc() {
static inline unsigned long long rdtsc(void) {
unsigned long hi, lo;
__asm__ __volatile__ ("rdtsc\n"
"movl %%edx,%0\n"
......@@ -21,7 +21,7 @@ static inline unsigned long long rdtsc() {
#define USE_RDTSC 1
static inline unsigned long long rdtsc() {
static inline unsigned long long rdtsc(void) {
unsigned long long r;
__asm__ __volatile__ ("rdtsc\n"
"shl $32,%%rdx\n"
......
......@@ -95,14 +95,14 @@ typedef int64_t toku_off_t;
# pragma deprecated (malloc, free, realloc)
# endif
# else
int creat() __attribute__((__deprecated__));
int fstat() __attribute__((__deprecated__));
int stat() __attribute__((__deprecated__));
int getpid(void) __attribute__((__deprecated__));
long int syscall(long int __sysno, ...) __attribute__((__deprecated__));
int creat(const char *pathname, mode_t mode) __attribute__((__deprecated__));
int fstat(int fd, struct stat *buf) __attribute__((__deprecated__));
int stat(const char *path, struct stat *buf) __attribute__((__deprecated__));
int getpid(void) __attribute__((__deprecated__));
long int syscall(long int __sysno, ...) __attribute__((__deprecated__));
// Sadly, dlmalloc needs sysconf, and on linux this causes trouble with -combine. So let the warnings show up under windows only.
// long int sysconf(int) __attribute__((__deprecated__));
int mkdir() __attribute__((__deprecated__));
int mkdir(const char *pathname, mode_t mode) __attribute__((__deprecated__));
// strdup is a macro in some libraries.
#undef strdup
char* strdup(const char *) __attribute__((__deprecated__));
......
......@@ -184,7 +184,7 @@ error:
}
static inline int
verify_library_version()
verify_library_version(void)
{
int major;
int minor;
......
......@@ -278,7 +278,7 @@ static int usage()
return EXIT_FAILURE;
}
static u_int8_t randbyte()
static u_int8_t randbyte(void)
{
static u_int32_t numsavedbits = 0;
static u_int64_t savedbits = 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