Skip to content

Commit

Permalink
GH-44954: [C++][CI] Silence protobuf-generated deprecations (#44955)
Browse files Browse the repository at this point in the history
### 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 <[email protected]>
Co-authored-by: Jacob Wujciak-Jens <[email protected]>
Co-authored-by: Antoine Pitrou <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
  • Loading branch information
3 people authored Dec 7, 2024
1 parent 9907f37 commit cf7ab12
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 5 deletions.
13 changes: 9 additions & 4 deletions cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions cpp/src/arrow/engine/substrait/expression_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions cpp/src/arrow/engine/substrait/extended_expression_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions cpp/src/arrow/engine/substrait/plan_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions cpp/src/arrow/engine/substrait/relation_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 5 additions & 1 deletion cpp/src/arrow/engine/substrait/test_plan_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions cpp/src/arrow/engine/substrait/util_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions cpp/src/arrow/flight/sql/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -829,6 +830,8 @@ Status FlightSqlClient::Rollback(const FlightCallOptions& options,
return results->Drain();
}

// ActionCancelQuery{Request,Result} are deprecated
ARROW_SUPPRESS_DEPRECATION_WARNING
::arrow::Result<CancelResult> FlightSqlClient::CancelQuery(
const FlightCallOptions& options, const FlightInfo& info) {
flight_sql_pb::ActionCancelQueryRequest cancel_query;
Expand All @@ -855,6 +858,7 @@ ::arrow::Result<CancelResult> FlightSqlClient::CancelQuery(
}
return Status::IOError("Server returned unknown result ", result.result());
}
ARROW_UNSUPPRESS_DEPRECATION_WARNING

Status FlightSqlClient::Close() { return impl_->Close(); }

Expand Down
5 changes: 5 additions & 0 deletions cpp/src/arrow/flight/sql/protocol_internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@
// 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
// the dllexport/dllimport macro in the right places, we need to
// 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
3 changes: 3 additions & 0 deletions cpp/src/arrow/flight/sql/protocol_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions cpp/src/arrow/flight/sql/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -337,6 +338,8 @@ arrow::Result<ActionBeginTransactionRequest> ParseActionBeginTransactionRequest(
return result;
}

// ActionCancelQueryRequest is deprecated
ARROW_SUPPRESS_DEPRECATION_WARNING
arrow::Result<ActionCancelQueryRequest> ParseActionCancelQueryRequest(
const Action& action) {
pb::sql::ActionCancelQueryRequest command;
Expand All @@ -346,6 +349,7 @@ arrow::Result<ActionCancelQueryRequest> ParseActionCancelQueryRequest(
ARROW_ASSIGN_OR_RAISE(result.info, FlightInfo::Deserialize(command.info()));
return result;
}
ARROW_UNSUPPRESS_DEPRECATION_WARNING

arrow::Result<ActionCreatePreparedStatementRequest>
ParseActionCreatePreparedStatementRequest(const Action& action) {
Expand Down Expand Up @@ -468,6 +472,8 @@ arrow::Result<Result> PackActionResult(const FlightEndpoint& endpoint) {
return endpoint.SerializeToBuffer();
}

// ActionCancelQueryResult is deprecated
ARROW_SUPPRESS_DEPRECATION_WARNING
arrow::Result<Result> PackActionResult(CancelResult result) {
pb::sql::ActionCancelQueryResult pb_result;
switch (result) {
Expand All @@ -487,6 +493,7 @@ arrow::Result<Result> PackActionResult(CancelResult result) {
}
return PackActionResult(pb_result);
}
ARROW_UNSUPPRESS_DEPRECATION_WARNING

arrow::Result<Result> PackActionResult(ActionCreatePreparedStatementResult result) {
pb::sql::ActionCreatePreparedStatementResult pb_result;
Expand Down

0 comments on commit cf7ab12

Please sign in to comment.