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 3e49c2aed26849232f2e623f85590f2cfa7aff50
Author: Marco Casaroli <[email protected]>
AuthorDate: Sun Oct 11 18:23:31 2026 +0200

    tools/nxstyle.c: Accept an #include inside an initializer.
    
    A file that is included in an initializer provides the data of the
    initializer, as in lib_iconv.c and syscall_names.c.  It cannot move to
    the Included Files section, so nxstyle no longer warns about it.  A
    change to such a file then passes the check.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 tools/nxstyle.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/nxstyle.c b/tools/nxstyle.c
index aadeaf69b59..e84ef7ac1be 100644
--- a/tools/nxstyle.c
+++ b/tools/nxstyle.c
@@ -2221,7 +2221,11 @@ int main(int argc, char **argv, char **envp)
 
                   else if (strncmp(&line[ii], "include", 7) == 0)
                     {
-                      if (g_section != INCLUDED_FILES)
+                      /* A file included in an initializer provides the
+                       * data of the initializer.
+                       */
+
+                      if (g_section != INCLUDED_FILES && dnest == 0)
                         {
                           /* Only a warning because there is some usage of
                            * include outside the Included Files section

Reply via email to