Skip to content

Commit

Permalink
Minor fixes for compiler matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
lczech committed Jul 2, 2024
1 parent 8be9224 commit 68051af
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,10 @@ jobs:
# 3: Install gdb for debugging output.
run: |
sudo apt-get install autoconf automake zlib1g-dev libbz2-dev liblzma-dev
sudo apt-get install libtinfo5 gdb
sudo apt-get install gdb
if [[ ${{ matrix.os }} != ubuntu-24.04 ]] ; then
sudo apt-get install libtinfo5
fi
# sudo apt-get remove autoconf
# sudo apt-get install autoconf2.64 liblzma-dev libbz2-dev

Expand Down
8 changes: 4 additions & 4 deletions lib/genesis/utils/containers/sequential_output_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ namespace utils {
* Example:
*
* // Create a buffer that prints lines in the correct order.
* auto seq_out_buff = SequentialOutputBuffer<std::string>(
* SequentialOutputBuffer<std::string> seq_out_buff{
* [&]( std::string&& line ){
* std::cout << line << "\n";
* }
* );
* };
*
* // Emplace elements in the buffer. This loop can be run in a thread pool,
* // where each thread processed a subset of lines in some order. In that case,
Expand Down Expand Up @@ -156,10 +156,10 @@ class SequentialOutputBuffer
}

SequentialOutputBuffer( SequentialOutputBuffer const& ) = delete;
SequentialOutputBuffer( SequentialOutputBuffer&& ) = default;
SequentialOutputBuffer( SequentialOutputBuffer&& ) = delete;

SequentialOutputBuffer& operator= ( SequentialOutputBuffer const& ) = delete;
SequentialOutputBuffer& operator= ( SequentialOutputBuffer&& ) = default;
SequentialOutputBuffer& operator= ( SequentialOutputBuffer&& ) = delete;

// -------------------------------------------------------------------------
// Element Access
Expand Down
10 changes: 8 additions & 2 deletions lib/genesis/utils/core/info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1613,12 +1613,15 @@ size_t info_current_file_count()
return 0.0;
}

fscanf(
auto const scanned = fscanf(
file, "cpu %llu %llu %llu %llu",
&lastTotalUser, &lastTotalUserLow, &lastTotalSys, &lastTotalIdle
);
fclose(file);
num_processors = info_process_number_of_processors_();
if( scanned != 4 ) {
return 0.0;
}

initialized = true;
return 0.0;
Expand All @@ -1632,11 +1635,14 @@ size_t info_current_file_count()
if( ! file ) {
return 0.0;
}
fscanf(
auto const scanned = fscanf(
file, "cpu %llu %llu %llu %llu",
&totalUser, &totalUserLow, &totalSys, &totalIdle
);
fclose(file);
if( scanned != 4 ) {
return 0.0;
}

if(
totalUser < lastTotalUser || totalUserLow < lastTotalUserLow ||
Expand Down
8 changes: 4 additions & 4 deletions test/src/utils/containers/sequential_output_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ void test_sequential_output_buffer_()
results.reserve( max_elem );

// Make a buffer that on output writes the value to the results vector.
auto buff = SequentialOutputBuffer<size_t>(
SequentialOutputBuffer<size_t> buff{
[&]( size_t value ){
results.push_back( value );
}
);
};

// Make a vector with all sequential numbers up to the max, randomized.
auto values = std::vector<size_t>( max_elem );
Expand Down Expand Up @@ -111,11 +111,11 @@ void test_sequential_output_buffer_parallel_()
results.reserve( max_elem );

// Make a buffer that on output writes the value to the results vector.
auto seq_out_buff = SequentialOutputBuffer<size_t>(
SequentialOutputBuffer<size_t> seq_out_buff{
[&]( size_t value ){
results.push_back( value );
}
);
};

// Make a vector with all sequential numbers up to the max, randomized.
auto values = std::vector<size_t>( max_elem );
Expand Down

0 comments on commit 68051af

Please sign in to comment.