This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 36c8c9a24a GH-49719: [C++] Rename vendored date header guards (#49778)
36c8c9a24a is described below

commit 36c8c9a24aec70fb41441c6a1a2a28b777d351e3
Author: Hrishikesh Shinde <[email protected]>
AuthorDate: Sun Apr 19 01:07:37 2026 -0500

    GH-49719: [C++] Rename vendored date header guards (#49778)
    
    ### 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_H` → `ARROW_VENDORED_DATE_H` |
    | `tz.h` | `TZ_H` → `ARROW_VENDORED_TZ_H` |
    | `tz_private.h` | `TZ_PRIVATE_H` → `ARROW_VENDORED_TZ_PRIVATE_H` |
    | `ios.h` | `ios_hpp` → `ARROW_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.
    
    * GitHub Issue: #49719
    
    Authored-by: Hrishi Shinde <[email protected]>
    Signed-off-by: Sutou Kouhei <[email protected]>
---
 cpp/src/arrow/vendored/datetime/date.h       | 6 +++---
 cpp/src/arrow/vendored/datetime/ios.h        | 6 +++---
 cpp/src/arrow/vendored/datetime/tz.h         | 6 +++---
 cpp/src/arrow/vendored/datetime/tz_private.h | 6 +++---
 cpp/src/arrow/vendored/datetime/update.sh    | 3 +++
 5 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/cpp/src/arrow/vendored/datetime/date.h 
b/cpp/src/arrow/vendored/datetime/date.h
index 1b06182a6d..5e0ff85246 100644
--- a/cpp/src/arrow/vendored/datetime/date.h
+++ b/cpp/src/arrow/vendored/datetime/date.h
@@ -1,5 +1,5 @@
-#ifndef DATE_H
-#define DATE_H
+#ifndef ARROW_VENDORED_DATE_H
+#define ARROW_VENDORED_DATE_H
 
 // The MIT License (MIT)
 //
@@ -8242,4 +8242,4 @@ operator<<(std::basic_ostream<CharT, Traits>& os,
 # pragma GCC diagnostic pop
 #endif
 
-#endif  // DATE_H
+#endif  // ARROW_VENDORED_DATE_H
diff --git a/cpp/src/arrow/vendored/datetime/ios.h 
b/cpp/src/arrow/vendored/datetime/ios.h
index d018e799a8..ee341fd778 100644
--- a/cpp/src/arrow/vendored/datetime/ios.h
+++ b/cpp/src/arrow/vendored/datetime/ios.h
@@ -24,8 +24,8 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 // SOFTWARE.
 
-#ifndef ios_hpp
-#define ios_hpp
+#ifndef ARROW_VENDORED_ios_hpp
+#define ARROW_VENDORED_ios_hpp
 
 #if __APPLE__
 # include <TargetConditionals.h>
@@ -47,4 +47,4 @@
 #else   // !__APPLE__
 # define TARGET_OS_IPHONE 0
 #endif  // !__APPLE__
-#endif // ios_hpp
+#endif // ARROW_VENDORED_ios_hpp
diff --git a/cpp/src/arrow/vendored/datetime/tz.h 
b/cpp/src/arrow/vendored/datetime/tz.h
index 61ab3df106..151a67fe90 100644
--- a/cpp/src/arrow/vendored/datetime/tz.h
+++ b/cpp/src/arrow/vendored/datetime/tz.h
@@ -1,5 +1,5 @@
-#ifndef TZ_H
-#define TZ_H
+#ifndef ARROW_VENDORED_TZ_H
+#define ARROW_VENDORED_TZ_H
 
 // The MIT License (MIT)
 //
@@ -2805,4 +2805,4 @@ to_gps_time(const tai_time<Duration>& t)
 
 }  // namespace arrow_vendored::date
 
-#endif  // TZ_H
+#endif  // ARROW_VENDORED_TZ_H
diff --git a/cpp/src/arrow/vendored/datetime/tz_private.h 
b/cpp/src/arrow/vendored/datetime/tz_private.h
index 1d7f858971..39059a1a4a 100644
--- a/cpp/src/arrow/vendored/datetime/tz_private.h
+++ b/cpp/src/arrow/vendored/datetime/tz_private.h
@@ -1,5 +1,5 @@
-#ifndef TZ_PRIVATE_H
-#define TZ_PRIVATE_H
+#ifndef ARROW_VENDORED_TZ_PRIVATE_H
+#define ARROW_VENDORED_TZ_PRIVATE_H
 
 // The MIT License (MIT)
 //
@@ -312,4 +312,4 @@ struct transition
 #include "tz.h"
 #endif
 
-#endif  // TZ_PRIVATE_H
+#endif  // ARROW_VENDORED_TZ_PRIVATE_H
diff --git a/cpp/src/arrow/vendored/datetime/update.sh 
b/cpp/src/arrow/vendored/datetime/update.sh
index b4580c0426..7ee60fc7af 100755
--- a/cpp/src/arrow/vendored/datetime/update.sh
+++ b/cpp/src/arrow/vendored/datetime/update.sh
@@ -46,6 +46,9 @@ sed -i.bak -E \
     -e 's/namespace date/namespace arrow_vendored::date/g' \
     -e 's,include "date/,include ",g' \
     *.{cpp,h,mm}
+sed -i.bak -E \
+    -e 's/(#ifndef |#define |#endif *\/\/ 
)(DATE_H|ios_hpp|TZ_H|TZ_PRIVATE_H)/\1ARROW_VENDORED_\2/g' \
+    *.h
 sed -i.bak -E \
     -e "s/changeset [0-9a-f]+/changeset ${commit_id}/g" \
     README.md

Reply via email to