This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new caf0c6f0d00 tools/nxstyle: recognise typedef'd type names in 
declarations
caf0c6f0d00 is described below

commit caf0c6f0d004d9d92857a39d007e3268f360cf21
Author: raiden00pl <[email protected]>
AuthorDate: Mon Jul 27 12:20:13 2026 +0200

    tools/nxstyle: recognise typedef'd type names in declarations
    
    The fixed list of type names holds neither uint64_t nor any NuttX
    typedef, so declarations using them went unchecked.
    
    Signed-off-by: raiden00pl <[email protected]>
    Assisted-by: Claude Code
---
 tools/nxstyle.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/tools/nxstyle.c b/tools/nxstyle.c
index 60856b30b46..4c58c8bedde 100644
--- a/tools/nxstyle.c
+++ b/tools/nxstyle.c
@@ -1361,6 +1361,27 @@ static bool white_content_list(const char *ident, int 
lineno)
   return false;
 }
 
+/********************************************************************************
+ * Name: check_type_name
+ *
+ * Description:
+ *   Return true if the identifier at line[ndx] ends in '_t'.
+ *
+ 
********************************************************************************/
+
+static bool check_type_name(const char *line, int ndx)
+{
+  int i = ndx;
+
+  while (isalnum((int)line[i]) != 0 || line[i] == '_')
+    {
+      i++;
+    }
+
+  return i >= ndx + 3 && line[i] == ' ' &&
+         line[i - 1] == 't' && line[i - 2] == '_';
+}
+
 
/********************************************************************************
  * Name: check_keyword
  *
@@ -2259,7 +2280,8 @@ int main(int argc, char **argv, char **envp)
 
       else if (inasm == 0)
         {
-          if (strncmp(&line[indent], "auto ", 5) == 0 ||
+          if (check_type_name(line, indent) ||
+                   strncmp(&line[indent], "auto ", 5) == 0 ||
                    strncmp(&line[indent], "bool ", 5) == 0 ||
                    strncmp(&line[indent], "char ", 5) == 0 ||
                    strncmp(&line[indent], "CODE ", 5) == 0 ||

Reply via email to