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

config.hpp.in: remove whitespace from version macros #1820

Merged
merged 2 commits into from
Jun 28, 2024

Conversation

scpeters
Copy link
Collaborator

When attempting to build gz-physics7 with dartsim 6.14.1, the build fails:

/tmp/gz-physics7-20240628-32522-zc6n0e/gz-physics-7.3.0/dartsim/src/Base.hh:44:5: error: invalid token at start of a preprocessor expression
#if DART_VERSION_AT_LEAST(6, 13, 0)
    ^
/usr/local/include/dart/config.hpp:38:3: note: expanded from macro 'DART_VERSION_AT_LEAST'
  DART_VERSION_GE(x, y, z)
  ^
/usr/local/include/dart/config.hpp:19:4: note: expanded from macro 'DART_VERSION_GE'
  (DART_MAJOR_VERSION > x                                                      \
   ^
/usr/local/include/dart/config.hpp:5:28: note: expanded from macro 'DART_MAJOR_VERSION'
#define DART_MAJOR_VERSION @DART_MAJOR_VERSION @
                           ^

It appears that the version number macros at the start of config.hpp.in have a space in between the @ characters, which seems to prevent cmake from matching the variable names when configuring the version number macros. I confirmed by looking at the first few lines of the config.hpp file installed in the dartsim 6.14.1 homebrew bottle:

/* config.hpp. Generated by CMake for dart. */
#pragma once
/* Version number */
#define DART_MAJOR_VERSION @DART_MAJOR_VERSION @
#define DART_MINOR_VERSION @DART_MINOR_VERSION @
#define DART_PATCH_VERSION @DART_PATCH_VERSION @
#define DART_VERSION "6.14.1"
#define DART_DESCRIPTION "Dynamic Animation and Robotics Toolkit."

I believe removing the whitespace should fix it, though it would be better to add a test of the DART_VERSION_AT_LEAST macro, which should catch regressions like this in the future.


Before creating a pull request

  • Document new methods and classes
  • Format new code files using ClangFormat by running make format
  • Build with -DDART_TREAT_WARNINGS_AS_ERRORS=ON and resolve all the compile warnings

Before merging a pull request

  • Set version target by selecting a milestone on the right side
  • Summarize this change in CHANGELOG.md
  • Add unit test(s) for this change
  • Add Python bindings for new methods and classes

The whitespace between the `@` characters seems
to prevent cmake from matching the variable names
when configuring the version number macros.

Signed-off-by: Steve Peters <[email protected]>
@scpeters
Copy link
Collaborator Author

I believe removing the whitespace should fix it, though it would be better to add a test of the DART_VERSION_AT_LEAST macro, which should catch regressions like this in the future.

where would you recommend putting a test for DART_VERSION_AT_LEAST

@jslee02
Copy link
Member

jslee02 commented Jun 28, 2024

Ah, good catch. Thank you for the fix!

I believe removing the whitespace should fix it, though it would be better to add a test of the DART_VERSION_AT_LEAST macro, which should catch regressions like this in the future.

where would you recommend putting a test for DART_VERSION_AT_LEAST

Anywhere in common would make sense to me.

Copy link

codecov bot commented Jun 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.56%. Comparing base (ed209b2) to head (40b062b).

Current head 40b062b differs from pull request most recent head b03d15a

Please upload reports for the commit b03d15a to get more accurate results.

Additional details and impacted files
@@              Coverage Diff              @@
##           release-6.14    #1820   +/-   ##
=============================================
  Coverage         61.56%   61.56%           
=============================================
  Files               490      490           
  Lines             46021    46021           
=============================================
  Hits              28334    28334           
  Misses            17687    17687           

@scpeters
Copy link
Collaborator Author

Ah, good catch. Thank you for the fix!

I believe removing the whitespace should fix it, though it would be better to add a test of the DART_VERSION_AT_LEAST macro, which should catch regressions like this in the future.

where would you recommend putting a test for DART_VERSION_AT_LEAST

Anywhere in common would make sense to me.

test added in b03d15a to the Logging test since it already had a transitive include of config.hpp via TestHelpers.hpp

@jslee02 jslee02 added this to the DART 6.14.2 milestone Jun 28, 2024
@jslee02 jslee02 merged commit d7ae8d3 into release-6.14 Jun 28, 2024
27 of 29 checks passed
@jslee02 jslee02 deleted the scpeters/fix_version_macros branch June 28, 2024 23:20
henriquealrs pushed a commit to henriquealrs/dart that referenced this pull request Jul 13, 2024
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