Remove leading blank lines in convert_comments.go

The OpenSSL style writes multiline block comments with a blank line at
the top and bottom, like so:

  /*
   * Some multi-line
   * comment
   */

The script already removed the trailing blank line, but not the leading
one. When we go to run this script in crypto/asn1, etc., we'll come
across those comments.

Change-Id: I189aec87a08607008779f883a97f2c53d24ee2da
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/52730
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
chromium-5359
David Benjamin 3 years ago committed by Boringssl LUCI CQ
parent ac57319dd8
commit 1f7525e991
  1. 23
      util/convert_comments.go

@ -232,6 +232,29 @@ func convertComments(path string, in []byte) []byte {
}
for i, line := range group.lines {
// The OpenSSL style writes multiline block comments with a
// blank line at the top and bottom, like so:
//
// /*
// * Some multi-line
// * comment
// */
//
// The trailing lines are already removed above, when buffering.
// Remove the leading lines here. (The leading lines cannot be
// removed when buffering because we may discover the comment is
// not convertible in later lines.)
//
// Note the leading line cannot be easily removed if there is
// code before it, such as the following. Skip those cases.
//
// foo(); /*
// * Some multi-line
// * comment
// */
if i == 0 && allSpaces(line[:group.column]) && len(line) == group.column+2 {
continue
}
newLine := fmt.Sprintf("%s%s//%s", line[:group.column], adjust, strings.TrimRight(line[group.column+2:], " "))
if len(newLine) > 80 {
fmt.Fprintf(os.Stderr, "%s:%d: Line is now longer than 80 characters\n", path, lineNo+i+1)

Loading…
Cancel
Save