GH-46576: [C++] Suppress codecvt_utf8 deprecation warning#46622
GH-46576: [C++] Suppress codecvt_utf8 deprecation warning#46622kou merged 2 commits intoapache:mainfrom
codecvt_utf8 deprecation warning#46622Conversation
|
|
|
|
1 similar comment
|
|
|
|
|
Hello, @alinaliBQ macOS (14.7.1) clang(Apple clang version 16.0.0) doesn't match P.S. This patch will fix diff --git a/cpp/src/arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/encoding.h b/cpp/src/arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/encoding.h
index bd7ead678a..28883675d6 100644
--- a/cpp/src/arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/encoding.h
+++ b/cpp/src/arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/encoding.h
@@ -80,6 +80,9 @@ namespace odbcabstraction {
#if defined(__GNUC__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#elif defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
template <typename CHAR_TYPE>
inline void Utf8ToWcs(const char* utf8_string, size_t length,
@@ -93,7 +96,7 @@ inline void Utf8ToWcs(const char* utf8_string, size_t length,
result->reserve(length_in_bytes);
result->assign(data, data + length_in_bytes);
}
-#if defined(__GNUC__)
+#if defined(__GNUC__) || defined(__clang__)
# pragma GCC diagnostic pop
#endif
@@ -118,6 +121,9 @@ inline void Utf8ToWcs(const char* utf8_string, std::vector<uint8_t>* result) {
#if defined(__GNUC__) && __GNUC__ >= 11
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#elif defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
template <typename CHAR_TYPE>
inline void WcsToUtf8(const void* wcs_string, size_t length_in_code_units,
@@ -132,7 +138,7 @@ inline void WcsToUtf8(const void* wcs_string, size_t length_in_code_units,
result->reserve(length_in_bytes);
result->assign(data, data + length_in_bytes);
}
-#if defined(__GNUC__) && __GNUC__ >= 11
+#if (defined(__GNUC__) && __GNUC__ >= 11) || defined(__clang__)
# pragma GCC diagnostic pop
#endif |
|
Simplified. (or just diff --git a/cpp/src/arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/encoding.h b/cpp/src/arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/encoding.h
index bd7ead678a..bec75d504f 100644
--- a/cpp/src/arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/encoding.h
+++ b/cpp/src/arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/encoding.h
@@ -115,7 +115,7 @@ inline void Utf8ToWcs(const char* utf8_string, std::vector<uint8_t>* result) {
return Utf8ToWcs(utf8_string, strlen(utf8_string), result);
}
-#if defined(__GNUC__) && __GNUC__ >= 11
+#if (defined(__GNUC__) && __GNUC__ >= 11) || defined(__clang__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
@@ -132,7 +132,7 @@ inline void WcsToUtf8(const void* wcs_string, size_t length_in_code_units,
result->reserve(length_in_bytes);
result->assign(data, data + length_in_bytes);
}
-#if defined(__GNUC__) && __GNUC__ >= 11
+#if (defined(__GNUC__) && __GNUC__ >= 11) || defined(__clang__)
# pragma GCC diagnostic pop
#endif |
Using ARROW_SUPPRESS_DEPRECATION_WARNING
|
Hi @hiroyuki-sato , thanks for letting me know about |
|
|
codecvt_utf8 deprecation warning
|
|
@hiroyuki-sato Thanks for raising this. The ODBC driver has only been tested in Windows environments and is not guaranteed to work on macOS/Linux. For now our team's only building the ODBC driver in Windows to start with (see #46099). The goal of this PR is to suppress the deprecation warning for code that use |
|
|
lidavidm
left a comment
There was a problem hiding this comment.
Thanks. CI failures look unrelated
|
Could you add this to prevent build error on macOS? diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml
index 4bf162d7b1..5b3bbcb6bc 100644
--- a/.github/workflows/cpp.yml
+++ b/.github/workflows/cpp.yml
@@ -192,6 +192,8 @@ jobs:
ARROW_BUILD_TESTS: ON
ARROW_DATASET: ON
ARROW_FLIGHT: ON
+ ARROW_FLIGHT_SQL: ON
+ ARROW_FLIGHT_SQL_ODBC: ON
ARROW_GANDIVA: ON
ARROW_GCS: ON
ARROW_HDFS: ONOr should we disable the ODBC driver on non Windows? diff --git a/cpp/cmake_modules/DefineOptions.cmake b/cpp/cmake_modules/DefineOptions.cmake
index bf3e5e7c27..18e40649f7 100644
--- a/cpp/cmake_modules/DefineOptions.cmake
+++ b/cpp/cmake_modules/DefineOptions.cmake
@@ -107,6 +107,10 @@ macro(tsort_bool_option_dependencies)
endmacro()
macro(resolve_option_dependencies)
+ # Arrow Flight SQL ODBC is available only for Windows for now.
+ if(NOT MSVC_TOOLCHAIN)
+ set(ARROW_FLIGHT_SQL_ODBC OFF)
+ endif()
if(MSVC_TOOLCHAIN)
set(ARROW_USE_GLOG OFF)
endif() |
|
@alinaliBQ Thanks.
@kou recommendation looks good to me. (for macOS environment.) |
Co-Authored-By: Sutou Kouhei <kou@clear-code.com>
|
After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 7f41ece. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. |
Rationale for this change
Resolve warnings that get treated as errors by suppressing the warning.
What changes are included in this PR?
ARROW_SUPPRESS_DEPRECATION_WARNINGto code that usecodecvt_utf8cpp/src/arrow/flight/sql/odbc/odbcabstraction/include/odbcabstraction/odbc_impl/attribute_utils.hAre these changes tested?
They are tested locally on my Windows environment. The build succeeds.
Are there any user-facing changes?
None