From cf7ab123a280155425bec0c3e9c5b6ebed631e0d Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Sat, 7 Dec 2024 07:33:38 +0100 Subject: [PATCH] GH-44954: [C++][CI] Silence protobuf-generated deprecations (#44955) ### Rationale for this change ### What changes are included in this PR? ### Are these changes tested? ### Are there any user-facing changes? * GitHub Issue: #44954 Lead-authored-by: Antoine Pitrou Co-authored-by: Jacob Wujciak-Jens Co-authored-by: Antoine Pitrou Signed-off-by: Sutou Kouhei --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 13 +++++++++---- .../arrow/engine/substrait/expression_internal.h | 4 ++++ .../engine/substrait/extended_expression_internal.h | 4 ++++ cpp/src/arrow/engine/substrait/plan_internal.h | 4 ++++ cpp/src/arrow/engine/substrait/relation_internal.h | 4 ++++ cpp/src/arrow/engine/substrait/test_plan_builder.cc | 6 +++++- cpp/src/arrow/engine/substrait/util_internal.h | 4 ++++ cpp/src/arrow/flight/sql/client.cc | 4 ++++ cpp/src/arrow/flight/sql/protocol_internal.cc | 5 +++++ cpp/src/arrow/flight/sql/protocol_internal.h | 3 +++ cpp/src/arrow/flight/sql/server.cc | 7 +++++++ 11 files changed, 53 insertions(+), 5 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 35ad4089e7f91..a7d509de10ef1 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -2061,10 +2061,14 @@ macro(build_substrait) # Missing dll-interface: list(APPEND SUBSTRAIT_SUPPRESSED_FLAGS "/wd4251") - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL - "Clang") - # Protobuf generated files trigger some errors on CLANG TSAN builds - list(APPEND SUBSTRAIT_SUPPRESSED_FLAGS "-Wno-error=shorten-64-to-32") + else() + # GH-44954: silence [[deprecated]] declarations in protobuf-generated code + list(APPEND SUBSTRAIT_SUPPRESSED_FLAGS "-Wno-deprecated") + if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL + "Clang") + # Protobuf generated files trigger some errors on CLANG TSAN builds + list(APPEND SUBSTRAIT_SUPPRESSED_FLAGS "-Wno-error=shorten-64-to-32") + endif() endif() set(SUBSTRAIT_SOURCES) @@ -2116,6 +2120,7 @@ macro(build_substrait) add_library(substrait STATIC ${SUBSTRAIT_SOURCES}) set_target_properties(substrait PROPERTIES POSITION_INDEPENDENT_CODE ON) + target_compile_options(substrait PRIVATE "${SUBSTRAIT_SUPPRESSED_FLAGS}") target_include_directories(substrait PUBLIC ${SUBSTRAIT_INCLUDES}) target_link_libraries(substrait PUBLIC ${ARROW_PROTOBUF_LIBPROTOBUF}) add_dependencies(substrait substrait_gen) diff --git a/cpp/src/arrow/engine/substrait/expression_internal.h b/cpp/src/arrow/engine/substrait/expression_internal.h index 2ce2ee76af20b..a9f8949c23249 100644 --- a/cpp/src/arrow/engine/substrait/expression_internal.h +++ b/cpp/src/arrow/engine/substrait/expression_internal.h @@ -27,8 +27,12 @@ #include "arrow/engine/substrait/type_fwd.h" #include "arrow/engine/substrait/visibility.h" #include "arrow/result.h" +#include "arrow/util/macros.h" +// GH-44954: silence [[deprecated]] declarations in protobuf-generated code +ARROW_SUPPRESS_DEPRECATION_WARNING #include "substrait/algebra.pb.h" // IWYU pragma: export +ARROW_UNSUPPRESS_DEPRECATION_WARNING namespace arrow { namespace engine { diff --git a/cpp/src/arrow/engine/substrait/extended_expression_internal.h b/cpp/src/arrow/engine/substrait/extended_expression_internal.h index 81bc4b8745186..45f89c8610b5a 100644 --- a/cpp/src/arrow/engine/substrait/extended_expression_internal.h +++ b/cpp/src/arrow/engine/substrait/extended_expression_internal.h @@ -28,8 +28,12 @@ #include "arrow/engine/substrait/visibility.h" #include "arrow/result.h" #include "arrow/status.h" +#include "arrow/util/macros.h" +// GH-44954: silence [[deprecated]] declarations in protobuf-generated code +ARROW_SUPPRESS_DEPRECATION_WARNING #include "substrait/extended_expression.pb.h" // IWYU pragma: export +ARROW_UNSUPPRESS_DEPRECATION_WARNING namespace arrow { namespace engine { diff --git a/cpp/src/arrow/engine/substrait/plan_internal.h b/cpp/src/arrow/engine/substrait/plan_internal.h index 737e65b7e2e74..f2e7ded5f01e9 100644 --- a/cpp/src/arrow/engine/substrait/plan_internal.h +++ b/cpp/src/arrow/engine/substrait/plan_internal.h @@ -27,8 +27,12 @@ #include "arrow/engine/substrait/visibility.h" #include "arrow/result.h" #include "arrow/status.h" +#include "arrow/util/macros.h" +// GH-44954: silence [[deprecated]] declarations in protobuf-generated code +ARROW_SUPPRESS_DEPRECATION_WARNING #include "substrait/plan.pb.h" // IWYU pragma: export +ARROW_UNSUPPRESS_DEPRECATION_WARNING namespace arrow { namespace engine { diff --git a/cpp/src/arrow/engine/substrait/relation_internal.h b/cpp/src/arrow/engine/substrait/relation_internal.h index a436f1770d78b..2a96d0024e693 100644 --- a/cpp/src/arrow/engine/substrait/relation_internal.h +++ b/cpp/src/arrow/engine/substrait/relation_internal.h @@ -28,8 +28,12 @@ #include "arrow/engine/substrait/type_fwd.h" #include "arrow/engine/substrait/visibility.h" #include "arrow/result.h" +#include "arrow/util/macros.h" +// GH-44954: silence [[deprecated]] declarations in protobuf-generated code +ARROW_SUPPRESS_DEPRECATION_WARNING #include "substrait/algebra.pb.h" // IWYU pragma: export +ARROW_UNSUPPRESS_DEPRECATION_WARNING namespace arrow { namespace engine { diff --git a/cpp/src/arrow/engine/substrait/test_plan_builder.cc b/cpp/src/arrow/engine/substrait/test_plan_builder.cc index f38f7ece9a751..724c58277e725 100644 --- a/cpp/src/arrow/engine/substrait/test_plan_builder.cc +++ b/cpp/src/arrow/engine/substrait/test_plan_builder.cc @@ -31,8 +31,12 @@ #include "arrow/status.h" #include "arrow/table.h" #include "arrow/type_fwd.h" +#include "arrow/util/macros.h" -#include "substrait/algebra.pb.h" +// GH-44954: silence [[deprecated]] declarations in protobuf-generated code +ARROW_SUPPRESS_DEPRECATION_WARNING +#include "substrait/algebra.pb.h" // IWYU pragma: export +ARROW_UNSUPPRESS_DEPRECATION_WARNING namespace arrow { namespace engine { diff --git a/cpp/src/arrow/engine/substrait/util_internal.h b/cpp/src/arrow/engine/substrait/util_internal.h index 627ad1126df6e..d812bbf7b85ff 100644 --- a/cpp/src/arrow/engine/substrait/util_internal.h +++ b/cpp/src/arrow/engine/substrait/util_internal.h @@ -24,10 +24,14 @@ #include "arrow/engine/substrait/visibility.h" #include "arrow/result.h" #include "arrow/util/hashing.h" +#include "arrow/util/macros.h" #include "arrow/util/unreachable.h" +// GH-44954: silence [[deprecated]] declarations in protobuf-generated code +ARROW_SUPPRESS_DEPRECATION_WARNING #include "substrait/algebra.pb.h" // IWYU pragma: export #include "substrait/plan.pb.h" // IWYU pragma: export +ARROW_UNSUPPRESS_DEPRECATION_WARNING namespace arrow { namespace engine { diff --git a/cpp/src/arrow/flight/sql/client.cc b/cpp/src/arrow/flight/sql/client.cc index 536bc67fc586d..fe087cc947de5 100644 --- a/cpp/src/arrow/flight/sql/client.cc +++ b/cpp/src/arrow/flight/sql/client.cc @@ -31,6 +31,7 @@ #include "arrow/ipc/reader.h" #include "arrow/result.h" #include "arrow/util/logging.h" +#include "arrow/util/macros.h" namespace flight_sql_pb = arrow::flight::protocol::sql; @@ -829,6 +830,8 @@ Status FlightSqlClient::Rollback(const FlightCallOptions& options, return results->Drain(); } +// ActionCancelQuery{Request,Result} are deprecated +ARROW_SUPPRESS_DEPRECATION_WARNING ::arrow::Result FlightSqlClient::CancelQuery( const FlightCallOptions& options, const FlightInfo& info) { flight_sql_pb::ActionCancelQueryRequest cancel_query; @@ -855,6 +858,7 @@ ::arrow::Result FlightSqlClient::CancelQuery( } return Status::IOError("Server returned unknown result ", result.result()); } +ARROW_UNSUPPRESS_DEPRECATION_WARNING Status FlightSqlClient::Close() { return impl_->Close(); } diff --git a/cpp/src/arrow/flight/sql/protocol_internal.cc b/cpp/src/arrow/flight/sql/protocol_internal.cc index 0d5e3c4c60b8d..984e78222336e 100644 --- a/cpp/src/arrow/flight/sql/protocol_internal.cc +++ b/cpp/src/arrow/flight/sql/protocol_internal.cc @@ -14,6 +14,10 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations +#include "arrow/util/macros.h" + +// GH-44954: silence [[deprecated]] declarations in protobuf-generated code +ARROW_SUPPRESS_DEPRECATION_WARNING #include "arrow/flight/sql/protocol_internal.h" // NOTE(lidavidm): Normally this is forbidden, but on Windows to get @@ -21,3 +25,4 @@ // ensure our header gets included (and Protobuf will not insert the // include for you) #include "arrow/flight/sql/FlightSql.pb.cc" // NOLINT +ARROW_UNSUPPRESS_DEPRECATION_WARNING diff --git a/cpp/src/arrow/flight/sql/protocol_internal.h b/cpp/src/arrow/flight/sql/protocol_internal.h index ce50ad2f61b1e..09bfe32582a89 100644 --- a/cpp/src/arrow/flight/sql/protocol_internal.h +++ b/cpp/src/arrow/flight/sql/protocol_internal.h @@ -18,9 +18,12 @@ // This addresses platform-specific defines, e.g. on Windows #include "arrow/flight/platform.h" // IWYU pragma: keep +#include "arrow/util/macros.h" // This header holds the Flight SQL definitions. #include "arrow/flight/sql/visibility.h" +ARROW_SUPPRESS_DEPRECATION_WARNING #include "arrow/flight/sql/FlightSql.pb.h" // IWYU pragma: export +ARROW_UNSUPPRESS_DEPRECATION_WARNING diff --git a/cpp/src/arrow/flight/sql/server.cc b/cpp/src/arrow/flight/sql/server.cc index 5f6154a576b02..f68d884c6211b 100644 --- a/cpp/src/arrow/flight/sql/server.cc +++ b/cpp/src/arrow/flight/sql/server.cc @@ -31,6 +31,7 @@ #include "arrow/flight/sql/sql_info_internal.h" #include "arrow/type.h" #include "arrow/util/checked_cast.h" +#include "arrow/util/macros.h" #define PROPERTY_TO_OPTIONAL(COMMAND, PROPERTY) \ COMMAND.has_##PROPERTY() ? std::make_optional(COMMAND.PROPERTY()) : std::nullopt @@ -337,6 +338,8 @@ arrow::Result ParseActionBeginTransactionRequest( return result; } +// ActionCancelQueryRequest is deprecated +ARROW_SUPPRESS_DEPRECATION_WARNING arrow::Result ParseActionCancelQueryRequest( const Action& action) { pb::sql::ActionCancelQueryRequest command; @@ -346,6 +349,7 @@ arrow::Result ParseActionCancelQueryRequest( ARROW_ASSIGN_OR_RAISE(result.info, FlightInfo::Deserialize(command.info())); return result; } +ARROW_UNSUPPRESS_DEPRECATION_WARNING arrow::Result ParseActionCreatePreparedStatementRequest(const Action& action) { @@ -468,6 +472,8 @@ arrow::Result PackActionResult(const FlightEndpoint& endpoint) { return endpoint.SerializeToBuffer(); } +// ActionCancelQueryResult is deprecated +ARROW_SUPPRESS_DEPRECATION_WARNING arrow::Result PackActionResult(CancelResult result) { pb::sql::ActionCancelQueryResult pb_result; switch (result) { @@ -487,6 +493,7 @@ arrow::Result PackActionResult(CancelResult result) { } return PackActionResult(pb_result); } +ARROW_UNSUPPRESS_DEPRECATION_WARNING arrow::Result PackActionResult(ActionCreatePreparedStatementResult result) { pb::sql::ActionCreatePreparedStatementResult pb_result;