Commit e27437d2 authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

[t:4871] really turn on -Werror, make things compile with it

git-svn-id: file:///svn/toku/tokudb@43473 c7de825b-a66e-492c-adef-691d508d4ae1
parent a0b3a343
......@@ -160,5 +160,4 @@ endif()
list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
"xz-4.999.9beta/src/liblzma" # don't complain about warnings in xz source
"tokudb/portability/tests/test-rwlock.c" # non-static functions seem to be on purpose
)
......@@ -58,15 +58,16 @@ endfunction(maybe_add_gcov_to_libraries)
include(CheckCCompilerFlag)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
## adds a compiler flag if the compiler supports it
function(set_cflags_if_supported)
macro(set_cflags_if_supported)
foreach(flag ${ARGN})
check_c_compiler_flag(${flag} HAVE_${flag})
if (HAVE_${flag})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
endif ()
endforeach(flag)
endfunction(set_cflags_if_supported)
endmacro(set_cflags_if_supported)
## disable some warnings
set_cflags_if_supported(
......@@ -115,15 +116,11 @@ if (CMAKE_C_COMPILER_ID MATCHES Intel)
## set icc warnings
set(WARN_CFLAGS
-Wall
-Werror
-Wcheck ## icc version of -Wextra
)
else()
## set gcc warnings
set(WARN_CFLAGS
-Wall
-Werror
-Wextra
-Wcast-align
-Wbad-function-cast
......
......@@ -164,7 +164,6 @@ int toku_logcursor_create(TOKULOGCURSOR *lc, const char *log_dir) {
}
int toku_logcursor_create_for_file(TOKULOGCURSOR *lc, const char *log_dir, const char *log_file) {
int failresult = 0;
int r = lc_create(lc, log_dir);
if ( r!=0 )
return r;
......
......@@ -238,7 +238,6 @@ toku_logger_close_rollback(TOKULOGGER logger, BOOL recovery_failed) {
assert(!h->dirty); // it should not have been dirtied by the toku_brt_is_empty test.
}
char *error_string_ignore = NULL;
r = toku_brt_close(brt_to_close, FALSE, ZERO_LSN);
//Set as dealt with already.
logger->rollback_cachefile = NULL;
......
#include "test.h"
#include "logfilemgr.h"
int test_main(int argc, const char *argv[]) {
int test_main(int argc __attribute__((unused)), const char *argv[] __attribute__((unused))) {
int r;
TOKULOGFILEMGR lfm = NULL;
......
#include "test.h"
#include "logfilemgr.h"
int test_main(int argc, const char *argv[]) {
int test_main(int argc __attribute__((unused)), const char *argv[] __attribute__((unused))) {
int r;
TOKULOGFILEMGR lfm = NULL;
......
......@@ -93,7 +93,7 @@ void sequential_consistency (void) {
// That's probably good enough for us, since we'll have a barrier instruction anywhere it matters.
volatile int val = 0;
/* not static */
static
void time_nop (void) {
struct timeval start,end;
for (int t=0; t<T; t++) {
......@@ -113,7 +113,7 @@ void time_nop (void) {
}
}
/* not static */
static
void time_fcall (void) {
struct timeval start,end;
for (int t=0; t<T; t++) {
......@@ -129,15 +129,15 @@ void time_fcall (void) {
}
}
/* not static */
static
void time_cas (void) {
volatile int64_t val = 0;
volatile int64_t myval = 0;
struct timeval start,end;
for (int t=0; t<T; t++) {
gettimeofday(&start, NULL);
for (int i=0; i<N; i++) {
{ int r = __sync_val_compare_and_swap(&val, 0, 1); assert(r==0); }
{ int r = __sync_val_compare_and_swap(&val, 1, 0); assert(r==1); }
{ int r = __sync_val_compare_and_swap(&myval, 0, 1); assert(r==0); }
{ int r = __sync_val_compare_and_swap(&myval, 1, 0); assert(r==1); }
}
gettimeofday(&end, NULL);
double diff = 1e9*toku_tdiff(&end, &start)/N;
......@@ -148,7 +148,7 @@ void time_cas (void) {
}
/* not static */
static
void time_pthread_mutex (void) {
pthread_mutex_t mutex;
{ int r = pthread_mutex_init(&mutex, NULL); assert(r==0); }
......@@ -170,7 +170,7 @@ void time_pthread_mutex (void) {
{ int r = pthread_mutex_destroy(&mutex); assert(r==0); }
}
/* not static */
static
void time_pthread_rwlock (void) {
pthread_rwlock_t mutex;
{ int r = pthread_rwlock_init(&mutex, NULL); assert(r==0); }
......@@ -205,7 +205,7 @@ static void newbrt_rwlock_unlock (RWLOCK rwlock, toku_pthread_mutex_t *mutex) {
}
// Time the read lock that's in newbrt/rwlock.h
/* not static */
static
void time_newbrt_rwlock (void) {
struct rwlock rwlock;
toku_pthread_mutex_t external_mutex;
......@@ -232,7 +232,7 @@ void time_newbrt_rwlock (void) {
}
// Time the read lock that's in newbrt/rwlock.h, assuming the mutex is already held.
/* not static*/
static
void time_newbrt_prelocked_rwlock (void) {
struct rwlock rwlock;
toku_pthread_mutex_t external_mutex;
......@@ -260,7 +260,7 @@ void time_newbrt_prelocked_rwlock (void) {
{ int r = pthread_mutex_destroy(&external_mutex); assert(r==0); }
}
/* not static*/
static
void time_toku_fair_rwlock (void) {
toku_fair_rwlock_t mutex;
{ int r = toku_fair_rwlock_init(&mutex); assert(r==0); }
......@@ -282,7 +282,7 @@ void time_toku_fair_rwlock (void) {
{ int r = toku_fair_rwlock_destroy(&mutex); assert(r==0); }
}
/* not static*/
static
void time_toku_cv_fair_rwlock (void) {
toku_cv_fair_rwlock_t mutex;
{ int r = toku_cv_fair_rwlock_init(&mutex); assert(r==0); }
......
......@@ -24,6 +24,7 @@
#include "ydb_load.h"
#include <newbrt/checkpoint.h>
#include <newbrt/brt-internal.h>
#include <newbrt/brt_header.h>
#include "ydb_db.h"
......
......@@ -9,12 +9,6 @@
#include "test.h"
static void sortit(txnid_set *txns) {
size_t n = txnid_set_size(txns);
for (size_t i = 1; i < n; i++)
assert(txnid_set_get(txns, i) > txnid_set_get(txns, i-1));
}
int main(int argc, const char *argv[]) {
int r;
......@@ -53,8 +47,6 @@ int main(int argc, const char *argv[]) {
DBT key_l; dbt_init(&key_l, "L", 1);
txnid_set conflicts;
const TXNID txn_a = 1;
toku_lock_request a_r_t; toku_lock_request_init(&a_r_t, txn_a, toku_lt_neg_infinity, toku_lt_infinity, LOCK_REQUEST_READ);
......
......@@ -34,6 +34,7 @@ const char *toku_copyright_string = "Copyright (c) 2007-2009 Tokutek Inc. All r
#include "ydb_load.h"
#include <newbrt/brtloader.h>
#include <newbrt/log_header.h>
#include <newbrt/brt_header.h>
#include "ydb_cursor.h"
#include "ydb_row_lock.h"
#include "ydb_env_func.h"
......
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