Skip to content

GH-47953: [C++] Remove Windows inclusion from int_util_overflow.h#47950

Merged
pitrou merged 1 commit intoapache:mainfrom
pitrou:exp-int-safe
Oct 27, 2025
Merged

GH-47953: [C++] Remove Windows inclusion from int_util_overflow.h#47950
pitrou merged 1 commit intoapache:mainfrom
pitrou:exp-int-safe

Conversation

@pitrou
Copy link
Member

@pitrou pitrou commented Oct 27, 2025

Rationale for this change

In int_util_overflow.h we're currently including (indirectly) some Windows header through windows_compatibility.h:

// "safe-math.h" includes <intsafe.h> from the Windows headers.
#include "arrow/util/windows_compatibility.h"
#include "arrow/vendored/portable-snippets/safe-math.h"
// clang-format off (avoid include reordering)
#include "arrow/util/windows_fixup.h"
// clang-format on

This was probably necessary when this was initially committed, but can produce problems when expanding the use of this header in our codebase, due to unwanted macro definitions, here is an example:

D:/a/arrow/arrow/cpp/src/parquet/arrow/schema.cc:78:45: error: expected unqualified-id
   78 |   return is_nullable ? Repetition::OPTIONAL : Repetition::REQUIRED;
      |                                             ^
D:/a/arrow/arrow/cpp/src/parquet/arrow/schema.cc:331:45: error: expected unqualified-id
  331 |       if (repetition != Repetition::OPTIONAL) {
      |                                             ^
2 errors generated.

What changes are included in this PR?

Simply remove the Windows inclusion. This seems to pass our current CI suite.

Are these changes tested?

Yes, by existing CI tests.

Are there any user-facing changes?

No.

@github-actions
Copy link

Thanks for opening a pull request!

If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

See also:

@pitrou
Copy link
Member Author

pitrou commented Oct 27, 2025

@github-actions crossbow submit windowscp313* test-build-vcpkg-win

@github-actions
Copy link

Revision: 1a66de4

Submitted crossbow builds: ursacomputing/crossbow @ actions-552c508701

Task Status
test-build-vcpkg-win GitHub Actions
wheel-windows-cp313-cp313-amd64 GitHub Actions
wheel-windows-cp313-cp313t-amd64 GitHub Actions

@pitrou
Copy link
Member Author

pitrou commented Oct 27, 2025

@github-actions crossbow submit r-binary-packages verify-rc-source-windows

@github-actions
Copy link

Revision: 1a66de4

Submitted crossbow builds: ursacomputing/crossbow @ actions-c171f0b7b7

Task Status
r-binary-packages GitHub Actions
verify-rc-source-windows GitHub Actions

@pitrou pitrou changed the title EXP: [C++] Try removing Windows fixups GH-47953: [C++] Remove Windows inclusion from int_util_overflow.h Oct 27, 2025
@pitrou pitrou marked this pull request as ready for review October 27, 2025 11:12
@pitrou pitrou added the CI: Extra: C++ Run extra C++ CI label Oct 27, 2025
@pitrou pitrou requested review from WillAyd and zanmato1984 October 27, 2025 11:13
@pitrou
Copy link
Member Author

pitrou commented Oct 27, 2025

CI failures are unrelated.

Copy link
Contributor

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

lgtm

@pitrou pitrou merged commit 57c329f into apache:main Oct 27, 2025
63 of 69 checks passed
@pitrou pitrou removed the awaiting review Awaiting review label Oct 27, 2025
@github-actions github-actions bot added the awaiting committer review Awaiting committer review label Oct 27, 2025
@pitrou pitrou deleted the exp-int-safe branch October 27, 2025 13:47
@pitrou
Copy link
Member Author

pitrou commented Oct 27, 2025

Ok, this PR was apparently not enough:
https://github.com/apache/arrow/actions/runs/18843300813/job/53760740194?pr=47925

In file included from D:/a/_temp/msys64/mingw64/include/winnt.h:9,
                 from D:/a/_temp/msys64/mingw64/include/minwindef.h:163,
                 from D:/a/_temp/msys64/mingw64/include/windef.h:9,
                 from D:/a/_temp/msys64/mingw64/include/windows.h:69,
                 from D:/a/_temp/msys64/mingw64/include/rpc.h:16,
                 from D:/a/_temp/msys64/mingw64/include/wtypesbase.h:7,
                 from D:/a/_temp/msys64/mingw64/include/intsafe.h:14,
                 from D:/a/arrow/arrow/cpp/src/arrow/vendored/portable-snippets/safe-math.h:127,
                 from D:/a/arrow/arrow/cpp/src/arrow/util/int_util_overflow.h:29,
                 from D:/a/arrow/arrow/cpp/src/arrow/util/time.h:28,
                 from D:/a/arrow/arrow/cpp/src/arrow/util/formatting.h:37,
                 from D:/a/arrow/arrow/cpp/src/arrow/integration/json_internal.cc:47:
D:/a/arrow/arrow/cpp/src/arrow/integration/json_internal.cc: In function 'arrow::Result<const arrow::rapidjson::GenericObject<true, arrow::rapidjson::GenericValue<arrow::rapidjson::UTF8<> > > > arrow::internal::integration::json::{anonymous}::GetMemberObject(const RjObject&, const std::string&)':
D:/a/arrow/arrow/cpp/src/arrow/integration/json_internal.cc:904:20: error: 'const class arrow::rapidjson::GenericValue<arrow::rapidjson::UTF8<> >' has no member named 'GetObjectA'; did you mean 'GetObject'?
  904 |   return it->value.GetObject();
      |                    ^~~~~~~~~

@conbench-apache-arrow
Copy link

After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 57c329f.

There were no benchmark performance regressions. 🎉

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

zanmato1984 pushed a commit to zanmato1984/arrow that referenced this pull request Nov 5, 2025
…w.h` (apache#47950)

### Rationale for this change

In `int_util_overflow.h` we're currently including (indirectly) some Windows header through `windows_compatibility.h`:
https://github.com/apache/arrow/blob/f669b9fb6b71e74bb41496252709b494233de44d/cpp/src/arrow/util/int_util_overflow.h#L28-L33

This was probably necessary when this was initially committed, but can produce problems when expanding the use of this header in our codebase, due to unwanted macro definitions, here is an [example](https://github.com/apache/arrow/actions/runs/18754865884/job/53504089972?pr=47925):
```
D:/a/arrow/arrow/cpp/src/parquet/arrow/schema.cc:78:45: error: expected unqualified-id
   78 |   return is_nullable ? Repetition::OPTIONAL : Repetition::REQUIRED;
      |                                             ^
D:/a/arrow/arrow/cpp/src/parquet/arrow/schema.cc:331:45: error: expected unqualified-id
  331 |       if (repetition != Repetition::OPTIONAL) {
      |                                             ^
2 errors generated.
```

### What changes are included in this PR?

Simply remove the Windows inclusion. This seems to pass our current CI suite.

### Are these changes tested?

Yes, by existing CI tests.

### Are there any user-facing changes?

No.

* GitHub Issue: apache#47953

Authored-by: Antoine Pitrou <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting committer review Awaiting committer review CI: Extra: C++ Run extra C++ CI Component: C++

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants