Skip to content

Commit

Permalink
tests: silence warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
timblechmann committed Nov 3, 2023
1 parent 1076850 commit c3ed431
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
3 changes: 3 additions & 0 deletions test/freelist_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ struct freelist_tester
dummy* node = fl.template construct< true, bounded >();
if ( node ) {
bool success = working_set.insert( node );
(void)success;
assert( success );
allocated_nodes.push( node );
break;
Expand All @@ -183,6 +184,7 @@ struct freelist_tester
dummy* node;
if ( allocated_nodes.pop( node ) ) {
bool success = working_set.erase( node );
(void)success;
assert( success );
fl.template destruct< true >( node );
}
Expand All @@ -198,6 +200,7 @@ struct freelist_tester
dummy* node;
while ( allocated_nodes.pop( node ) ) {
bool success = working_set.erase( node );
(void)success;
assert( success );
fl.template destruct< true >( node );
}
Expand Down
2 changes: 1 addition & 1 deletion test/queue_interprocess_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// http://www.boost.org/LICENSE_1_0.txt)

#include <cstdlib> //std::system
#include <sstream>

#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/lockfree/queue.hpp>
Expand Down Expand Up @@ -52,6 +51,7 @@ int main( int argc, char* argv[] )
int from_queue;
for ( int i = 0; i != 1024; ++i ) {
bool success = q->pop( from_queue );
(void)success;
assert( success );
assert( from_queue == i );
}
Expand Down
14 changes: 8 additions & 6 deletions test/spsc_queue_stress_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ using namespace boost::lockfree;
using namespace std;

#ifndef BOOST_LOCKFREE_STRESS_TEST
static const boost::uint32_t nodes_per_thread = 100000;
static const size_t nodes_per_thread = 100000;
#else
static const boost::uint32_t nodes_per_thread = 100000000;
static const size_t nodes_per_thread = 100000000;
#endif

struct spsc_queue_tester
Expand All @@ -50,7 +50,7 @@ struct spsc_queue_tester

void add( void )
{
for ( boost::uint32_t i = 0; i != nodes_per_thread; ++i ) {
for ( size_t i = 0; i != nodes_per_thread; ++i ) {
int id = generate_id< int >();
working_set.insert( id );

Expand All @@ -70,6 +70,7 @@ struct spsc_queue_tester
++received_nodes;
--spsc_queue_cnt;
bool erased = working_set.erase( data );
(void)erased;
assert( erased );
return true;
} else
Expand Down Expand Up @@ -143,7 +144,7 @@ struct spsc_queue_tester_buffering
void add( void )
{
boost::array< int, buf_size > input_buffer;
for ( boost::uint32_t i = 0; i != nodes_per_thread; i += buf_size ) {
for ( size_t i = 0; i != nodes_per_thread; i += buf_size ) {
for ( size_t i = 0; i != buf_size; ++i ) {
int id = generate_id< int >();
working_set.insert( id );
Expand All @@ -168,11 +169,12 @@ struct spsc_queue_tester_buffering
size_t popd = sf.pop( output_buffer.c_array(), output_buffer.size() );

if ( popd ) {
received_nodes += popd;
spsc_queue_cnt -= popd;
received_nodes += size_t( popd );
spsc_queue_cnt -= long( popd );

for ( size_t i = 0; i != popd; ++i ) {
bool erased = working_set.erase( output_buffer[ i ] );
(void)erased;
assert( erased );
}

Expand Down
2 changes: 1 addition & 1 deletion test/stack_interprocess_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// http://www.boost.org/LICENSE_1_0.txt)

#include <cstdlib> //std::system
#include <sstream>

#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/lockfree/stack.hpp>
Expand Down Expand Up @@ -52,6 +51,7 @@ int main( int argc, char* argv[] )
int from_queue;
for ( int i = 0; i != 1024; ++i ) {
bool success = queue->pop( from_queue );
(void)success;
assert( success );
assert( from_queue == 1023 - i );
}
Expand Down
3 changes: 3 additions & 0 deletions test/test_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ struct queue_stress_tester

bool inserted = data.insert( id );
assert( inserted );
(void)inserted;

if ( Bounded )
while ( stk.bounded_push( id ) == false ) {
Expand Down Expand Up @@ -83,6 +84,8 @@ struct queue_stress_tester

bool erased = data.erase( id );
bool inserted = dequeued.insert( id );
(void)erased;
(void)inserted;
assert( erased );
assert( inserted );
++pop_count;
Expand Down

0 comments on commit c3ed431

Please sign in to comment.