Skip to content

Fix robin_hood macro continuation for MSVC - #6276

Merged
SteveMacenski merged 1 commit into
ros-navigation:mainfrom
Tobias-Fischer:codex/robostack-smac-planner-windows
Jul 20, 2026
Merged

SteveMacenski merged 1 commit into
ros-navigation:mainfrom
Tobias-Fischer:codex/robostack-smac-planner-windows

Conversation

@Tobias-Fischer

@Tobias-Fischer Tobias-Fischer commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

This is part of an effort to contribute RoboStack downstream patches back upstream.

Origin: patch/ros-rolling-nav2-smac-planner.win.patch, authored by Daisuke Nishimatsu.

RoboStack's Windows patch previously avoided the bundled robin_hood container on Windows. After re-checking with a dedicated RoboStack CI probe, the specific MSVC failure is in the vendored robin_hood.h macro body: a // NOLINT comment appears after a macro-continuation backslash, so MSVC does not continue the macro and reports syntax errors around the following return.

This keeps robin_hood::unordered_node_map as the Smac planner graph container on Windows and fixes the macro continuation instead, avoiding the performance concern from falling back to std::unordered_map.

The RoboStack ODE packaging workaround from the downstream patch is intentionally not included here.

Related RoboStack tracking issue: RoboStack/robostack#124

@Tobias-Fischer

Copy link
Copy Markdown
Contributor Author

@SteveMacenski SteveMacenski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So this one I’m a little worried about. The performance boost from using this other implementation is quite large. I wouldn’t want an OS choice to define such a huge change. What’s going on with the robinhood library causing it to not be compatible with windows?

@Tobias-Fischer

Copy link
Copy Markdown
Contributor Author

That makes sense. I opened a RoboStack CI probe that removes the Windows fallback to std::unordered_map and forces nav2_smac_planner to rebuild, so we can capture the concrete Windows failure while keeping robin_hood in place: RoboStack/ros-kilted#92

I will follow up here with the actual error once CI has shown it.

@Tobias-Fischer
Tobias-Fischer force-pushed the codex/robostack-smac-planner-windows branch from 72101ba to 3a7423c Compare July 20, 2026 21:39
@Tobias-Fischer Tobias-Fischer changed the title Use std::unordered_map for Smac planner on Windows Fix robin_hood macro continuation for MSVC Jul 20, 2026
@Tobias-Fischer

Copy link
Copy Markdown
Contributor Author

Thanks, you were right to question the std::unordered_map fallback.

I opened a RoboStack kilted probe PR to force the Windows rebuild with the downstream fallback removed: RoboStack/ros-kilted#92

That reproduced the actual failure. The other platforms passed, and Windows failed while compiling a_star.cpp with MSVC errors in the vendored robin_hood.h:

robin_hood.h(151,17): error C2059: syntax error: 'return'
robin_hood.h(152,67): error C2059: syntax error: 'constant'
robin_hood.h(153,13): error C2059: syntax error: '}'
robin_hood.h(153,13): error C2143: syntax error: missing ';' before '}'

The cause is the // NOLINT comment after a macro-continuation backslash in ROBIN_HOOD_COUNT_TRAILING_ZEROES, which prevents MSVC from continuing the macro body. I amended this PR to fix that macro line instead, so Windows keeps using robin_hood::unordered_node_map and avoids the performance concern.

This upstreams the Windows robin_hood portability part of RoboStack patch patch/ros-rolling-nav2-smac-planner.win.patch.

RoboStack CI reproduced the Windows failure with the robin_hood fallback removed: MSVC reports syntax errors in the vendored robin_hood.h while compiling a_star.cpp. The issue is a NOLINT comment after a macro-continuation backslash in ROBIN_HOOD_COUNT_TRAILING_ZEROES, which prevents MSVC from continuing the macro body.

Remove that inline comment so Windows builds can keep using robin_hood::unordered_node_map, avoiding the performance change from falling back to std::unordered_map. The RoboStack ODE packaging workaround is intentionally not included.

Signed-off-by: Tobias Fischer <[email protected]>
@Tobias-Fischer
Tobias-Fischer force-pushed the codex/robostack-smac-planner-windows branch from 3a7423c to b15feb3 Compare July 20, 2026 21:43
@SteveMacenski
SteveMacenski merged commit 2289fde into ros-navigation:main Jul 20, 2026
12 checks passed
@Tobias-Fischer
Tobias-Fischer deleted the codex/robostack-smac-planner-windows branch July 20, 2026 23:35
prajwalthakur pushed a commit to prajwalthakur/navigation2 that referenced this pull request Jul 21, 2026
This upstreams the Windows robin_hood portability part of RoboStack patch patch/ros-rolling-nav2-smac-planner.win.patch.

RoboStack CI reproduced the Windows failure with the robin_hood fallback removed: MSVC reports syntax errors in the vendored robin_hood.h while compiling a_star.cpp. The issue is a NOLINT comment after a macro-continuation backslash in ROBIN_HOOD_COUNT_TRAILING_ZEROES, which prevents MSVC from continuing the macro body.

Remove that inline comment so Windows builds can keep using robin_hood::unordered_node_map, avoiding the performance change from falling back to std::unordered_map. The RoboStack ODE packaging workaround is intentionally not included.

Signed-off-by: Tobias Fischer <[email protected]>
Co-authored-by: Daisuke Nishimatsu <[email protected]>
prajwalthakur pushed a commit to prajwalthakur/navigation2 that referenced this pull request Jul 21, 2026
This upstreams the Windows robin_hood portability part of RoboStack patch patch/ros-rolling-nav2-smac-planner.win.patch.

RoboStack CI reproduced the Windows failure with the robin_hood fallback removed: MSVC reports syntax errors in the vendored robin_hood.h while compiling a_star.cpp. The issue is a NOLINT comment after a macro-continuation backslash in ROBIN_HOOD_COUNT_TRAILING_ZEROES, which prevents MSVC from continuing the macro body.

Remove that inline comment so Windows builds can keep using robin_hood::unordered_node_map, avoiding the performance change from falling back to std::unordered_map. The RoboStack ODE packaging workaround is intentionally not included.

Signed-off-by: Tobias Fischer <[email protected]>
Co-authored-by: Daisuke Nishimatsu <[email protected]>
@gftabor

gftabor commented Jul 21, 2026

Copy link
Copy Markdown

The no lint find is clever. The error looked weird to me and I didn't bother to do the deep dive to find it.
#5333

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.

3 participants