CMake: Add -Wall;-Wextra;-Werror to CFLAGS

This commit is contained in:
Ole Schütt 2025-11-29 12:25:23 +01:00 committed by Ole Schütt
parent e2508df7e6
commit c1a7aeaa91
2 changed files with 3 additions and 7 deletions

View file

@ -69,7 +69,7 @@ add_compile_options(
add_compile_options(
"$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:Fortran,GNU>>:-O1;-march=native;-mtune=native>"
"$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:CXX,GNU>>:-O1;-march=native;-mtune=native>"
"$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:C,GNU>>:-O1;-march=native;-mtune=native>"
"$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:C,GNU>>:-O1;-march=native;-mtune=native;-Wall;-Wextra;-Werror>"
)
add_compile_options(
"$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:Fortran,GNU>>:-fsanitize=leak;-Werror=realloc-lhs>"
@ -89,12 +89,6 @@ add_link_options(
"$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:CXX,GNU>>:-fsanitize=leak>"
"$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:C,GNU>>:-fsanitize=leak>")
# TODO Prevent CMake from wrongly adding -fbacktrace and
# -fallow-argument-mismatch to CFLAGS. add_compile_options(
# "$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:CXX,GNU>>:-Wall;-Wextra;-Werror>"
# "$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANG_AND_ID:C,GNU>>:-Wall;-Wextra;-Werror>"
# )
# Coverage
add_compile_options(
"$<$<CONFIG:COVERAGE>:-coverage;-fkeep-static-functions;-O1;-march=native;-mtune=native>"

View file

@ -377,6 +377,7 @@ void dbm_multiply(const bool transa, const bool transb, const double alpha,
backend_stop(ctx);
if (NULL != matrix_d) {
ctx = backend_start(matrix_d);
iter =
dbm_comm_iterator_start(transa, transb, matrix_a, matrix_b, matrix_d);
while (dbm_comm_iterator_next(iter, &pack_a, &pack_b)) {
@ -384,6 +385,7 @@ void dbm_multiply(const bool transa, const bool transb, const double alpha,
matrix_d, rows_max_eps, retain_sparsity, true, NULL, ctx);
}
dbm_comm_iterator_stop(iter);
backend_stop(ctx);
const double epsilon = dbm_maxeps(matrix_d, matrix_c);
if (maxeps < epsilon) {
if (1 == verify) {