Skip to content

Work around Windows min/max bug.#21

Merged
clalancette merged 3 commits intoros2from
use-rcpputils-filesystem
Nov 19, 2020
Merged

Work around Windows min/max bug.#21
clalancette merged 3 commits intoros2from
use-rcpputils-filesystem

Conversation

@clalancette
Copy link
Copy Markdown

@clalancette clalancette commented Nov 17, 2020

The comments in the code explain why we need this.

Signed-off-by: Chris Lalancette clalancette@openrobotics.org

Some upcoming changes to pluginlib are going to cause us to #include <windows.h>, which is why this is now needed to build on Windows.

One other note: I believe that there is an alternative way to solve this, which is to use MSVC push_macro/pop_macro. That is, we'd do something like:

#ifdef _WIN32
#pragma push_macro("max")
#undef max
#endif

// Use std::numeric_limits<size_t>::max();

#ifdef _WIN32
#pragma pop_macro("max")
#endif

Both are kind of ugly, so I don't have a strong opinion one way or another.

The comments in the code explain why we need this.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
Copy link
Copy Markdown

@sloretz sloretz left a comment

Choose a reason for hiding this comment

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

LGTM

subjectively I like #undef max more than an empty macro, but I don't have any non-subjective reasons for choosing one over the other.

@clalancette
Copy link
Copy Markdown
Author

subjectively I like #undef max more than an empty macro, but I don't have any non-subjective reasons for choosing one over the other.

On balance, after looking at it more, I agree with you. I'm going to change to the other style and then run CI with that.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
@clalancette
Copy link
Copy Markdown
Author

clalancette commented Nov 18, 2020

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
@clalancette
Copy link
Copy Markdown
Author

New CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@sloretz
Copy link
Copy Markdown

sloretz commented Nov 18, 2020

FYI @clalancette windows CI looks like a java traceback, twice. 3rd attempt in progress: Build Status

@clalancette
Copy link
Copy Markdown
Author

Windows finally finished in this job: Build Status

With green CI, and approval, I'm going to go ahead and merge this. Thanks for the review!

@clalancette clalancette merged commit 4c90a78 into ros2 Nov 19, 2020
@delete-merged-branch delete-merged-branch bot deleted the use-rcpputils-filesystem branch November 19, 2020 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants