Skip to content

[C++] int_util_overflow.h includes some Windows headers #47953

@pitrou

Description

@pitrou

Describe the bug, including details regarding any error messages, version, and platform.

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.

Component(s)

C++

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions