tools/nxstyle: Whitelist ROS 2 message type identifiers.#19001
Merged
xiaoxiang781216 merged 1 commit intoMay 31, 2026
Conversation
The ROS 2 C client API generates symbols via rosidl token-pasting macros. Each message type ends up with a name of the form <pkg>__msg__<Type>, and the bare type token (Int32, Float64, ...) appears in user code as an argument to ROSIDL_GET_MSG_TYPE_SUPPORT(). Neither form can be renamed without breaking the public API. Add the ROS 2 standard message package prefixes (std_msgs, geometry_msgs, sensor_msgs, nav_msgs, builtin_interfaces, rcl_interfaces) and the rosidl scalar type names (Int8/16/32/64, UInt8/16/32/64, Float32/64) to g_white_prefix so nxstyle does not flag the resulting mixed-case identifiers in apps that consume micro-ROS via apps/system/microros. Signed-off-by: Arjav Patel <arjav1528@gmail.com>
acassis
approved these changes
May 30, 2026
Contributor
|
Should we allow modifying nxstyle for third party libraries? |
xiaoxiang781216
approved these changes
May 31, 2026
Contributor
Normally we don't it, because it makes the update to a new library version more difficult. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The ROS 2 C client API exposes message types through
rosidltoken-pasting macros. Each message type ends up with a generated symbol of the form<pkg>__msg__<Type>(e.g.std_msgs__msg__Int32), and the bare type token (Int32,Float64, ...) appears in user code as an argument toROSIDL_GET_MSG_TYPE_SUPPORT(). Neither form can be renamed without breaking the public API.Add the ROS 2 standard message package prefixes and the rosidl scalar type names to
g_white_prefixsonxstyledoes not flag the resulting mixed-case identifiers in apps that consume micro-ROS viaapps/system/microros.Whitelisted prefixes:
std_msgs,geometry_msgs,sensor_msgs,nav_msgs,builtin_interfaces,rcl_interfaces.Int8,Int16,Int32,Int64,UInt8,UInt16,UInt32,UInt64,Float32,Float64.Follows the existing precedent for external ecosystems in the same list (
cJSON,NativeSymbol,Ifx,lua_,TEEC_, ...).Impact
tools/nxstyleonly. No build, runtime, or hardware effect.Dependencies
Companion to apache/nuttx-apps#3512 (
system/microros: Add UDP and serial custom transports with publisher example). That PR's CI nxstyle step fails onapps/examples/microros_pub/microros_pub_main.cuntil this lands.Testing
Local build of the patched
tools/nxstyleand run against every C/H file touched by apache/nuttx-apps#3512:Before this patch (same nxstyle build minus the whitelist additions):
After: 0 errors, 0 warnings on the same 8 files.
No other in-tree files reference any of the added prefixes, so the
whitelist relaxation is scoped to the new ROS 2 surface.