Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-38709: [C++] Protect against PREALLOCATE preprocessor defined on macOS #38760

Merged
merged 4 commits into from
Nov 29, 2023

Conversation

cholmcc
Copy link
Contributor

@cholmcc cholmcc commented Nov 17, 2023

Rationale for this change

The macOS header sys/vnode.h defines PREALLOCATE as a preprocessor macro, which causes a conflict in arrow/compute/kernel.h where the same name is defined as an identifier.

Other BSDs does not seem to define this macro.

What changes are included in this PR?

#undef PREALLOCATE on macOS and if defined.

Are these changes tested?

Somewhat, in a different context.

Are there any user-facing changes?

If some code specific to macOS actually uses the PREALLOCATE macro, then that code may have problems. However, it is unlikely that any user code would use this macro as it seems to be intended for internal use in the BSD kernel of macOS.

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}

In the case of PARQUET issues on JIRA the title also supports:

PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

See also:

@kou kou changed the title Protect against PREALLOCATE preprocessor define in MacOSX header sys/… GH-38709: [C++] Protect against PREALLOCATE preprocessor defined on macOS Nov 17, 2023
Copy link

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

Copy link
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

cpp/src/arrow/compute/kernel.h Outdated Show resolved Hide resolved
@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting review Awaiting review labels Nov 17, 2023
cpp/src/arrow/compute/kernel.h Outdated Show resolved Hide resolved
@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting merge Awaiting merge labels Nov 17, 2023
@pitrou
Copy link
Member

pitrou commented Nov 28, 2023

Sidenote: this is why we should discourage ENUM_VALUE in favor of kEnumValue in new code :-)

@kou
Copy link
Member

kou commented Nov 29, 2023

Oh, I forgot to merge this.
I'll merge this.

@kou kou merged commit 61a4a80 into apache:main Nov 29, 2023
32 of 34 checks passed
@kou kou removed the awaiting changes Awaiting changes label Nov 29, 2023
Copy link

After merging your PR, Conbench analyzed the 5 benchmarking runs that have been run so far on merge-commit 61a4a80.

There were 2 benchmark results indicating a performance regression:

The full Conbench report has more details.

@cholmcc cholmcc deleted the patch-2 branch November 29, 2023 22:44
dgreiss pushed a commit to dgreiss/arrow that referenced this pull request Feb 19, 2024
…d on macOS (apache#38760)

### Rationale for this change

The macOS header `sys/vnode.h` defines `PREALLOCATE` as a preprocessor macro, which causes a conflict in `arrow/compute/kernel.h` where the same name is defined as an identifier. 

Other BSDs does not seem to define this macro. 

### What changes are included in this PR?

`#undef PREALLOCATE` on macOS and if defined. 

### Are these changes tested?

Somewhat, in a different context. 

### Are there any user-facing changes?

If some code specific to macOS actually uses the `PREALLOCATE` macro, then that code may have problems.  However, it is unlikely that any user code would use this macro as it seems to be intended for internal use in the BSD kernel of macOS. 

* Closes: apache#38709

Lead-authored-by: Christian Holm Christensen <Christian.Holm.Christensen@cern.ch>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants