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 b5ef29f06e34a262693612eb7db116c4d0337dee
Author: buxiasen <[email protected]>
AuthorDate: Thu Sep 18 22:44:07 2025 +0800

    tools/nxstyle: fix the brace detect when DEFINE_PER_CPU_x
    
    Fix typo and spell, fix the DEFINE_PER_CPU_BMP && '{}' not recognized.
    
    nxstyle did not treat a line that starts with DEFINE_PER_CPU_ as a
    declaration, so a per-CPU variable with an initializer was reported as
    a bad brace alignment.
    
    Signed-off-by: buxiasen <[email protected]>
---
 tools/nxstyle.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/nxstyle.c b/tools/nxstyle.c
index 43bba01f697..ca9824c2d6a 100644
--- a/tools/nxstyle.c
+++ b/tools/nxstyle.c
@@ -2585,6 +2585,7 @@ int main(int argc, char **argv, char **envp)
                    strncmp(&line[indent], "union\n", 6) == 0 ||  /* May be 
unnamed */
                    strncmp(&line[indent], "unsigned ", 9) == 0 ||
                    strncmp(&line[indent], "void ", 5) == 0 ||
+                   strncmp(&line[indent], "DEFINE_PER_CPU_", 15) == 0 ||  /* 
Maybe the percpu define */
                    strncmp(&line[indent], "volatile ", 9) == 0)
             {
               /* Check if this is extern "C";  We don't typically indent
@@ -4387,7 +4388,7 @@ int main(int argc, char **argv, char **envp)
                 }
               else if (!bfunctions && (indent & 1) != 0)
                 {
-                  ERROR("Bad left brace alignment", lineno, indent);
+                  ERROR("Bad right brace alignment", lineno, indent);
                 }
               else if (indent > 0 && prevdnest == 0 &&
                        (bexact ? indent != stmt_indent : (indent & 3) != 0))

Reply via email to