Rename endian.h to portable_endian.h#442
Rename endian.h to portable_endian.h#442urrsk wants to merge 2 commits intoUniversalRobots:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #442 +/- ##
==========================================
- Coverage 75.33% 75.22% -0.11%
==========================================
Files 103 103
Lines 5298 5304 +6
Branches 580 580
==========================================
- Hits 3991 3990 -1
- Misses 992 1000 +8
+ Partials 315 314 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
df8a74b to
8af9e9f
Compare
urfeex
left a comment
There was a problem hiding this comment.
Looking good in general, but I don't understand why so many implementation files now need to include that header, as well as the tests. Shouldn't that be unnecessary, when only the serializer, parser and package header cpp files include it?
|
Just a casual observer (and observation): byte swapping is often kept header only (in C/C++) to give the compiler maximum opportunity to in-line it (which can result in swaps becoming no-ops when source and target use identical order). Refactoring it into a separate shared library seems to complicate that -- unless something like LTO is used (but I'm not sure that's possible with functions from shared libraries). Performance is probably not necessarily a concern here, but something to keep in mind perhaps (at 500 Hz there could be measurable effects). |
Thanks @gavanderhoorn for that point. |
|
@urrsk wrote:
but in order to be able to in-line, that header is used, right? Is the main issue just to have to install a |
Well yes. Though this work was motivated to avoid the circular include due to the naming, and then I when all the way to avoid it in the headers to limit the overhead. |
d4af991 to
ff2bb61
Compare
|
I have changed the scope and reverted the cpp files approach. Thanks for the inspiration from @gavanderhoorn. |
This change renames the endian.h file to portable_endian.h to avoid conflicts caused by circular includes. The third-party endian.h file includes the system's endian.h, which can lead to circular imports due to overlapping filenames. By renaming the file, we eliminate this issue and ensure compatibility in the CMake build process. Finally, a macOS CI build has been added to verify that the library builds successfully on macOS, ensuring cross-platform compatibility.
Co-authored-by: Felix Exner <feex@universal-robots.com>
This change renames the endian.h file to portable_endian.h to avoid conflicts caused by circular includes. The third-party endian.h file includes the system's endian.h, which can lead to circular imports due to overlapping filenames. By renaming the file, we eliminate this issue and ensure compatibility in the CMake build process.
Finally, a macOS CI build has been added to verify that the library builds successfully on macOS, ensuring cross-platform compatibility.
Note
Medium Risk
Touches cross-platform build configuration and endian conversion includes used in core parsing/serialization paths; behavior is likely unchanged but misconfigured include/install paths could break downstream builds.
Overview
Fixes endian header name collisions by renaming the bundled header to
3rdparty/endian/portable_endian.hand switching internal includes from<endian.h>to<endian/portable_endian.h>; CMake include/install rules are simplified so theendianheaders are installed on all platforms underinclude/ur_client_library/3rdparty/endian.CI coverage is expanded with a new
mac-buildGitHub Actions workflow (arm64 + x86_64) and both Windows and macOS workflows now run on a nightly schedule. Tests are tightened/expanded aroundBinParser/PackageSerializerendian encode/decode behavior and a few assertions are corrected (e.g.,EXPECT_EQvsEXPECT_DOUBLE_EQ, explicitvoidcasts inEXPECT_THROW).Written by Cursor Bugbot for commit 2b43f21. This will update automatically on new commits. Configure here.