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

commit 89a45f13067c2836b129ba8113e146cecb77116f
Author: Marco Casaroli <[email protected]>
AuthorDate: Tue Oct 27 20:12:10 2026 +0100

    tools/nxstyle: Treat an unnamed enum as a data declaration.
    
    A line with "struct" or "union" alone starts an unnamed data declaration,
    but "enum" alone did not.  So an #include inside the body of an unnamed
    enum, which provides its entries, was reported as an #include outside of
    the Included Files section, while the same #include inside an initializer
    is not.  include/sys/syscall.h builds its enum of system call numbers
    this way.
    
    Add "enum" alone to the data declarations.  Of the 46 files with an
    unnamed enum, only include/sys/syscall.h gets a different result: its
    warning goes away.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 tools/nxstyle.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/nxstyle.c b/tools/nxstyle.c
index ba5beacda86..f6b66347fb0 100644
--- a/tools/nxstyle.c
+++ b/tools/nxstyle.c
@@ -2480,6 +2480,7 @@ int main(int argc, char **argv, char **envp)
                    strncmp(&line[indent], "struct ", 7) == 0 ||
                    strncmp(&line[indent], "struct\n", 7) == 0 || /* May be 
unnamed */
                    strncmp(&line[indent], "enum ", 5) == 0 ||
+                   strncmp(&line[indent], "enum\n", 5) == 0 ||   /* May be 
unnamed */
                    strncmp(&line[indent], "extern ", 7) == 0 ||
                    strncmp(&line[indent], "EXTERN ", 7) == 0 ||
                    strncmp(&line[indent], "FAR ", 4) == 0 ||

Reply via email to