From 30c436571f208068f26475063b53ed9d77719f58 Mon Sep 17 00:00:00 2001
From: David Li
Date: Tue, 26 Mar 2024 13:59:25 -0400
Subject: [PATCH] build(c): suppress more MSVC warnings (#1674)
---
c/cmake_modules/AdbcDefines.cmake | 6 ++++++
c/driver/framework/base.cc | 2 +-
c/driver/framework/objects.cc | 2 +-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/c/cmake_modules/AdbcDefines.cmake b/c/cmake_modules/AdbcDefines.cmake
index 2cf5e2ffa4..c0bf38a41c 100644
--- a/c/cmake_modules/AdbcDefines.cmake
+++ b/c/cmake_modules/AdbcDefines.cmake
@@ -77,6 +77,11 @@ if(MSVC)
# Allow incomplete switch (since MSVC warns even if there's a default case)
add_compile_options(/wd4061)
add_compile_options(/wd4100)
+ # Nanoarrow emits a lot of conversion warnings
+ add_compile_options(/wd4365)
+ add_compile_options(/wd4458)
+ add_compile_options(/wd4514)
+ add_compile_options(/wd4582)
add_compile_options(/wd4623)
add_compile_options(/wd4625)
add_compile_options(/wd4626)
@@ -85,6 +90,7 @@ if(MSVC)
add_compile_options(/wd4711)
# Don't warn about padding added after members
add_compile_options(/wd4820)
+ add_compile_options(/wd5027)
add_compile_options(/wd5045)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"
OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
diff --git a/c/driver/framework/base.cc b/c/driver/framework/base.cc
index ab94caf370..2e93b8f61c 100644
--- a/c/driver/framework/base.cc
+++ b/c/driver/framework/base.cc
@@ -147,7 +147,7 @@ AdbcStatusCode Option::CGet(double* out, AdbcError* error) const {
[&](auto&& value) -> AdbcStatusCode {
using T = std::decay_t;
if constexpr (std::is_same_v || std::is_same_v) {
- *out = value;
+ *out = static_cast(value);
return ADBC_STATUS_OK;
} else if constexpr (std::is_same_v) {
return status::NotFound("Unknown option").ToAdbc(error);
diff --git a/c/driver/framework/objects.cc b/c/driver/framework/objects.cc
index 28e33c0c16..67f5b26f01 100644
--- a/c/driver/framework/objects.cc
+++ b/c/driver/framework/objects.cc
@@ -69,7 +69,7 @@ struct GetObjectsBuilder {
table_types(table_types),
schema(schema),
array(array) {
- na_error = {0};
+ std::memset(&na_error, 0, sizeof(na_error));
}
Status Build() {