From bc3a2596c8d47047694507da2d3d27fdf25ee1c7 Mon Sep 17 00:00:00 2001 From: Arjav Patel Date: Sat, 30 May 2026 23:28:49 +0530 Subject: [PATCH] tools/nxstyle: Whitelist ROS 2 message type identifiers. The ROS 2 C client API generates symbols via rosidl token-pasting macros. Each message type ends up with a name of the form __msg__, 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 --- tools/nxstyle.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tools/nxstyle.c b/tools/nxstyle.c index 3d70d575c63..d7ee750cfbc 100644 --- a/tools/nxstyle.c +++ b/tools/nxstyle.c @@ -227,6 +227,29 @@ static const char *g_white_prefix[] = "tClass", /* Ref: arch/tricore/src */ "tCpu", /* Ref: arch/tricore/src */ "tId", /* Ref: arch/tricore/src */ + + /* Ref: apps/system/microros, apps/examples/microros_* + * ROS 2 standard message package names and rosidl scalar type names + * are generated by upstream rosidl token-pasting macros and cannot + * be renamed without breaking the ROS C client API. + */ + + "std_msgs", /* std_msgs__msg__Int32, ... */ + "geometry_msgs", /* geometry_msgs__msg__Twist, ... */ + "sensor_msgs", /* sensor_msgs__msg__Imu, ... */ + "nav_msgs", /* nav_msgs__msg__Odometry, ... */ + "builtin_interfaces", /* builtin_interfaces__msg__Time, ... */ + "rcl_interfaces", /* rcl_interfaces__msg__Log, ... */ + "Int8", /* ROSIDL_GET_MSG_TYPE_SUPPORT(_, _, Int8) */ + "Int16", + "Int32", + "Int64", + "UInt8", + "UInt16", + "UInt32", + "UInt64", + "Float32", + "Float64", NULL };