In #990 (comment), we noticed that we might not be configuring our compilation flags to treat warnings as errors.
With this change
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 682fa02..40078a8 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -53,6 +53,11 @@ option(KvikIO_BUILD_EXAMPLES "Configure CMake to build examples" ON)
option(KvikIO_BUILD_TESTS "Configure CMake to build tests" ON)
option(KvikIO_REMOTE_SUPPORT "Configure CMake to build with remote IO support" ON)
+set(KVIKIO_CXX_FLAGS "")
+if(CMAKE_COMPILER_IS_GNUCXX)
+ list(APPEND KVIKIO_CXX_FLAGS -Wall -Werror -Wno-unknown-pragmas -Wno-error=deprecated-declarations)
+endif()
+
# ##################################################################################################
# * conda environment ------------------------------------------------------------------------------
rapids_cmake_support_conda_env(conda_env MODIFY_PREFIX_PATH)
@@ -234,6 +239,8 @@ target_compile_definitions(
$<$<BOOL:${cuFile_VERSION_API_FOUND}>:KVIKIO_CUFILE_VERSION_API_FOUND>
)
+target_compile_options(kvikio PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${KVIKIO_CXX_FLAGS}>")
+
set_target_properties(
kvikio
PROPERTIES BUILD_RPATH "\$ORIGIN"
With those flags, there are some errors:
build-kvikio-cpp
Building libkvikio
[0/1] Re-running CMake...
-- CPM: Using local package rapids_logger@0.2.3
-- CPM: Using local package CURL@8.20.0
-- CPM: Using local package nvtx3@3.2.0
-- Found cuFile Batch API: TRUE
-- Found cuFile Stream API: TRUE
-- Found cuFile Version API: TRUE
-- CPM: Adding package bs_thread_pool@4.1.0 (4.1.0)
-- Populating bs_thread_pool
-- Configuring done (0.1s)
-- Generating done (0.1s)
-- Build files have been written to: /home/coder/kvikio/cpp/build/conda/cuda-12.9/release/_deps/bs_thread_pool-subbuild
ninja: no work to do.
-- CPM: Adding package GTest@1.16.0 (1.16.0)
-- Configuring done (2.3s)
-- Generating done (0.1s)
-- Build files have been written to: /home/coder/kvikio/cpp/build/conda/cuda-12.9/release
[30/51] Building CXX object CMakeFiles/kvikio.dir/src/detail/url.cpp.o
FAILED: CMakeFiles/kvikio.dir/src/detail/url.cpp.o
/usr/bin/sccache /home/coder/.conda/envs/rapids/bin/x86_64-conda-linux-gnu-c++ -DBS_THREAD_POOL_ENABLE_PAUSE=1 -DKVIKIO_CUFILE_FOUND -DKVIKIO_CUFILE_VERSION_API_FOUND -DKVIKIO_LIBCURL_FOUND -DKVIKIO_LOG_ACTIVE_LEVEL=RAPIDS_LOGGER_LOG_LEVEL_TRACE -Dkvikio_EXPORTS -I/home/coder/kvikio/cpp/include -I/home/coder/kvikio/cpp/build/conda/cuda-12.9/release/include -I/home/coder/kvikio/cpp/build/conda/cuda-12.9/release/_deps/bs_thread_pool-src/include -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/coder/.conda/envs/rapids/include -I/home/coder/.conda/envs/rapids/targets/x86_64-linux/include -O3 -DNDEBUG -std=gnu++20 -fPIC -Wall -Werror -Wno-unknown-pragmas -Wno-error=deprecated-declarations -MD -MT CMakeFiles/kvikio.dir/src/detail/url.cpp.o -MF CMakeFiles/kvikio.dir/src/detail/url.cpp.o.d -o CMakeFiles/kvikio.dir/src/detail/url.cpp.o -c /home/coder/kvikio/cpp/src/detail/url.cpp
/home/coder/kvikio/cpp/src/detail/url.cpp: In static member function 'static kvikio::detail::UrlParser::UrlComponents kvikio::detail::UrlParser::parse(const std::string&, std::optional<unsigned int>, std::optional<unsigned int>)':
/home/coder/kvikio/cpp/src/detail/url.cpp:118:13: error: unused variable 'err_code' [-Werror=unused-variable]
118 | CURLUcode err_code{};
| ^~~~~~~~
cc1plus: all warnings being treated as errors
[31/51] Building CXX object CMakeFiles/kvikio.dir/src/detail/nvtx.cpp.o
FAILED: CMakeFiles/kvikio.dir/src/detail/nvtx.cpp.o
/usr/bin/sccache /home/coder/.conda/envs/rapids/bin/x86_64-conda-linux-gnu-c++ -DBS_THREAD_POOL_ENABLE_PAUSE=1 -DKVIKIO_CUFILE_FOUND -DKVIKIO_CUFILE_VERSION_API_FOUND -DKVIKIO_LIBCURL_FOUND -DKVIKIO_LOG_ACTIVE_LEVEL=RAPIDS_LOGGER_LOG_LEVEL_TRACE -Dkvikio_EXPORTS -I/home/coder/kvikio/cpp/include -I/home/coder/kvikio/cpp/build/conda/cuda-12.9/release/include -I/home/coder/kvikio/cpp/build/conda/cuda-12.9/release/_deps/bs_thread_pool-src/include -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/coder/.conda/envs/rapids/include -I/home/coder/.conda/envs/rapids/targets/x86_64-linux/include -O3 -DNDEBUG -std=gnu++20 -fPIC -Wall -Werror -Wno-unknown-pragmas -Wno-error=deprecated-declarations -MD -MT CMakeFiles/kvikio.dir/src/detail/nvtx.cpp.o -MF CMakeFiles/kvikio.dir/src/detail/nvtx.cpp.o.d -o CMakeFiles/kvikio.dir/src/detail/nvtx.cpp.o -c /home/coder/kvikio/cpp/src/detail/nvtx.cpp
/home/coder/kvikio/cpp/src/detail/nvtx.cpp: In static member function 'static void kvikio::NvtxManager::rename_current_thread(std::string_view)':
/home/coder/kvikio/cpp/src/detail/nvtx.cpp:66:24: error: unused variable 'handle' [-Werror=unused-variable]
66 | nvtxResourceHandle_t handle =
| ^~~~~~
cc1plus: all warnings being treated as errors
[32/51] Building CXX object CMakeFiles/kvikio.dir/src/mmap.cpp.o
FAILED: CMakeFiles/kvikio.dir/src/mmap.cpp.o
/usr/bin/sccache /home/coder/.conda/envs/rapids/bin/x86_64-conda-linux-gnu-c++ -DBS_THREAD_POOL_ENABLE_PAUSE=1 -DKVIKIO_CUFILE_FOUND -DKVIKIO_CUFILE_VERSION_API_FOUND -DKVIKIO_LIBCURL_FOUND -DKVIKIO_LOG_ACTIVE_LEVEL=RAPIDS_LOGGER_LOG_LEVEL_TRACE -Dkvikio_EXPORTS -I/home/coder/kvikio/cpp/include -I/home/coder/kvikio/cpp/build/conda/cuda-12.9/release/include -I/home/coder/kvikio/cpp/build/conda/cuda-12.9/release/_deps/bs_thread_pool-src/include -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/coder/.conda/envs/rapids/include -I/home/coder/.conda/envs/rapids/targets/x86_64-linux/include -O3 -DNDEBUG -std=gnu++20 -fPIC -Wall -Werror -Wno-unknown-pragmas -Wno-error=deprecated-declarations -MD -MT CMakeFiles/kvikio.dir/src/mmap.cpp.o -MF CMakeFiles/kvikio.dir/src/mmap.cpp.o.d -o CMakeFiles/kvikio.dir/src/mmap.cpp.o -c /home/coder/kvikio/cpp/src/mmap.cpp
/home/coder/kvikio/cpp/src/mmap.cpp: In function 'std::size_t kvikio::detail::perform_prefault(void*, std::size_t)':
/home/coder/kvikio/cpp/src/mmap.cpp:136:14: error: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'long int' [-Werror=sign-compare]
136 | if (size >= num_bytes) { size -= num_bytes; }
| ~~~~~^~~~~~~~~~~~
/home/coder/kvikio/cpp/src/mmap.cpp:139:17: error: comparison of integer expressions of different signedness: 'long int' and 'std::size_t' {aka 'long unsigned int'} [-Werror=sign-compare]
139 | if (num_bytes >= size) { return touched_bytes; }
| ~~~~~~~~~~^~~~~~~
cc1plus: all warnings being treated as errors
[33/51] Building CXX object CMakeFiles/kvikio.dir/src/shim/libcurl.cpp.o
FAILED: CMakeFiles/kvikio.dir/src/shim/libcurl.cpp.o
/usr/bin/sccache /home/coder/.conda/envs/rapids/bin/x86_64-conda-linux-gnu-c++ -DBS_THREAD_POOL_ENABLE_PAUSE=1 -DKVIKIO_CUFILE_FOUND -DKVIKIO_CUFILE_VERSION_API_FOUND -DKVIKIO_LIBCURL_FOUND -DKVIKIO_LOG_ACTIVE_LEVEL=RAPIDS_LOGGER_LOG_LEVEL_TRACE -Dkvikio_EXPORTS -I/home/coder/kvikio/cpp/include -I/home/coder/kvikio/cpp/build/conda/cuda-12.9/release/include -I/home/coder/kvikio/cpp/build/conda/cuda-12.9/release/_deps/bs_thread_pool-src/include -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/coder/.conda/envs/rapids/include -I/home/coder/.conda/envs/rapids/targets/x86_64-linux/include -O3 -DNDEBUG -std=gnu++20 -fPIC -Wall -Werror -Wno-unknown-pragmas -Wno-error=deprecated-declarations -MD -MT CMakeFiles/kvikio.dir/src/shim/libcurl.cpp.o -MF CMakeFiles/kvikio.dir/src/shim/libcurl.cpp.o.d -o CMakeFiles/kvikio.dir/src/shim/libcurl.cpp.o -c /home/coder/kvikio/cpp/src/shim/libcurl.cpp
/home/coder/kvikio/cpp/src/shim/libcurl.cpp: In member function 'void kvikio::CurlHandle::perform()':
/home/coder/kvikio/cpp/src/shim/libcurl.cpp:127:26: error: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Werror=sign-compare]
127 | while (attempt_count++ < http_max_attempts) {
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/home/coder/kvikio/cpp/src/shim/libcurl.cpp:150:25: error: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Werror=sign-compare]
150 | if (attempt_count < http_max_attempts) {
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/home/coder/kvikio/cpp/src/shim/libcurl.cpp:179:3: error: 'err' may be used uninitialized [-Werror=maybe-uninitialized]
179 | if (err == CURLE_OPERATION_TIMEDOUT) {
| ^~
/home/coder/kvikio/cpp/src/shim/libcurl.cpp:125:12: note: 'err' was declared here
125 | CURLcode err;
| ^~~
cc1plus: all warnings being treated as errors
ninja: build stopped: subcommand failed.
I'm not sure if that's the best way to do it. cudf configures things a bit differently.
In #990 (comment), we noticed that we might not be configuring our compilation flags to treat warnings as errors.
With this change
With those flags, there are some errors:
I'm not sure if that's the best way to do it. cudf configures things a bit differently.