Skip to content

Commit cca41a3

Browse files
authored
GH-50000: [C++][FlightRPC] Use grpcpp/grpcpp.h not grpcpp/version_info.h for old gRPC (#50001)
### Rationale for this change `gRPC 1.51.0` introduced `grpcpp/version_info.h`. Since we also use older versions we should guard against import in case of older version. ### What changes are included in this PR? Use `grpcpp/grpcpp.h` not `grpcpp/version_info.h`. `grpcpp/grpcpp.h` is provided by old gRPC. ### Are these changes tested? By CI. ### Are there any user-facing changes? No. * GitHub Issue: #50000 Authored-by: Rok Mihevc <rok@mihevc.org> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
1 parent 2984d23 commit cca41a3

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

cpp/src/arrow/flight/transport/grpc/util_internal.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,23 @@
1717

1818
#pragma once
1919

20-
#include <grpcpp/version_info.h>
20+
#include <grpcpp/grpcpp.h>
2121

2222
#include "arrow/flight/transport/grpc/protocol_grpc_internal.h"
2323
#include "arrow/flight/types.h"
2424
#include "arrow/flight/visibility.h"
2525
#include "arrow/util/macros.h"
2626

27-
#define GRPC_CPP_VERSION_CHECK(major, minor, patch) \
28-
((GRPC_CPP_VERSION_MAJOR > (major) || \
29-
(GRPC_CPP_VERSION_MAJOR == (major) && GRPC_CPP_VERSION_MINOR > (minor)) || \
30-
((GRPC_CPP_VERSION_MAJOR == (major) && GRPC_CPP_VERSION_MINOR == (minor) && \
31-
GRPC_CPP_VERSION_PATCH >= (patch)))))
27+
// gRPC 1.51.0 or later defines GRPC_CPP_VERSION_MAJOR and so on.
28+
#ifdef GRPC_CPP_VERSION_MAJOR
29+
# define GRPC_CPP_VERSION_CHECK(major, minor, patch) \
30+
((GRPC_CPP_VERSION_MAJOR > (major) || \
31+
(GRPC_CPP_VERSION_MAJOR == (major) && GRPC_CPP_VERSION_MINOR > (minor)) || \
32+
((GRPC_CPP_VERSION_MAJOR == (major) && GRPC_CPP_VERSION_MINOR == (minor) && \
33+
GRPC_CPP_VERSION_PATCH >= (patch)))))
34+
#else
35+
# define GRPC_CPP_VERSION_CHECK(major, minor, patch) 0
36+
#endif
3237

3338
#if GRPC_CPP_VERSION_CHECK(1, 80, 0)
3439
# include <absl/status/status.h>

0 commit comments

Comments
 (0)