treating warnings as errors during workflows (#1473)

* treating warnings as errors during workflows

* suppress warnings for moench calibration

* no format overflow

* revert formatting

* bettter conditional branching in cmake
This commit is contained in:
2026-08-03 09:30:53 +02:00
committed by mazzol_a
parent 7a4af4e7e1
commit a01d96e892
4 changed files with 29 additions and 6 deletions
+2 -1
View File
@@ -37,7 +37,8 @@ jobs:
-DSLS_USE_PYTHON=ON \
-DSLS_USE_HDF5=ON \
-DSLS_USE_GUI=ON \
-DSLS_USE_MOENCH=ON
-DSLS_USE_MOENCH=ON \
-DSLS_TREAT_WARNINGS_AS_ERRORS=ON
- name: Build
# Build your program with the given configuration
+17 -3
View File
@@ -209,6 +209,7 @@ option(SLS_DEVEL_HEADERS "install headers for devel" OFF)
option(SLS_USE_MOENCH "compile zmq and post processing for Moench" OFF)
option(SLS_USE_JUNGFRAU "compile post processing for Jungfrau" OFF)
option(SLS_INSTALL_VERSIONED_BINARIES "Add version number to binaries on install" OFF) #Needed for multi version RPM
option(SLS_TREAT_WARNINGS_AS_ERRORS "Treat warnings as errors" OFF)
#Convenience option to switch off defaults when building Moench binaries only
option(SLS_BUILD_ONLY_MOENCH "compile only Moench" OFF)
@@ -323,7 +324,9 @@ if (NOT TARGET slsProjectWarnings)
-Wno-missing-field-initializers)
endif()
if(SLS_TREAT_WARNINGS_AS_ERRORS)
target_compile_options(slsProjectWarnings INTERFACE -Werror)
endif()
endif()
@@ -347,6 +350,15 @@ if (NOT TARGET slsProjectCSettings)
target_link_libraries(slsProjectCSettings INTERFACE
Threads::Threads
)
if(SLS_USE_SANITIZER_IN_SERVER)
target_compile_options(slsProjectCSettings INTERFACE -fsanitize=address,undefined -fno-omit-frame-pointer)
target_link_libraries(slsProjectCSettings INTERFACE -fsanitize=address,undefined)
endif()
if(SLS_TREAT_WARNINGS_AS_ERRORS)
target_compile_options(slsProjectCSettings INTERFACE -Werror)
endif()
endif()
@@ -448,13 +460,15 @@ if(SLS_BUILD_DOCS)
add_subdirectory(docs)
endif(SLS_BUILD_DOCS)
if(SLS_USE_MOENCH)
if(SLS_USE_MOENCH OR SLS_USE_JUNGFRAU)
add_subdirectory(slsDetectorCalibration/tiffio)
endif()
if(SLS_USE_MOENCH)
add_subdirectory(slsDetectorCalibration/moenchExecutables)
endif(SLS_USE_MOENCH)
if(SLS_USE_JUNGFRAU)
add_subdirectory(slsDetectorCalibration/tiffio)
add_subdirectory(slsDetectorCalibration/jungfrauExecutables)
endif(SLS_USE_JUNGFRAU)
@@ -76,6 +76,14 @@ foreach(exe ${MOENCH_EXECUTABLES})
slsProjectOptions
)
target_compile_options(${exe} PRIVATE
-Wno-unused-but-set-variable
-Wno-format-nonliteral
-Wno-format-security
-Wno-double-promotion
-Wno-unused-variable
-Wno-format-overflow)
set_target_properties(${exe} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
@@ -204,9 +204,9 @@ int main(int argc, char *argv[]) {
*/
//#endif
if (totquad > cmin && cl.x >= xmin && cl.x <= xmax &&
if (totquad > static_cast<double>(cmin) && cl.x >= xmin && cl.x <= xmax &&
cl.y >= ymin && cl.y <= ymax &&
totquad < cmax) {
totquad < static_cast<double>(cmax)) {
// if (sum > cmin && totquad / sum > 0.8 && totquad / sum < 1.2 &&
// sum < cmax) {