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

Consider narrowing the scope of #undef ERROR in generated message code #118

Open
gerkey opened this issue Apr 18, 2016 · 5 comments
Open
Labels
enhancement New feature or request

Comments

@gerkey
Copy link
Member

gerkey commented Apr 18, 2016

d4264b7#commitcomment-17146232

@mikaelarguedas
Copy link
Member

This is a known problem that we face is ROS1 as well (e.g. ros/geometry2#172) and it would be great to see how we can address these collisions with Windows defined in the near future

@dejanpan
Copy link

This issue has come up again here:

The generated file build\tf2_msgs\rosidl_generator_cpp\tf2_msgs\msg\tf2_error__struct.hpp contains the following code that conflicts with Windows' definition:

  // constants
  enum { NO_ERROR = 0u };

Windows SDK defines macro NO_ERROR in Error.h:

#define NO_ERROR            0

We have confirmed for myself that that culprit is Windows SDK. On a clean installation everything works OK but as soon as we installed Windows SDK the build fails in TF2 (now it fails in Release build too).

@wjwwood says:
It might also be possible to change these constants in ROS 2 (with appropriate special handling in the ros1_bridge).

@tfoote
Copy link
Contributor

tfoote commented Oct 27, 2017

This is also an issue with 'DELETE' defined in winnt.h: ros2/common_interfaces#44

We'll either need some way to generically protect ourselves from some known set of conflicting strings or else have a blacklist of known strings that must be banned due to windows bad hygene in macro names.

Might it make sense to have a known set of potentially colliding macros that automatically get undefed in our code generators if a conflict is detected?

@dirk-thomas
Copy link
Member

dirk-thomas commented Feb 27, 2018

Options:

  • undefine Windows specific MACRO (preferrably only when the message actually uses that name)
  • name mangle the enum (e.g. appending an underscore)
  • use different enum naming scheme (e.g. kError)

@tfoote
Copy link
Contributor

tfoote commented Apr 30, 2018

Related: ros2/design#172

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants