summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/dist/s_comment.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/third_party/wiredtiger/dist/s_comment.py')
-rw-r--r--src/third_party/wiredtiger/dist/s_comment.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/third_party/wiredtiger/dist/s_comment.py b/src/third_party/wiredtiger/dist/s_comment.py
index 556862f0fcc..f30de0e4794 100644
--- a/src/third_party/wiredtiger/dist/s_comment.py
+++ b/src/third_party/wiredtiger/dist/s_comment.py
@@ -63,14 +63,20 @@ for line in sys.stdin:
indent_ws = ' ' * indentation
sys.stdout.write('{}/*\n'.format(indent_ws))
current_line = indent_ws + ' *'
- for word in words:
+ for i in range(len(words)):
+ word = words[i]
if word == '--' and function_desc:
sys.stdout.write(current_line + ' ' + word + '\n')
current_line = indent_ws + ' *' + ' ' * 4
continue
if word == '\n':
- sys.stdout.write(current_line + '\n')
- sys.stdout.write(indent_ws + ' *' + '\n')
+ # If we already have partially built a line, write it out.
+ if current_line != indent_ws + ' *':
+ sys.stdout.write(current_line + '\n')
+ # If there are more words in this comment after this
+ # newline, add another line break.
+ if i < (len(words) - 1):
+ sys.stdout.write(indent_ws + ' *' + '\n')
current_line = indent_ws + ' *'
continue
if len(current_line) + len(word) >= line_length:
@@ -89,6 +95,10 @@ for line in sys.stdin:
function_desc = False
elif multiline:
comment += line
+ # We want to preserve newlines for block comments that have multiple paragraphs.
+ if sline == '*':
+ words.append('\n')
+ continue
# Function names begin with either a lowercase char or an underscore.
if (len(sline) >= 3 and sline.startswith('*') and sline[1] == ' ' and
(sline[2].islower() or sline[2] == '_') and sline.endswith('--')):