Skip to content

[C++] Conflict between arrow::compute::MemAllocation::PREALLOCATE and system header vnode.h preprocessor define #38709

Closed

Description

@cholmcc

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

Hi,

On MacOSX the system header vnode.h defines the symbol PREALLOCATE as a preprocessor define. This causes a compilation error with #include <arrow/compute/kernel.h> where this name (PREALLOCATE) is used as an identifier , if sys/vnode.h and arrow/compute/kernel.h are both (possibly indirectly) included into the same compilation unit.

Perhaps the PREALLOCATE symbol should be #undef in arrow/compute/kernel.h in case it is defined as preprocessor macro - e.g.,

    #if defined(__APPLE__) and defined(PREALLOCATE)
    # undef PREALLOCATE 
    #endif  

Yours,
Christian

Component(s)

C++

Activity

  1. changed the title [-]Conflict between `arrow::compute::MemAllocation::PREALLOCATE` and system header `vnode.h` preprocessor define[/-] [+][C++] Conflict between `arrow::compute::MemAllocation::PREALLOCATE` and system header `vnode.h` preprocessor define[/+] on Nov 14, 2023
  2. kou commented on Nov 16, 2023

    @kou
    Member

    Could you open a pull request with the approach?

    Or we can use kPreallocate name because our coding style uses the convention: https://google.github.io/styleguide/cppguide.html#Enumerator_Names
    But it breaks backward compatibility and our many existing source codes don't follow the convention...

  3. cholmcc commented on Nov 16, 2023

    @cholmcc
    Author

    Hi,

    I think I would suggest to use the kPreallocate approach, as it is much less likely to cause conflicts. However, I would worry a little about backward compatibility with existing client code.

    I made a PR. If you choose the kPreallocate route, then just kill the PR.

    Yours,
    Christian

  4. kou commented on Nov 17, 2023

    @kou
    Member

    Let's choose undef approach for now.

    It seems that a PR isn't made yet. Could you ensure opening a PR with the change?

  5. cholmcc commented on Nov 17, 2023

    @cholmcc
    Author

    Sorry, my bad - forgot to hit the button :-) The PR is here

  6. added a commit that references this issue on Nov 29, 2023
  7. added this to the 15.0.0 milestone on Nov 29, 2023
  8. added a commit that references this issue on Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions