add -ansi flag to gcc/g++, eliminate use of typeof()
This commit is contained in:
parent
330e3bf227
commit
4adc546a8e
6 changed files with 25 additions and 17 deletions
|
@ -168,8 +168,8 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/src/stasis)
|
||||||
|
|
||||||
IF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" )
|
IF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" )
|
||||||
SET(COMMON_LIBRARIES stasis m pthread stdc++ ${DBUG}) # profiler)
|
SET(COMMON_LIBRARIES stasis m pthread stdc++ ${DBUG}) # profiler)
|
||||||
SET(CMAKE_C_FLAGS "-g -Wall -pedantic -std=gnu99 -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}")
|
SET(CMAKE_C_FLAGS "-g -Wall -ansi -pedantic -std=gnu99 -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}")
|
||||||
SET(CMAKE_CXX_FLAGS "-g -Wall -Wno-long-long -pedantic -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}")
|
SET(CMAKE_CXX_FLAGS "-g -Wall -ansi -Wno-long-long -pedantic -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}")
|
||||||
ELSEIF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "SunPro" )
|
ELSEIF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "SunPro" )
|
||||||
SET(COMMON_LIBRARIES stasis m pthread Crun Cstd)
|
SET(COMMON_LIBRARIES stasis m pthread Crun Cstd)
|
||||||
SET(CMAKE_C_FLAGS "-g -xc99=all -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}")
|
SET(CMAKE_C_FLAGS "-g -xc99=all -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}")
|
||||||
|
|
|
@ -561,12 +561,12 @@ void run_test2(int engine, int multicolumn, unsigned int inserts,
|
||||||
column_count = 1;
|
column_count = 1;
|
||||||
switch(engine) {
|
switch(engine) {
|
||||||
case Rle<val_t>::PLUGIN_ID: {
|
case Rle<val_t>::PLUGIN_ID: {
|
||||||
run_test<Pstar<Rle<val_t>,val_t>,Rle<val_t>,typeof(begin),
|
run_test<Pstar<Rle<val_t>,val_t>,Rle<val_t>,ITER,
|
||||||
val_t,val_t>
|
val_t,val_t>
|
||||||
(inserts, column_count,buildTree,begin,end,INT_CMP,rowsize,scratch);
|
(inserts, column_count,buildTree,begin,end,INT_CMP,rowsize,scratch);
|
||||||
} break;
|
} break;
|
||||||
case For<val_t>::PLUGIN_ID: {
|
case For<val_t>::PLUGIN_ID: {
|
||||||
run_test<Pstar<For<val_t>,val_t>,For<val_t>,typeof(begin),
|
run_test<Pstar<For<val_t>,val_t>,For<val_t>,ITER,
|
||||||
val_t,val_t>
|
val_t,val_t>
|
||||||
(inserts, column_count,buildTree,begin,end,INT_CMP,rowsize,scratch);
|
(inserts, column_count,buildTree,begin,end,INT_CMP,rowsize,scratch);
|
||||||
} break;
|
} break;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
long stasis_log_reordering_usleep_after_flush = 0;
|
long stasis_log_reordering_usleep_after_flush = 0;
|
||||||
|
|
||||||
static void* stasis_log_reordering_handle_worker(void * a) {
|
static void* stasis_log_reordering_handle_worker(void * a) {
|
||||||
stasis_log_reordering_handle_t * h = (typeof(h))a;
|
stasis_log_reordering_handle_t * h = (stasis_log_reordering_handle_t*)a;
|
||||||
pthread_mutex_lock(&h->mut);
|
pthread_mutex_lock(&h->mut);
|
||||||
while(h->cur_len || !h->closed) {
|
while(h->cur_len || !h->closed) {
|
||||||
while(h->cur_len) {
|
while(h->cur_len) {
|
||||||
|
|
|
@ -204,7 +204,7 @@ void Tupdate(int xid, pageid_t page, const void * dat, size_t datlen, int op) {
|
||||||
|
|
||||||
void TreorderableUpdate(int xid, void * hp, pageid_t page,
|
void TreorderableUpdate(int xid, void * hp, pageid_t page,
|
||||||
const void *dat, size_t datlen, int op) {
|
const void *dat, size_t datlen, int op) {
|
||||||
stasis_log_reordering_handle_t * h = (typeof(h))hp;
|
stasis_log_reordering_handle_t * h = (stasis_log_reordering_handle_t *)hp;
|
||||||
assert(stasis_transaction_table_is_active(stasis_transaction_table, xid));
|
assert(stasis_transaction_table_is_active(stasis_transaction_table, xid));
|
||||||
Page * p = loadPage(xid, page);
|
Page * p = loadPage(xid, page);
|
||||||
assert(p);
|
assert(p);
|
||||||
|
|
|
@ -39,6 +39,8 @@ namespace rose {
|
||||||
|
|
||||||
template<class PAGELAYOUT, class ITERA, class ITERB>
|
template<class PAGELAYOUT, class ITERA, class ITERB>
|
||||||
struct merge_args {
|
struct merge_args {
|
||||||
|
typedef typename ITERB::handle IN_HANDLE;
|
||||||
|
typedef typename ITERA::handle OUT_HANDLE;
|
||||||
int worker_id;
|
int worker_id;
|
||||||
pageid_t(*pageAlloc)(int,void*);
|
pageid_t(*pageAlloc)(int,void*);
|
||||||
void *pageAllocState;
|
void *pageAllocState;
|
||||||
|
@ -55,11 +57,11 @@ namespace rose {
|
||||||
pageid_t * out_tree_size;
|
pageid_t * out_tree_size;
|
||||||
pageid_t max_size;
|
pageid_t max_size;
|
||||||
pageid_t r_i;
|
pageid_t r_i;
|
||||||
typename ITERB::handle ** in_tree;
|
IN_HANDLE ** in_tree;
|
||||||
void * in_tree_allocer;
|
void * in_tree_allocer;
|
||||||
typename ITERA::handle ** out_tree;
|
OUT_HANDLE ** out_tree;
|
||||||
void * out_tree_allocer;
|
void * out_tree_allocer;
|
||||||
typename ITERA::handle my_tree;
|
OUT_HANDLE my_tree;
|
||||||
epoch_t * last_complete_xact;
|
epoch_t * last_complete_xact;
|
||||||
column_number_t ts_col;
|
column_number_t ts_col;
|
||||||
recordid tree;
|
recordid tree;
|
||||||
|
@ -319,7 +321,8 @@ namespace rose {
|
||||||
pthread_cond_wait(a->out_block_needed_cond, a->block_ready_mut);
|
pthread_cond_wait(a->out_block_needed_cond, a->block_ready_mut);
|
||||||
}
|
}
|
||||||
|
|
||||||
*a->out_tree = (typeof(*a->out_tree))malloc(sizeof(**a->out_tree));
|
*a->out_tree = (typename merge_args<PAGELAYOUT, ITERA, ITERB>::OUT_HANDLE*)malloc(sizeof(void*));
|
||||||
|
// *a->out_tree = (typeof(*a->out_tree))malloc(sizeof(**a->out_tree));
|
||||||
**a->out_tree = new typename ITERA::treeIteratorHandle(scratch_tree->r_);
|
**a->out_tree = new typename ITERA::treeIteratorHandle(scratch_tree->r_);
|
||||||
*(recordid*)(a->out_tree_allocer) = *scratchAllocState;
|
*(recordid*)(a->out_tree_allocer) = *scratchAllocState;
|
||||||
|
|
||||||
|
@ -419,6 +422,9 @@ namespace rose {
|
||||||
|
|
||||||
template <class PAGELAYOUT>
|
template <class PAGELAYOUT>
|
||||||
struct lsmTableHandle {
|
struct lsmTableHandle {
|
||||||
|
typedef typename std::set
|
||||||
|
<typename PAGELAYOUT::FMT::TUP,
|
||||||
|
typename PAGELAYOUT::FMT::TUP::stl_cmp> SCRATCH_SET;
|
||||||
pthread_t merge1_thread;
|
pthread_t merge1_thread;
|
||||||
pthread_t merge2_thread;
|
pthread_t merge2_thread;
|
||||||
bool * still_open;
|
bool * still_open;
|
||||||
|
@ -428,9 +434,10 @@ namespace rose {
|
||||||
typename PAGELAYOUT::FMT::TUP::stl_cmp>,
|
typename PAGELAYOUT::FMT::TUP::stl_cmp>,
|
||||||
typename PAGELAYOUT::FMT::TUP>::handle ** input_handle;
|
typename PAGELAYOUT::FMT::TUP>::handle ** input_handle;
|
||||||
bool * input_needed;
|
bool * input_needed;
|
||||||
typename std::set
|
SCRATCH_SET * scratch_tree;
|
||||||
|
/* typename std::set
|
||||||
<typename PAGELAYOUT::FMT::TUP,
|
<typename PAGELAYOUT::FMT::TUP,
|
||||||
typename PAGELAYOUT::FMT::TUP::stl_cmp> * scratch_tree;
|
typename PAGELAYOUT::FMT::TUP::stl_cmp> * scratch_tree; */
|
||||||
pthread_mutex_t * mut;
|
pthread_mutex_t * mut;
|
||||||
pthread_cond_t * input_ready_cond;
|
pthread_cond_t * input_ready_cond;
|
||||||
pthread_cond_t * input_needed_cond;
|
pthread_cond_t * input_needed_cond;
|
||||||
|
@ -516,7 +523,7 @@ namespace rose {
|
||||||
|
|
||||||
ret->input_handle = block0_scratch;
|
ret->input_handle = block0_scratch;
|
||||||
ret->input_needed = block0_needed;
|
ret->input_needed = block0_needed;
|
||||||
ret->scratch_tree = new typeof(*ret->scratch_tree);
|
ret->scratch_tree = new typename lsmTableHandle<PAGELAYOUT>::SCRATCH_SET; //new typeof(*ret->scratch_tree);
|
||||||
|
|
||||||
ret->mut = block_ready_mut;
|
ret->mut = block_ready_mut;
|
||||||
|
|
||||||
|
@ -562,7 +569,7 @@ namespace rose {
|
||||||
tree
|
tree
|
||||||
};
|
};
|
||||||
*ret->args1 = tmpargs1;
|
*ret->args1 = tmpargs1;
|
||||||
void * (*merger1)(void*) = mergeThread<PAGELAYOUT, LSM_ITER, LSM_ITER>;
|
void * (*merger1)(void*) = &mergeThread<PAGELAYOUT, LSM_ITER, LSM_ITER>;
|
||||||
|
|
||||||
ridp = (recordid*)malloc(sizeof(recordid));
|
ridp = (recordid*)malloc(sizeof(recordid));
|
||||||
*ridp = h.mediumTreeAllocState;
|
*ridp = h.mediumTreeAllocState;
|
||||||
|
@ -631,12 +638,13 @@ namespace rose {
|
||||||
gettimeofday(&stop_tv,0);
|
gettimeofday(&stop_tv,0);
|
||||||
stop = tv_to_double(stop_tv);
|
stop = tv_to_double(stop_tv);
|
||||||
|
|
||||||
typeof(h->scratch_tree)* tmp_ptr = (typeof(h->scratch_tree)*) malloc(sizeof(void*));
|
typename lsmTableHandle<PAGELAYOUT>::SCRATCH_SET** tmp_ptr = (typename lsmTableHandle<PAGELAYOUT>::SCRATCH_SET**)malloc(sizeof(void*));
|
||||||
|
// typeof(h->scratch_tree)* tmp_ptr = (typeof(h->scratch_tree)*) malloc(sizeof(void*));
|
||||||
*tmp_ptr = h->scratch_tree;
|
*tmp_ptr = h->scratch_tree;
|
||||||
*(h->input_handle) = tmp_ptr;
|
*(h->input_handle) = tmp_ptr;
|
||||||
|
|
||||||
pthread_cond_signal(h->input_ready_cond);
|
pthread_cond_signal(h->input_ready_cond);
|
||||||
h->scratch_tree = new typeof(*h->scratch_tree);
|
h->scratch_tree = new typename lsmTableHandle<PAGELAYOUT>::SCRATCH_SET;//new typeof(*h->scratch_tree);
|
||||||
|
|
||||||
pthread_mutex_unlock(h->mut);
|
pthread_mutex_unlock(h->mut);
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ START_TEST(bTreeTest) {
|
||||||
assert(!TbtreeLookup(xid, rid, NULL, (byte*)&i, sizeof(i), (byte**)&scratch, &scratchsize));
|
assert(!TbtreeLookup(xid, rid, NULL, (byte*)&i, sizeof(i), (byte**)&scratch, &scratchsize));
|
||||||
TbtreeInsert(xid, rid, NULL, (byte*)&i, sizeof(i), (byte*)&i, sizeof(i));
|
TbtreeInsert(xid, rid, NULL, (byte*)&i, sizeof(i), (byte*)&i, sizeof(i));
|
||||||
assert(TbtreeLookup(xid, rid, NULL, (byte*)&i, sizeof(i), (byte**)&scratch, &scratchsize));
|
assert(TbtreeLookup(xid, rid, NULL, (byte*)&i, sizeof(i), (byte**)&scratch, &scratchsize));
|
||||||
assert(*(typeof(&i))scratch == i);
|
assert(*(int*)scratch == i);
|
||||||
assert(scratchsize == sizeof(i));
|
assert(scratchsize == sizeof(i));
|
||||||
free(scratch);
|
free(scratch);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue