Skip to content

GH-49719: [C++] Rename vendored date header guards#49778

Merged
kou merged 2 commits intoapache:mainfrom
hrishikeshh-shinde:GH-49719-vendored-date-header-guards
Apr 19, 2026
Merged

GH-49719: [C++] Rename vendored date header guards#49778
kou merged 2 commits intoapache:mainfrom
hrishikeshh-shinde:GH-49719-vendored-date-header-guards

Conversation

@hrishikeshh-shinde
Copy link
Copy Markdown
Contributor

@hrishikeshh-shinde hrishikeshh-shinde commented Apr 16, 2026

Rationale for this change

Arrow ships with a vendored date library that places all definitions in the arrow_vendored namespace but keeps the original header guards, leading to problems when used in a project that also consumes the real date library.

What changes are included in this PR?

Prefix all header guards with ARROW_VENDORED_. Update update.sh to apply the same rewrite automatically on future re-vendoring.

File Change
date.h DATE_HARROW_VENDORED_DATE_H
tz.h TZ_HARROW_VENDORED_TZ_H
tz_private.h TZ_PRIVATE_HARROW_VENDORED_TZ_PRIVATE_H
ios.h ios_hppARROW_VENDORED_ios_hpp
update.sh Added sed block for automatic guard renaming

Are these changes tested?

Built Arrow C++ locally. No build breakage.

Are there any user-facing changes?

No API changes. Fixes a header collision for projects that also use the real date library.

Prefix all header guards in the vendored date library with
ARROW_VENDORED_ to avoid collisions when a project also uses
the real date library. Update update.sh to apply the same
rewrite automatically on future re-vendoring.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Arrow’s vendored HowardHinnant/date headers to avoid preprocessor header-guard collisions when downstream projects also include the upstream date library.

Changes:

  • Prefixed the vendored date library header guards with ARROW_VENDORED_ in date.h, tz.h, tz_private.h, and ios.h.
  • Updated update.sh to automatically apply the same header-guard rewrite on future re-vendoring.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
cpp/src/arrow/vendored/datetime/update.sh Adds a sed rewrite step to prefix specific upstream header guards with ARROW_VENDORED_ during vendoring.
cpp/src/arrow/vendored/datetime/date.h Renames DATE_H guard to ARROW_VENDORED_DATE_H.
cpp/src/arrow/vendored/datetime/tz.h Renames TZ_H guard to ARROW_VENDORED_TZ_H.
cpp/src/arrow/vendored/datetime/tz_private.h Renames TZ_PRIVATE_H guard to ARROW_VENDORED_TZ_PRIVATE_H.
cpp/src/arrow/vendored/datetime/ios.h Renames ios_hpp guard to ARROW_VENDORED_ios_hpp.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

You used this sed command line to update the existing header files, right?

Comment thread cpp/src/arrow/vendored/datetime/update.sh Outdated
Comment thread cpp/src/arrow/vendored/datetime/update.sh Outdated
@hrishikeshh-shinde
Copy link
Copy Markdown
Contributor Author

@kou i fixed it, can you take a look again?

Copy link
Copy Markdown
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

+1

@kou kou merged commit 36c8c9a into apache:main Apr 19, 2026
56 of 62 checks passed
@kou kou removed the awaiting review Awaiting review label Apr 19, 2026
@conbench-apache-arrow
Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 36c8c9a.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 3 possible false positives for unstable benchmarks that are known to sometimes produce them.

@hrishikeshh-shinde hrishikeshh-shinde deleted the GH-49719-vendored-date-header-guards branch April 19, 2026 16: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