Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cstyle: Allow URLs in C++ comments #13987

Merged
merged 1 commit into from
Oct 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions scripts/cstyle.pl
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,6 @@ ($$)
if (/\S\*\/[^)]|\S\*\/$/ && !/$lint_re/) {
err("missing blank before close comment");
}
if (/\/\/\S/) { # C++ comments
err("missing blank after start comment");
}
# check for unterminated single line comments, but allow them when
# they are used to comment out the argument list of a function
# declaration.
Expand Down Expand Up @@ -534,7 +531,15 @@ ($$)
# multiple comments on the same line.
#
s/\/\*.*?\*\///g;
s/\/\/.*$//; # C++ comments
s/\/\/(?:\s.*)?$//; # Valid C++ comments

# After stripping correctly spaced comments, check for (and strip) comments
# without a blank. By checking this after clearing out C++ comments that
# correctly have a blank, we guarantee URIs in a C++ comment will not cause
# an error.
if (s!//.*$!!) { # C++ comments
err("missing blank after start comment");
}

# delete any trailing whitespace; we have already checked for that.
s/\s*$//;
Expand Down