Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion c/driver/framework/statement.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,12 @@ class Statement : public BaseStatement<Derived> {
// No-op
return status::Ok();
} else if constexpr (std::is_same_v<T, QueryState>) {
UNWRAP_STATUS(impl().PrepareImpl(state));
// unwrap macro appears to fail due to -Wc2y-extensions
// which for some reason doesn't get suppressed here
auto status = impl().PrepareImpl(state);
if (!status.ok()) {
return status;
}
state_ = PreparedState{std::move(state.query)};
return status::Ok();
} else {
Expand Down
47 changes: 36 additions & 11 deletions c/driver/framework/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@

/// \file status.h

#if defined(__clang__)
// See https://github.com/google/benchmark/pull/2108
#define IGNORE_COUNTER_WARNING \
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wunknown-warning-option\""); \
_Pragma("GCC diagnostic ignored \"-Wc2y-extensions\"");
#define RESTORE_COUNTER_WARNING _Pragma("GCC diagnostic pop")
#else
#define IGNORE_COUNTER_WARNING
#define RESTORE_COUNTER_WARNING
#endif

namespace adbc::driver {

/// \brief A wrapper around AdbcStatusCode + AdbcError.
Expand Down Expand Up @@ -274,17 +286,26 @@ class Result {
#define UNWRAP_RESULT_NAME(x, y) DRIVER_CONCAT(x, y)

/// \brief A helper to unwrap a Result in functions returning AdbcStatusCode.
#define RAISE_RESULT(ERROR, LHS, RHS) \
RAISE_RESULT_IMPL(UNWRAP_RESULT_NAME(driver_raise_result, __COUNTER__), ERROR, LHS, RHS)
#define RAISE_RESULT(ERROR, LHS, RHS) \
IGNORE_COUNTER_WARNING \
RAISE_RESULT_IMPL(UNWRAP_RESULT_NAME(driver_raise_result, __COUNTER__), ERROR, LHS, \
RHS) \
RESTORE_COUNTER_WARNING
/// \brief A helper to unwrap a Status in functions returning AdbcStatusCode.
#define RAISE_STATUS(ERROR, RHS) \
RAISE_STATUS_IMPL(UNWRAP_RESULT_NAME(driver_raise_status, __COUNTER__), ERROR, RHS)
#define RAISE_STATUS(ERROR, RHS) \
IGNORE_COUNTER_WARNING \
RAISE_STATUS_IMPL(UNWRAP_RESULT_NAME(driver_raise_status, __COUNTER__), ERROR, RHS) \
RESTORE_COUNTER_WARNING
/// \brief A helper to unwrap a Result in functions returning Result/Status.
#define UNWRAP_RESULT(lhs, rhs) \
UNWRAP_RESULT_IMPL(UNWRAP_RESULT_NAME(driver_unwrap_result, __COUNTER__), lhs, rhs)
#define UNWRAP_RESULT(lhs, rhs) \
IGNORE_COUNTER_WARNING \
UNWRAP_RESULT_IMPL(UNWRAP_RESULT_NAME(driver_unwrap_result, __COUNTER__), lhs, rhs) \
RESTORE_COUNTER_WARNING
/// \brief A helper to unwrap a Status in functions returning Result/Status.
#define UNWRAP_STATUS(rhs) \
UNWRAP_STATUS_IMPL(UNWRAP_RESULT_NAME(driver_unwrap_status, __COUNTER__), rhs)
#define UNWRAP_STATUS(rhs) \
IGNORE_COUNTER_WARNING \
UNWRAP_STATUS_IMPL(UNWRAP_RESULT_NAME(driver_unwrap_status, __COUNTER__), rhs) \
RESTORE_COUNTER_WARNING

} // namespace adbc::driver

Expand Down Expand Up @@ -344,8 +365,10 @@ STATUS_CTOR(Unknown, UNKNOWN)
std::strerror(NAME)); \
}

#define UNWRAP_ERRNO(CODE, RHS) \
UNWRAP_ERRNO_IMPL(UNWRAP_RESULT_NAME(driver_errno, __COUNTER__), CODE, RHS)
#define UNWRAP_ERRNO(CODE, RHS) \
IGNORE_COUNTER_WARNING \
UNWRAP_ERRNO_IMPL(UNWRAP_RESULT_NAME(driver_errno, __COUNTER__), CODE, RHS) \
RESTORE_COUNTER_WARNING

