From eaba1650a01c62c111f24b832f48b48957807edb Mon Sep 17 00:00:00 2001 From: "Mads R. B. Kristensen" Date: Fri, 22 Apr 2022 08:57:53 +0200 Subject: [PATCH 1/2] cmake-basic-example: adding the -Werror compile flag --- cpp/examples/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cpp/examples/CMakeLists.txt b/cpp/examples/CMakeLists.txt index 112f539977..27b428ce9e 100644 --- a/cpp/examples/CMakeLists.txt +++ b/cpp/examples/CMakeLists.txt @@ -15,3 +15,10 @@ add_executable(basic_io basic_io.cpp) target_include_directories(basic_io PRIVATE ../include ${cuFile_INCLUDE_DIRS}) target_link_libraries(basic_io PRIVATE kvikio CUDA::cudart) + +if(CMAKE_COMPILER_IS_GNUCXX) + set(KVIKIO_CXX_FLAGS "-Wall;-Werror;-Wno-unknown-pragmas;-Werror=sign-compare") + target_compile_options( + basic_io PRIVATE "$<$:${KVIKIO_CXX_FLAGS}>" + ) +endif() From 53c9b5610bbd3a5b40814879da934c4f16db7d9d Mon Sep 17 00:00:00 2001 From: "Mads R. B. Kristensen" Date: Fri, 22 Apr 2022 08:58:47 +0200 Subject: [PATCH 2/2] convert_size2off(): fix different signedness --- cpp/examples/CMakeLists.txt | 2 +- cpp/include/kvikio/utils.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/examples/CMakeLists.txt b/cpp/examples/CMakeLists.txt index 27b428ce9e..79d8e66765 100644 --- a/cpp/examples/CMakeLists.txt +++ b/cpp/examples/CMakeLists.txt @@ -17,7 +17,7 @@ target_include_directories(basic_io PRIVATE ../include ${cuFile_INCLUDE_DIRS}) target_link_libraries(basic_io PRIVATE kvikio CUDA::cudart) if(CMAKE_COMPILER_IS_GNUCXX) - set(KVIKIO_CXX_FLAGS "-Wall;-Werror;-Wno-unknown-pragmas;-Werror=sign-compare") + set(KVIKIO_CXX_FLAGS "-Wall;-Werror;-Wno-unknown-pragmas") target_compile_options( basic_io PRIVATE "$<$:${KVIKIO_CXX_FLAGS}>" ) diff --git a/cpp/include/kvikio/utils.hpp b/cpp/include/kvikio/utils.hpp index 69b91b459f..2ecd0f6fff 100644 --- a/cpp/include/kvikio/utils.hpp +++ b/cpp/include/kvikio/utils.hpp @@ -36,7 +36,7 @@ inline constexpr std::size_t page_size = 4096; [[nodiscard]] inline off_t convert_size2off(std::size_t x) { - if (x >= std::numeric_limits::max()) { + if (x >= static_cast(std::numeric_limits::max())) { throw CUfileException("size_t argument too large to fit off_t"); } return static_cast(x);