hiroyuki-sato commented on PR #46622:
URL: https://github.com/apache/arrow/pull/46622#issuecomment-2914825018
Hello, @alinaliBQ
macOS (14.7.1) clang(Apple clang version 16.0.0) doesn't match `__GNUC__ >=
11`.
So you need additional check
```
#ifdef __GNUC__
# warning "__GNUC__ is defined"
#endif
#ifdef __clang__
# warning "__clang__ is defined"
#endif
#if __GNUC__ >= 11
warning "clang return true __GNU__ >= 11"
#else
warning "clang return false __GNU__ >= 11"
#endif
```
```
test.c:2:4: warning: "__GNUC__ is defined" [-W#warnings]
2 | # warning "__GNUC__ is defined"
| ^
test.c:5:4: warning: "__clang__ is defined" [-W#warnings]
5 | # warning "__clang__ is defined"
| ^
test.c:11:3: error: unknown type name 'warning'
11 | warning "clang return false __GNU__ >= 11"
| ^
test.c:11:11: error: expected identifier or '('
11 | warning "clang return false __GNU__ >= 11"
| ^
2 warnings and 2 errors generated.
```
This patch will fix `encoding.h` part, but It seems you need some additional
works.
```diff
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
```
```
/opt/homebrew/bin/ccache
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-DARROW_HAVE_NEON -DARROW_WITH_TIMING_TESTS -DFMT_HEADER_ONLY
-DGRPC_ENABLE_ASYNC
-DGRPC_NAMESPACE_FOR_TLS_CREDENTIALS_OPTIONS=grpc::experimental
-DGRPC_USE_CERTIFICATE_VERIFIER -DGRPC_USE_TLS_CHANNEL_CREDENTIALS_OPTIONS
-I/path/to/arrow/cpp/build/src -I/path/to/arrow/cpp/src
-I/path/to/arrow/cpp/src/generated
-I/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/include
-I/path/to/arrow/cpp/build/_deps/spdlog-src/include -isystem
/opt/homebrew/include -fno-aligned-new -Qunused-arguments -fcolor-diagnostics
-Wall -Wextra -Wdocumentation -DARROW_WARN_DOCUMENTATION -Wshorten-64-to-32
-Wno-missing-braces -Wno-unused-parameter -Wno-constant-logical-operand
-Wno-return-stack-address -Wdate-time -Wno-unknown-warning-option
-Wno-pass-failed -march=armv8-a -g -Werror -O0 -ggdb -std=c++17 -arch arm64
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/
MacOSX.platform/Developer/SDKs/MacOSX.sdk -fPIC -MD -MT
src/arrow/flight/sql/odbc/odbcabstraction/CMakeFiles/odbcabstraction.dir/__/__/__/__/vendored/whereami/whereami.cc.o
-MF
src/arrow/flight/sql/odbc/odbcabstraction/CMakeFiles/odbcabstraction.dir/__/__/__/__/vendored/whereami/whereami.cc.o.d
-o
src/arrow/flight/sql/odbc/odbcabstraction/CMakeFiles/odbcabstraction.dir/__/__/__/__/vendored/whereami/whereami.cc.o
-c /path/to/arrow/cpp/src/arrow/vendored/whereami/whereami.cc
/path/to/arrow/cpp/src/arrow/vendored/whereami/whereami.cc:337:16: error:
use of undeclared identifier 'PATH_MAX'
337 | char buffer1[PATH_MAX];
| ^
/path/to/arrow/cpp/src/arrow/vendored/whereami/whereami.cc:338:16: error:
use of undeclared identifier 'PATH_MAX'
338 | char buffer2[PATH_MAX];
| ^
/path/to/arrow/cpp/src/arrow/vendored/whereami/whereami.cc:354:19: error:
use of undeclared identifier 'strlen'
354 | length = (int)strlen(resolved);
| ^
/path/to/arrow/cpp/src/arrow/vendored/whereami/whereami.cc:356:7: error: use
of undeclared identifier 'memcpy'
356 | memcpy(out, resolved, length);
| ^
/path/to/arrow/cpp/src/arrow/vendored/whereami/whereami.cc:378:15: error:
use of undeclared identifier 'PATH_MAX'
378 | char buffer[PATH_MAX];
| ^
/path/to/arrow/cpp/src/arrow/vendored/whereami/whereami.cc:389:21: error:
use of undeclared identifier 'strlen'
389 | length = (int)strlen(resolved);
| ^
/path/to/arrow/cpp/src/arrow/vendored/whereami/whereami.cc:391:9: error: use
of undeclared identifier 'memcpy'
391 | memcpy(out, resolved, length);
| ^
7 errors generated.
[3/619] Building CXX object
src/arrow/flight/sql/odbc/odbcabstraction/CMakeFiles/odbcabstraction.dir/odbc_impl/odbc_descriptor.cc.o
FAILED:
src/arrow/flight/sql/odbc/odbcabstraction/CMakeFiles/odbcabstraction.dir/odbc_impl/odbc_descriptor.cc.o
/opt/homebrew/bin/ccache
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-DARROW_HAVE_NEON -DARROW_WITH_TIMING_TESTS -DFMT_HEADER_ONLY
-DGRPC_ENABLE_ASYNC
-DGRPC_NAMESPACE_FOR_TLS_CREDENTIALS_OPTIONS=grpc::experimental
-DGRPC_USE_CERTIFICATE_VERIFIER -DGRPC_USE_TLS_CHANNEL_CREDENTIALS_OPTIONS
-I/path/to/arrow/cpp/build/src -I/path/to/arrow/cpp/src
-I/path/to/arrow/cpp/src/generated
-I/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/include
-I/path/to/arrow/cpp/build/_deps/spdlog-src/include -isystem
/opt/homebrew/include -fno-aligned-new -Qunused-arguments -fcolor-diagnostics
-Wall -Wextra -Wdocumentation -DARROW_WARN_DOCUMENTATION -Wshorten-64-to-32
-Wno-missing-braces -Wno-unused-parameter -Wno-constant-logical-operand
-Wno-return-stack-address -Wdate-time -Wno-unknown-warning-option
-Wno-pass-failed -march=armv8-a -g -Werror -O0 -ggdb -std=c++17 -arch arm64
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/
MacOSX.platform/Developer/SDKs/MacOSX.sdk -fPIC -MD -MT
src/arrow/flight/sql/odbc/odbcabstraction/CMakeFiles/odbcabstraction.dir/odbc_impl/odbc_descriptor.cc.o
-MF
src/arrow/flight/sql/odbc/odbcabstraction/CMakeFiles/odbcabstraction.dir/odbc_impl/odbc_descriptor.cc.o.d
-o
src/arrow/flight/sql/odbc/odbcabstraction/CMakeFiles/odbcabstraction.dir/odbc_impl/odbc_descriptor.cc.o
-c
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_descriptor.cc
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_descriptor.cc:157:20:
error: comparison of integers of different signs: 'SQLSMALLINT' (aka 'short')
and 'size_type' (aka 'unsigned long') [-Werror,-Wsign-compare]
157 | if (recordNumber > m_records.size()) {
| ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_descriptor.cc:308:20:
error: comparison of integers of different signs: 'SQLSMALLINT' (aka 'short')
and 'size_type' (aka 'unsigned long') [-Werror,-Wsign-compare]
308 | if (recordNumber > m_records.size()) {
| ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_descriptor.cc:480:61:
error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned
long') to 'int' [-Werror,-Wshorten-64-to-32]
480 | m_records[i].m_baseColumnName =
rsmd->GetBaseColumnName(oneBasedIndex);
| ~~~~~~~~~~~~~~~~~
^~~~~~~~~~~~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_descriptor.cc:481:59:
error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned
long') to 'int' [-Werror,-Wshorten-64-to-32]
481 | m_records[i].m_baseTableName =
rsmd->GetBaseTableName(oneBasedIndex);
| ~~~~~~~~~~~~~~~~
^~~~~~~~~~~~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_descriptor.cc:482:55:
error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned
long') to 'int' [-Werror,-Wshorten-64-to-32]
482 | m_records[i].m_catalogName = rsmd->GetCatalogName(oneBasedIndex);
| ~~~~~~~~~~~~~~ ^~~~~~~~~~~~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_descriptor.cc:483:49:
error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned
long') to 'int' [-Werror,-Wshorten-64-to-32]
483 | m_records[i].m_label = rsmd->GetColumnLabel(oneBasedIndex);
| ~~~~~~~~~~~~~~ ^~~~~~~~~~~~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_descriptor.cc:484:59:
error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned
long') to 'int' [-Werror,-Wshorten-64-to-32]
484 | m_records[i].m_literalPrefix =
rsmd->GetLiteralPrefix(oneBasedIndex);
| ~~~~~~~~~~~~~~~~
^~~~~~~~~~~~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_descriptor.cc:485:59:
error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned
long') to 'int' [-Werror,-Wshorten-64-to-32]
485 | m_records[i].m_literalSuffix =
rsmd->GetLiteralSuffix(oneBasedIndex);
| ~~~~~~~~~~~~~~~~
^~~~~~~~~~~~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_descriptor.cc:486:59:
error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned
long') to 'int' [-Werror,-Wshorten-64-to-32]
486 | m_records[i].m_localTypeName =
rsmd->GetLocalTypeName(oneBasedIndex);
| ~~~~~~~~~~~~~~~~
^~~~~~~~~~~~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_descriptor.cc:487:41:
error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned
long') to 'int' [-Werror,-Wshorten-64-to-32]
487 | m_records[i].m_name = rsmd->GetName(oneBasedIndex);
| ~~~~~~~ ^~~~~~~~~~~~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_descriptor.cc:488:53:
error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned
long') to 'int' [-Werror,-Wshorten-64-to-32]
488 | m_records[i].m_schemaName = rsmd->GetSchemaName(oneBasedIndex);
| ~~~~~~~~~~~~~ ^~~~~~~~~~~~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_descriptor.cc:489:51:
error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned
long') to 'int' [-Werror,-Wshorten-64-to-32]
489 | m_records[i].m_tableName = rsmd->GetTableName(oneBasedIndex);
| ~~~~~~~~~~~~ ^~~~~~~~~~~~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_descriptor.cc:490:49:
error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned
long') to 'int' [-Werror,-Wshorten-64-to-32]
490 | m_records[i].m_typeName = rsmd->GetTypeName(oneBasedIndex);
| ~~~~~~~~~~~ ^~~~~~~~~~~~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_descriptor.cc:492:55:
error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned
long') to 'int' [-Werror,-Wshorten-64-to-32]
492 |
GetSqlTypeForODBCVersion(rsmd->GetConciseType(oneBasedIndex), m_is2xConnection);
| ~~~~~~~~~~~~~~ ^~~~~~~~~~~~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_descriptor.cc:495:61:
error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned
long') to 'int' [-Werror,-Wshorten-64-to-32]
495 | m_records[i].m_displaySize =
rsmd->GetColumnDisplaySize(oneBasedIndex);
| ~~~~~~~~~~~~~~~~~~~~
^~~~~~~~~~~~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_descriptor.cc:496:55:
error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned
long') to 'int' [-Werror,-Wshorten-64-to-32]
496 | m_records[i].m_octetLength = rsmd->GetOctetLength(oneBasedIndex);
| ~~~~~~~~~~~~~~ ^~~~~~~~~~~~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_descriptor.cc:497:45:
error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned
long') to 'int' [-Werror,-Wshorten-64-to-32]
497 | m_records[i].m_length = rsmd->GetLength(oneBasedIndex);
| ~~~~~~~~~ ^~~~~~~~~~~~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_descriptor.cc:499:28:
error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned
long') to 'int' [-Werror,-Wshorten-64-to-32]
499 | rsmd->IsAutoUnique(oneBasedIndex) ? SQL_TRUE : SQL_FALSE;
| ~~~~~~~~~~~~ ^~~~~~~~~~~~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_descriptor.cc:501:31:
error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned
long') to 'int' [-Werror,-Wshorten-64-to-32]
501 | rsmd->IsCaseSensitive(oneBasedIndex) ? SQL_TRUE : SQL_FALSE;
| ~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
[5/619] Building CXX object
src/arrow/flight/sql/odbc/odbcabstraction/CMakeFiles/odbcabstraction.dir/odbc_impl/odbc_statement.cc.o
FAILED:
src/arrow/flight/sql/odbc/odbcabstraction/CMakeFiles/odbcabstraction.dir/odbc_impl/odbc_statement.cc.o
/opt/homebrew/bin/ccache
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-DARROW_HAVE_NEON -DARROW_WITH_TIMING_TESTS -DFMT_HEADER_ONLY
-DGRPC_ENABLE_ASYNC
-DGRPC_NAMESPACE_FOR_TLS_CREDENTIALS_OPTIONS=grpc::experimental
-DGRPC_USE_CERTIFICATE_VERIFIER -DGRPC_USE_TLS_CHANNEL_CREDENTIALS_OPTIONS
-I/path/to/arrow/cpp/build/src -I/path/to/arrow/cpp/src
-I/path/to/arrow/cpp/src/generated
-I/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/include
-I/path/to/arrow/cpp/build/_deps/spdlog-src/include -isystem
/opt/homebrew/include -fno-aligned-new -Qunused-arguments -fcolor-diagnostics
-Wall -Wextra -Wdocumentation -DARROW_WARN_DOCUMENTATION -Wshorten-64-to-32
-Wno-missing-braces -Wno-unused-parameter -Wno-constant-logical-operand
-Wno-return-stack-address -Wdate-time -Wno-unknown-warning-option
-Wno-pass-failed -march=armv8-a -g -Werror -O0 -ggdb -std=c++17 -arch arm64
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/
MacOSX.platform/Developer/SDKs/MacOSX.sdk -fPIC -MD -MT
src/arrow/flight/sql/odbc/odbcabstraction/CMakeFiles/odbcabstraction.dir/odbc_impl/odbc_statement.cc.o
-MF
src/arrow/flight/sql/odbc/odbcabstraction/CMakeFiles/odbcabstraction.dir/odbc_impl/odbc_statement.cc.o.d
-o
src/arrow/flight/sql/odbc/odbcabstraction/CMakeFiles/odbcabstraction.dir/odbc_impl/odbc_statement.cc.o
-c
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_statement.cc
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_statement.cc:329:38:
error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned
long') to 'int' [-Werror,-Wshorten-64-to-32]
329 | m_currenResult->BindColumn(i + 1, ardRecord.m_type,
ardRecord.m_precision,
| ~~~~~~~~~~ ~~^~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_statement.cc:333:38:
error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned
long') to 'int' [-Werror,-Wshorten-64-to-32]
333 | m_currenResult->BindColumn(i + 1,
| ~~~~~~~~~~ ~~^~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_statement.cc:699:27:
error: comparison of integers of different signs: 'SQLSMALLINT' (aka 'short')
and 'size_type' (aka 'unsigned long') [-Werror,-Wsign-compare]
699 | } else if (recordNumber > m_ird->GetRecords().size()) {
| ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_statement.cc:711:22:
error: comparison of integers of different signs: 'SQLSMALLINT' (aka 'short')
and 'size_type' (aka 'unsigned long') [-Werror,-Wsign-compare]
711 | if (recordNumber > m_currentArd->GetRecords().size()) {
| ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/path/to/arrow/cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_statement.cc:724:22:
error: comparison of integers of different signs: 'SQLSMALLINT' (aka 'short')
and 'size_type' (aka 'unsigned long') [-Werror,-Wsign-compare]
724 | if (recordNumber <= m_currentArd->GetRecords().size()) {
| ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 errors generated.
[10/619] Building CXX object
src/arrow/engine/CMakeFiles/arrow_substrait_objlib.dir/substrait/relation_internal.cc.o
ninja: build stopped: subcommand failed.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]