提交 84731623 编写于 作者: J Joe Perches 提交者: Linus Torvalds

checkpatch: report missing spaces around trigraphs with --strict

Spaces around trigraphs are specified by CodingStyle but checkpatch is
currently silent about them because there are many current instances
without them.

Make missing spaces around trigraphs a --strict message.
Signed-off-by: NJoe Perches <joe@perches.com>
Reviewed-by: NJosh Triplett <josh@joshtriplett.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 6bc080d8
...@@ -2838,7 +2838,7 @@ sub process { ...@@ -2838,7 +2838,7 @@ sub process {
\+=|-=|\*=|\/=|%=|\^=|\|=|&=| \+=|-=|\*=|\/=|%=|\^=|\|=|&=|
=>|->|<<|>>|<|>|=|!|~| =>|->|<<|>>|<|>|=|!|~|
&&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/|%| &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/|%|
\?|: \?:|\?|:
}x; }x;
my @elements = split(/($ops|;)/, $opline); my @elements = split(/($ops|;)/, $opline);
...@@ -3061,15 +3061,13 @@ sub process { ...@@ -3061,15 +3061,13 @@ sub process {
$ok = 1; $ok = 1;
} }
# Ignore ?: # messages are ERROR, but ?: are CHK
if (($opv eq ':O' && $ca =~ /\?$/) ||
($op eq '?' && $cc =~ /^:/)) {
$ok = 1;
}
if ($ok == 0) { if ($ok == 0) {
if (ERROR("SPACING", my $msg_type = \&ERROR;
"spaces required around that '$op' $at\n" . $hereptr)) { $msg_type = \&CHK if (($op eq '?:' || $op eq '?' || $op eq ':') && $ctx =~ /VxV/);
if (&{$msg_type}("SPACING",
"spaces required around that '$op' $at\n" . $hereptr)) {
$good = rtrim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " "; $good = rtrim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " ";
if (defined $fix_elements[$n + 2]) { if (defined $fix_elements[$n + 2]) {
$fix_elements[$n + 2] =~ s/^\s+//; $fix_elements[$n + 2] =~ s/^\s+//;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册