You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/03/09 16:00:38 UTC

[incubator-nuttx] 04/07: Restrict check of right of code comments to #define in case of preprocessor lines

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

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

commit fbe65a2d7dc5024e829ceba1409f9da8c0c68d76
Author: Johanne Schock <jo...@nivus.com>
AuthorDate: Sun Mar 8 22:24:27 2020 +0100

    Restrict check of right of code comments to #define in case of preprocessor lines
---
 tools/nxstyle.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/tools/nxstyle.c b/tools/nxstyle.c
index 47c5615..9edd48f 100644
--- a/tools/nxstyle.c
+++ b/tools/nxstyle.c
@@ -941,12 +941,15 @@ int main(int argc, char **argv, char **envp)
                       ncomment++;
                     }
 
-                  rhcomment = n;
-                  if (prevrhcmt != 0 && n != prevrhcmt)
+                  if (!strncmp(&line[ii], "define", 6))
                     {
-                      rhcomment = prevrhcmt;
-                      WARN("Wrong column position of comment right of code",
-                          lineno, n);
+                      rhcomment = n;
+                      if (prevrhcmt != 0 && n != prevrhcmt)
+                        {
+                          rhcomment = prevrhcmt;
+                          WARN("Wrong column position of comment right of code",
+                              lineno, n);
+                        }
                     }
                 }
             }