Skip to content

Commit e880b52

Browse files
author
Marian Rassat
committed
misc: added an option to crash on warnings during cpp compilation, resolved warnings
1 parent 417f8f2 commit e880b52

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

meson.build

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ project(
66
meson_version: '>=1.1',
77
)
88

9+
add_project_arguments('-Werror', language: 'cpp')
10+
911
meson.add_dist_script(
1012
meson.project_source_root() / 'version.sh',
1113
'set-dist',

tests/test_cpp/test_matching_cost/test_matching_cost.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ TEST_CASE("Cost volume inversion test 1"){
124124
// std::cout << std::endl;
125125
//}
126126

127-
for (int i = 0; i < n_rows; ++i)
128-
for (int j = 0; j < n_cols; ++j)
129-
for (int k = 0; k < n_disp; ++k)
127+
for (size_t i = 0; i < n_rows; ++i)
128+
for (size_t j = 0; j < n_cols; ++j)
129+
for (size_t k = 0; k < n_disp; ++k)
130130
if (std::isnan(r_right_cv(i, j, k)))
131131
// check that ref is also a nan
132132
CHECK( std::isnan(ref_right_cv_arr[i][j][k]) );
@@ -200,9 +200,9 @@ TEST_CASE("Cost volume inversion test 2"){
200200
}
201201
};
202202

203-
for (int i = 0; i < n_rows; ++i)
204-
for (int j = 0; j < n_cols; ++j)
205-
for (int k = 0; k < n_disp; ++k)
203+
for (size_t i = 0; i < n_rows; ++i)
204+
for (size_t j = 0; j < n_cols; ++j)
205+
for (size_t k = 0; k < n_disp; ++k)
206206
rw_cv(i,j,k) = left_cv_arr[i][j][k];
207207

208208
// float min_disp = -2; // unused
@@ -225,9 +225,9 @@ TEST_CASE("Cost volume inversion test 2"){
225225
// std::cout << std::endl;
226226
//}
227227

228-
for (int i = 0; i < n_rows; ++i)
229-
for (int j = 0; j < n_cols; ++j)
230-
for (int k = 0; k < n_disp; ++k)
228+
for (size_t i = 0; i < n_rows; ++i)
229+
for (size_t j = 0; j < n_cols; ++j)
230+
for (size_t k = 0; k < n_disp; ++k)
231231
if (std::isnan(r_right_cv(i, j, k)))
232232
// check that ref is also a nan
233233
CHECK( std::isnan(ref_right_cv_arr[i][j][k]) );

0 commit comments

Comments
 (0)