Skip to content

Commit

Permalink
Fix a few more clang analysis problems. (#731)
Browse files Browse the repository at this point in the history
In particular, make sure to mark the fact that we are
C++17 (as the emplace_back signature changed), and also
add in a few more (void)_ for benchmark tests.

Signed-off-by: Chris Lalancette <clalancette@gmail.com>
  • Loading branch information
clalancette authored Mar 24, 2023
1 parent ce20c11 commit 10d0883
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions rosidl_runtime_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ if(BUILD_TESTING)
# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ BENCHMARK_F(PerformanceTest, bounded_vector)(benchmark::State & st)
reset_heap_counters();

for (auto _ : st) {
(void)_;
v.push_back(0);
v.erase(v.begin());
}
Expand All @@ -47,6 +48,7 @@ BENCHMARK_F(PerformanceTest, bounded_vector_rvalue)(benchmark::State & st)
reset_heap_counters();

for (auto _ : st) {
(void)_;
v.emplace_back(0);
v.erase(v.begin());
}
Expand All @@ -63,6 +65,7 @@ BENCHMARK_F(PerformanceTest, bounded_vector_insert)(benchmark::State & st)
reset_heap_counters();

for (auto _ : st) {
(void)_;
v.insert(v.begin(), v2.begin(), v2.end());
v.erase(v.begin());
}
Expand All @@ -82,6 +85,7 @@ BENCHMARK_F(PerformanceTest, bounded_vector_input_iterators)(benchmark::State &
reset_heap_counters();

for (auto _ : st) {
(void)_;
v.assign(ii, end);
v.erase(v.begin());
}
Expand All @@ -98,6 +102,7 @@ BENCHMARK_F(PerformanceTest, bounded_vector_forward_iterators)(benchmark::State
reset_heap_counters();

for (auto _ : st) {
(void)_;
v.assign(l.begin(), l.end());
v.erase(v.begin());
}
Expand Down
5 changes: 5 additions & 0 deletions rosidl_typesupport_introspection_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()

# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
Expand Down

0 comments on commit 10d0883

Please sign in to comment.