From 30d7dbd9a6fe62ad1f46feec856fc3466774f827 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 21 Aug 2018 13:32:05 -0600 Subject: [PATCH] Update C Coding standard again. Correct some comments in tools/nxstyle.c --- Documentation/NuttXCCodingStandard.html | 17 +++++++++++++++-- tools/nxstyle.c | 11 +++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Documentation/NuttXCCodingStandard.html b/Documentation/NuttXCCodingStandard.html index 97f346a8a8..9f1778231d 100644 --- a/Documentation/NuttXCCodingStandard.html +++ b/Documentation/NuttXCCodingStandard.html @@ -419,8 +419,12 @@
  • With braces. - No blank line separates the beginning left brace from a comment. - No blank line follows a comment that may be the final thing preceding a right brace. + No blank line separates the line containing the opening left brace from a comment. + No blank line follows a comment that may be the final line preceding a closing right brace. +
  • +
  • + With Labels. + No blank line separates the line containing the label from a comment.
  • @@ -444,6 +448,11 @@ /* Only a comment */ } + + here: + + /* This is the place */ +
    @@ -468,6 +477,10 @@ { /* Only a comment */ } + + here: + /* This is the place */ +
    diff --git a/tools/nxstyle.c b/tools/nxstyle.c index ba9da779d6..438867a79e 100644 --- a/tools/nxstyle.c +++ b/tools/nxstyle.c @@ -119,6 +119,11 @@ int main(int argc, char **argv, char **envp) { if (lineno == last_oneline_comment + 1) { + /* TODO: This generates a false alarm if the current line + * contains a right brace. No blank line should be present in + * that case. + */ + fprintf(stderr, "Missing blank line after comment line. Found at line %d\n", last_oneline_comment); @@ -179,13 +184,11 @@ int main(int argc, char **argv, char **envp) if (line[indent] == '/' && line[indent +1] == '*' && lptr - line == linelen - 3) { - /* TODO: This generates a false alarm if followed by a right brace. - * No blank line should be present in that case. - */ - if (last_oneline_comment != lineno - 1 && last_blank_line != lineno - 1) { + /* TODO: This generates a false alarm if preceded by a label. */ + fprintf(stderr, "Missing blank line before comment found at line %d\n", lineno);