Skip to content

Commit 10d0883

Browse files
authored
Fix a few more clang analysis problems. (#731)
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 <[email protected]>
1 parent ce20c11 commit 10d0883

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

rosidl_runtime_cpp/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ if(BUILD_TESTING)
4141
# Default to C++17
4242
if(NOT CMAKE_CXX_STANDARD)
4343
set(CMAKE_CXX_STANDARD 17)
44+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
4445
endif()
4546

4647
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")

rosidl_runtime_cpp/test/benchmark/benchmark_bounded_vector.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ BENCHMARK_F(PerformanceTest, bounded_vector)(benchmark::State & st)
3333
reset_heap_counters();
3434

3535
for (auto _ : st) {
36+
(void)_;
3637
v.push_back(0);
3738
v.erase(v.begin());
3839
}
@@ -47,6 +48,7 @@ BENCHMARK_F(PerformanceTest, bounded_vector_rvalue)(benchmark::State & st)
4748
reset_heap_counters();
4849

4950
for (auto _ : st) {
51+
(void)_;
5052
v.emplace_back(0);
5153
v.erase(v.begin());
5254
}
@@ -63,6 +65,7 @@ BENCHMARK_F(PerformanceTest, bounded_vector_insert)(benchmark::State & st)
6365
reset_heap_counters();
6466

6567
for (auto _ : st) {
68+
(void)_;
6669
v.insert(v.begin(), v2.begin(), v2.end());
6770
v.erase(v.begin());
6871
}
@@ -82,6 +85,7 @@ BENCHMARK_F(PerformanceTest, bounded_vector_input_iterators)(benchmark::State &
8285
reset_heap_counters();
8386

8487
for (auto _ : st) {
88+
(void)_;
8589
v.assign(ii, end);
8690
v.erase(v.begin());
8791
}
@@ -98,6 +102,7 @@ BENCHMARK_F(PerformanceTest, bounded_vector_forward_iterators)(benchmark::State
98102
reset_heap_counters();
99103

100104
for (auto _ : st) {
105+
(void)_;
101106
v.assign(l.begin(), l.end());
102107
v.erase(v.begin());
103108
}

rosidl_typesupport_introspection_tests/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ if(BUILD_TESTING)
77
find_package(ament_lint_auto REQUIRED)
88
ament_lint_auto_find_test_dependencies()
99

10+
# Default to C++17
11+
if(NOT CMAKE_CXX_STANDARD)
12+
set(CMAKE_CXX_STANDARD 17)
13+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
14+
endif()
1015
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1116
add_compile_options(-Wall -Wextra -Wpedantic)
1217
endif()

0 commit comments

Comments
 (0)