Skip to content

GH-51456: [C++] Make ABI independent of ARROW_EXTRA_ERROR_CONTEXT - #51458

Merged
pitrou merged 3 commits into
apache:mainfrom
pitrou:gh51456-abi-macro
Sep 22, 2026
Merged

pitrou merged 3 commits into
apache:mainfrom
pitrou:gh51456-abi-macro

Conversation

@pitrou

@pitrou pitrou commented Sep 22, 2026

Copy link
Copy Markdown
Member

What changes are included in this PR?

Allow applications compiled with ARROW_EXTRA_ERROR_CONTEXT enabled to link against libarrow compiled with ARROW_EXTRA_ERROR_CONTEXT disabled, and vice-versa.

Also improve unit tests slightly.

Are these changes tested?

The original issue was tested manually.

Are there any user-facing changes?

No.

Was AI used for this PR?

In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #51456 has been automatically assigned in GitHub to PR creator.

@pitrou

pitrou commented Sep 22, 2026

Copy link
Copy Markdown
Member Author

@HuaHuaY @taepper What do you think?

@taepper taepper left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reduces the usage of ARROW_EXTRA_ERROR_CONTEXT in the codebase to this single instance:

#ifdef ARROW_EXTRA_ERROR_CONTEXT

/// \brief Return with given status if condition is met.
#  define ARROW_RETURN_IF_(condition, status, expr)   \
    do {                                              \
      if (ARROW_PREDICT_FALSE(condition)) {           \
        ::arrow::Status _st = (status);               \
        _st.AddContextLine(__FILE__, __LINE__, expr); \
        return _st;                                   \
      }                                               \
    } while (0)

#else

#  define ARROW_RETURN_IF_(condition, status, _) \
    do {                                         \
      if (ARROW_PREDICT_FALSE(condition)) {      \
        return (status);                         \
      }                                          \
    } while (0)

#endif  // ARROW_EXTRA_ERROR_CONTEXT

Which is exactly what I would expect

Comment thread cpp/src/arrow/status_test.cc Outdated
@github-actions github-actions Bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Sep 22, 2026
Comment thread cpp/src/arrow/status.cc Outdated
Comment thread cpp/src/arrow/status_test.cc Outdated
@pitrou

pitrou commented Sep 22, 2026

Copy link
Copy Markdown
Member Author

I've addressed all review comments and I'm going to merge this PR. Thank you @HuaHuaY @taepper !

@pitrou
pitrou merged commit e8c2e70 into apache:main Sep 22, 2026
57 of 59 checks passed
@pitrou pitrou removed the awaiting committer review Awaiting committer review label Sep 22, 2026
@pitrou
pitrou deleted the gh51456-abi-macro branch September 22, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants