You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2019/01/20 21:21:04 UTC
[arrow] branch master updated: ARROW-4252: [C++] Fix missing Status
code and newline
This is an automated email from the ASF dual-hosted git repository.
wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new 9855e94 ARROW-4252: [C++] Fix missing Status code and newline
9855e94 is described below
commit 9855e9479889c9f6af7a076657183be2fa706761
Author: François Saint-Jacques <fs...@gmail.com>
AuthorDate: Sun Jan 20 15:20:56 2019 -0600
ARROW-4252: [C++] Fix missing Status code and newline
Previous refactor of status message removed the stringification of the
failing expression.
Author: François Saint-Jacques <fs...@gmail.com>
Closes #3420 from fsaintjacques/ARROW-4252-status-error-message and squashes the following commits:
2b8d46c73 <François Saint-Jacques> ARROW-4252: Fix missing Status missing code and newline
---
cpp/src/arrow/status.h | 38 ++++++++++++++++++++------------------
1 file changed, 20 insertions(+), 18 deletions(-)
diff --git a/cpp/src/arrow/status.h b/cpp/src/arrow/status.h
index 12975af..db1da19 100644
--- a/cpp/src/arrow/status.h
+++ b/cpp/src/arrow/status.h
@@ -31,33 +31,35 @@
#ifdef ARROW_EXTRA_ERROR_CONTEXT
/// \brief Return with given status if condition is met.
-#define ARROW_RETURN_IF(condition, status) \
- do { \
- if (ARROW_PREDICT_FALSE(condition)) { \
- ::arrow::Status _s = (status); \
- std::stringstream ss; \
- ss << __FILE__ << ":" << __LINE__ << " : " << _s.message(); \
- return ::arrow::Status(_s.code(), ss.str()); \
- } \
+#define ARROW_RETURN_IF_(condition, status, expr) \
+ do { \
+ if (ARROW_PREDICT_FALSE(condition)) { \
+ ::arrow::Status _s = (status); \
+ std::stringstream ss; \
+ ss << _s.message() << "\n" << __FILE__ << ":" << __LINE__ << " code: " << expr; \
+ return ::arrow::Status(_s.code(), ss.str()); \
+ } \
} while (0)
#else
-#define ARROW_RETURN_IF(condition, status) \
- do { \
- if (ARROW_PREDICT_FALSE(condition)) { \
- return (status); \
- } \
+#define ARROW_RETURN_IF_(condition, status, _) \
+ do { \
+ if (ARROW_PREDICT_FALSE(condition)) { \
+ return (status); \
+ } \
} while (0)
#endif // ARROW_EXTRA_ERROR_CONTEXT
+#define ARROW_RETURN_IF(condition, status) \
+ ARROW_RETURN_IF_(condition, status, ARROW_STRINGIFY(status))
+
/// \brief Propagate any non-successful Status to the caller
-#define ARROW_RETURN_NOT_OK(status) \
- do { \
- ::arrow::Status __s = (status); \
- ARROW_RETURN_IF(!__s.ok(), __s); \
- \
+#define ARROW_RETURN_NOT_OK(status) \
+ do { \
+ ::arrow::Status __s = (status); \
+ ARROW_RETURN_IF_(!__s.ok(), __s, ARROW_STRINGIFY(status)); \
} while (false)
#define RETURN_NOT_OK_ELSE(s, else_) \