Skip to content

Commit

Permalink
AVRO-4035: Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit0 committed Aug 31, 2024
1 parent 3c6390d commit 0549e5c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lang/c++/impl/avrogencpp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,19 @@ void CodeGen::generateDocComment(const NodePtr &n, const char *indent) {
std::vector<std::string> lines;
boost::algorithm::split(lines, n->getDoc(), boost::algorithm::is_any_of("\n"));
for (auto &line : lines) {
os_ << indent << "// " << line << "\n";
boost::algorithm::replace_all(line, "\r", "");

if (line.empty()) {
os_ << indent << "//\n";
} else {
// If a comment line ends with a backslash, avoid generating code which will generate
// multi-line comment warnings on GCC. We can't just append whitespace here as escaped
// newlines ignore trailing whitespace.
if (line.back() == '\\') {
line.append("(backslash)");
}
os_ << indent << "// " << line << "\n";
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions lang/c++/jsonschemas/bigrecord
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
{
"name": "nestedrecord",
"doc": "Doc edge cases\r\nwith trailing backslash\\",
"type": {
"type": "record",
"name": "Nested",
Expand Down

0 comments on commit 0549e5c

Please sign in to comment.