From 1ef87351f8f242d2e3286c12f1b8363fd84e2970 Mon Sep 17 00:00:00 2001 From: Rok Mihevc Date: Wed, 20 May 2026 12:16:59 +0200 Subject: [PATCH 1/3] initial commit --- cpp/src/arrow/flight/transport/grpc/util_internal.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cpp/src/arrow/flight/transport/grpc/util_internal.h b/cpp/src/arrow/flight/transport/grpc/util_internal.h index 6ff3dadb53c..bc5dfdb4eec 100644 --- a/cpp/src/arrow/flight/transport/grpc/util_internal.h +++ b/cpp/src/arrow/flight/transport/grpc/util_internal.h @@ -17,7 +17,11 @@ #pragma once -#include +#if defined(__has_include) +# if __has_include() +# include +# endif +#endif #include "arrow/flight/transport/grpc/protocol_grpc_internal.h" #include "arrow/flight/types.h" From 0acaecd25a47d3434664f7c34cf54140f3a14cdb Mon Sep 17 00:00:00 2001 From: Rok Mihevc Date: Wed, 20 May 2026 13:07:50 +0200 Subject: [PATCH 2/3] Review feedback --- cpp/src/arrow/flight/transport/grpc/util_internal.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cpp/src/arrow/flight/transport/grpc/util_internal.h b/cpp/src/arrow/flight/transport/grpc/util_internal.h index bc5dfdb4eec..e303510f2d5 100644 --- a/cpp/src/arrow/flight/transport/grpc/util_internal.h +++ b/cpp/src/arrow/flight/transport/grpc/util_internal.h @@ -17,17 +17,20 @@ #pragma once +#include "arrow/flight/transport/grpc/protocol_grpc_internal.h" +#include "arrow/flight/types.h" +#include "arrow/flight/visibility.h" +#include "arrow/util/macros.h" + +// was added in gRPC 1.80 and is the only place that +// defines GRPC_CPP_VERSION_{MAJOR,MINOR,PATCH}. We can't guard it with +// GRPC_CPP_VERSION_CHECK itself so we use __has_include. #if defined(__has_include) # if __has_include() # include # endif #endif -#include "arrow/flight/transport/grpc/protocol_grpc_internal.h" -#include "arrow/flight/types.h" -#include "arrow/flight/visibility.h" -#include "arrow/util/macros.h" - #define GRPC_CPP_VERSION_CHECK(major, minor, patch) \ ((GRPC_CPP_VERSION_MAJOR > (major) || \ (GRPC_CPP_VERSION_MAJOR == (major) && GRPC_CPP_VERSION_MINOR > (minor)) || \ From c351919c141d96141d70d5ee4d6b7992f80b6bbc Mon Sep 17 00:00:00 2001 From: Rok Mihevc Date: Wed, 20 May 2026 14:09:56 +0200 Subject: [PATCH 3/3] Apply review suggestion --- .../flight/transport/grpc/util_internal.h | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/cpp/src/arrow/flight/transport/grpc/util_internal.h b/cpp/src/arrow/flight/transport/grpc/util_internal.h index e303510f2d5..7e306d574a5 100644 --- a/cpp/src/arrow/flight/transport/grpc/util_internal.h +++ b/cpp/src/arrow/flight/transport/grpc/util_internal.h @@ -17,26 +17,24 @@ #pragma once +#include + #include "arrow/flight/transport/grpc/protocol_grpc_internal.h" #include "arrow/flight/types.h" #include "arrow/flight/visibility.h" #include "arrow/util/macros.h" -// was added in gRPC 1.80 and is the only place that -// defines GRPC_CPP_VERSION_{MAJOR,MINOR,PATCH}. We can't guard it with -// GRPC_CPP_VERSION_CHECK itself so we use __has_include. -#if defined(__has_include) -# if __has_include() -# include -# endif +// gRPC 1.51.0 or later defines GRPC_CPP_VERSION_MAJOR and so on. +#ifdef GRPC_CPP_VERSION_MAJOR +# define GRPC_CPP_VERSION_CHECK(major, minor, patch) \ + ((GRPC_CPP_VERSION_MAJOR > (major) || \ + (GRPC_CPP_VERSION_MAJOR == (major) && GRPC_CPP_VERSION_MINOR > (minor)) || \ + ((GRPC_CPP_VERSION_MAJOR == (major) && GRPC_CPP_VERSION_MINOR == (minor) && \ + GRPC_CPP_VERSION_PATCH >= (patch))))) +#else +# define GRPC_CPP_VERSION_CHECK(major, minor, patch) 0 #endif -#define GRPC_CPP_VERSION_CHECK(major, minor, patch) \ - ((GRPC_CPP_VERSION_MAJOR > (major) || \ - (GRPC_CPP_VERSION_MAJOR == (major) && GRPC_CPP_VERSION_MINOR > (minor)) || \ - ((GRPC_CPP_VERSION_MAJOR == (major) && GRPC_CPP_VERSION_MINOR == (minor) && \ - GRPC_CPP_VERSION_PATCH >= (patch))))) - #if GRPC_CPP_VERSION_CHECK(1, 80, 0) # include #endif