3434
3535// / \file status.h
3636
37+ #if defined(__clang__)
38+ // See https://github.com/google/benchmark/pull/2108
39+ #define IGNORE_COUNTER_WARNING \
40+ _Pragma (" GCC diagnostic push" ); \
41+ _Pragma (" GCC diagnostic ignored \" -Wunknown-warning-option\" " ); \
42+ _Pragma (" GCC diagnostic ignored \" -Wc2y-extensions\" " );
43+ #define RESTORE_COUNTER_WARNING _Pragma (" GCC diagnostic pop" )
44+ #else
45+ #define IGNORE_COUNTER_WARNING
46+ #define RESTORE_COUNTER_WARNING
47+ #endif
48+
3749namespace adbc ::driver {
3850
3951// / \brief A wrapper around AdbcStatusCode + AdbcError.
@@ -274,17 +286,26 @@ class Result {
274286#define UNWRAP_RESULT_NAME (x, y ) DRIVER_CONCAT(x, y)
275287
276288// / \brief A helper to unwrap a Result in functions returning AdbcStatusCode.
277- #define RAISE_RESULT (ERROR, LHS, RHS ) \
278- RAISE_RESULT_IMPL (UNWRAP_RESULT_NAME(driver_raise_result, __COUNTER__), ERROR, LHS, RHS)
289+ #define RAISE_RESULT (ERROR, LHS, RHS ) \
290+ IGNORE_COUNTER_WARNING \
291+ RAISE_RESULT_IMPL (UNWRAP_RESULT_NAME(driver_raise_result, __COUNTER__), ERROR, LHS, \
292+ RHS) \
293+ RESTORE_COUNTER_WARNING
279294// / \brief A helper to unwrap a Status in functions returning AdbcStatusCode.
280- #define RAISE_STATUS (ERROR, RHS ) \
281- RAISE_STATUS_IMPL (UNWRAP_RESULT_NAME(driver_raise_status, __COUNTER__), ERROR, RHS)
295+ #define RAISE_STATUS (ERROR, RHS ) \
296+ IGNORE_COUNTER_WARNING \
297+ RAISE_STATUS_IMPL (UNWRAP_RESULT_NAME(driver_raise_status, __COUNTER__), ERROR, RHS) \
298+ RESTORE_COUNTER_WARNING
282299// / \brief A helper to unwrap a Result in functions returning Result/Status.
283- #define UNWRAP_RESULT (lhs, rhs ) \
284- UNWRAP_RESULT_IMPL (UNWRAP_RESULT_NAME(driver_unwrap_result, __COUNTER__), lhs, rhs)
300+ #define UNWRAP_RESULT (lhs, rhs ) \
301+ IGNORE_COUNTER_WARNING \
302+ UNWRAP_RESULT_IMPL (UNWRAP_RESULT_NAME(driver_unwrap_result, __COUNTER__), lhs, rhs) \
303+ RESTORE_COUNTER_WARNING
285304// / \brief A helper to unwrap a Status in functions returning Result/Status.
286- #define UNWRAP_STATUS (rhs ) \
287- UNWRAP_STATUS_IMPL (UNWRAP_RESULT_NAME(driver_unwrap_status, __COUNTER__), rhs)
305+ #define UNWRAP_STATUS (rhs ) \
306+ IGNORE_COUNTER_WARNING \
307+ UNWRAP_STATUS_IMPL (UNWRAP_RESULT_NAME(driver_unwrap_status, __COUNTER__), rhs) \
308+ RESTORE_COUNTER_WARNING
288309
289310} // namespace adbc::driver
290311
@@ -344,8 +365,10 @@ STATUS_CTOR(Unknown, UNKNOWN)
344365 std::strerror (NAME)); \
345366 }
346367
347- #define UNWRAP_ERRNO (CODE, RHS ) \
348- UNWRAP_ERRNO_IMPL (UNWRAP_RESULT_NAME(driver_errno, __COUNTER__), CODE, RHS)
368+ #define UNWRAP_ERRNO (CODE, RHS ) \
369+ IGNORE_COUNTER_WARNING \
370+ UNWRAP_ERRNO_IMPL (UNWRAP_RESULT_NAME(driver_errno, __COUNTER__), CODE, RHS) \
371+ RESTORE_COUNTER_WARNING
349372
350373#define UNWRAP_NANOARROW_IMPL (NAME, ERROR, CODE, RHS ) \
351374 auto && NAME = (RHS); \
@@ -355,5 +378,7 @@ STATUS_CTOR(Unknown, UNKNOWN)
355378 }
356379
357380#define UNWRAP_NANOARROW (ERROR, CODE, RHS ) \
381+ IGNORE_COUNTER_WARNING \
358382 UNWRAP_NANOARROW_IMPL (UNWRAP_RESULT_NAME(driver_errno_na, __COUNTER__), ERROR, CODE, \
359- RHS)
383+ RHS) \
384+ RESTORE_COUNTER_WARNING
0 commit comments