#define UNWRAP_NANOARROW_IMPL(NAME, ERROR, CODE, RHS) \
auto&& NAME = (RHS); \
Expand All @@ -355,5 +378,7 @@ STATUS_CTOR(Unknown, UNKNOWN)
}

#define UNWRAP_NANOARROW(ERROR, CODE, RHS) \
IGNORE_COUNTER_WARNING \
UNWRAP_NANOARROW_IMPL(UNWRAP_RESULT_NAME(driver_errno_na, __COUNTER__), ERROR, CODE, \
RHS)
RHS) \
RESTORE_COUNTER_WARNING
24 changes: 21 additions & 3 deletions c/vendor/nanoarrow/nanoarrow.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@
// specific language governing permissions and limitations
// under the License.

#if defined(__clang__)
// See https://github.com/google/benchmark/pull/2108
#define NANOARROW_IGNORE_COUNTER_WARNING \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wunknown-warning-option\"") \
_Pragma("GCC diagnostic ignored \"-Wc2y-extensions\"")
#define NANOARROW_RESTORE_COUNTER_WARNING _Pragma("GCC diagnostic pop")
#else
#define NANOARROW_IGNORE_COUNTER_WARNING
#define NANOARROW_RESTORE_COUNTER_WARNING
#endif

#ifndef NANOARROW_NANOARROW_TYPES_H_INCLUDED
#define NANOARROW_NANOARROW_TYPES_H_INCLUDED

Expand Down Expand Up @@ -305,7 +317,9 @@ static inline void ArrowErrorSetString(struct ArrowError* error, const char* src
/// \brief Check the result of an expression and return it if not NANOARROW_OK
/// \ingroup nanoarrow-errors
#define NANOARROW_RETURN_NOT_OK(EXPR) \
_NANOARROW_RETURN_NOT_OK_IMPL(_NANOARROW_MAKE_NAME(errno_status_, __COUNTER__), EXPR)
NANOARROW_IGNORE_COUNTER_WARNING \
_NANOARROW_RETURN_NOT_OK_IMPL(_NANOARROW_MAKE_NAME(errno_status_, __COUNTER__), EXPR) \
NANOARROW_RESTORE_COUNTER_WARNING

/// \brief Check the result of an expression and return it if not NANOARROW_OK,
/// adding an auto-generated message to an ArrowError.
Expand All @@ -315,8 +329,10 @@ static inline void ArrowErrorSetString(struct ArrowError* error, const char* src
/// as input always set its message when returning an error code (e.g., when calling
/// a nanoarrow function that does *not* accept ArrowError).
#define NANOARROW_RETURN_NOT_OK_WITH_ERROR(EXPR, ERROR_EXPR) \
NANOARROW_IGNORE_COUNTER_WARNING \
_NANOARROW_RETURN_NOT_OK_WITH_ERROR_IMPL( \
_NANOARROW_MAKE_NAME(errno_status_, __COUNTER__), EXPR, ERROR_EXPR, #EXPR)
_NANOARROW_MAKE_NAME(errno_status_, __COUNTER__), EXPR, ERROR_EXPR, #EXPR) \
NANOARROW_RESTORE_COUNTER_WARNING

#if defined(NANOARROW_DEBUG) && !defined(NANOARROW_PRINT_AND_DIE)
#define NANOARROW_PRINT_AND_DIE(VALUE, EXPR_STR) \
Expand All @@ -343,7 +359,9 @@ static inline void ArrowErrorSetString(struct ArrowError* error, const char* src
/// be defining the NANOARROW_PRINT_AND_DIE macro before including nanoarrow.h
/// This macro is provided as a convenience for users and is not used internally.
#define NANOARROW_ASSERT_OK(EXPR) \
_NANOARROW_ASSERT_OK_IMPL(_NANOARROW_MAKE_NAME(errno_status_, __COUNTER__), EXPR, #EXPR)
NANOARROW_IGNORE_COUNTER_WARNING \
_NANOARROW_ASSERT_OK_IMPL(_NANOARROW_MAKE_NAME(errno_status_, __COUNTER__), EXPR, #EXPR) \
NANOARROW_RESTORE_COUNTER_WARNING

#define _NANOARROW_DCHECK_IMPL(EXPR, EXPR_STR) \
do { \
Expand Down
Loading