aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl23
1 files changed, 21 insertions, 2 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 374abf443636..696254eee78b 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3563,14 +3563,33 @@ sub process {
3563 } 3563 }
3564 } 3564 }
3565 3565
3566 # , must have a space on the right. 3566 # , must not have a space before and must have a space on the right.
3567 } elsif ($op eq ',') { 3567 } elsif ($op eq ',') {
3568 my $rtrim_before = 0;
3569 my $space_after = 0;
3570 if ($ctx =~ /Wx./) {
3571 if (ERROR("SPACING",
3572 "space prohibited before that '$op' $at\n" . $hereptr)) {
3573 $line_fixed = 1;
3574 $rtrim_before = 1;
3575 }
3576 }
3568 if ($ctx !~ /.x[WEC]/ && $cc !~ /^}/) { 3577 if ($ctx !~ /.x[WEC]/ && $cc !~ /^}/) {
3569 if (ERROR("SPACING", 3578 if (ERROR("SPACING",
3570 "space required after that '$op' $at\n" . $hereptr)) { 3579 "space required after that '$op' $at\n" . $hereptr)) {
3571 $good = $fix_elements[$n] . trim($fix_elements[$n + 1]) . " ";
3572 $line_fixed = 1; 3580 $line_fixed = 1;
3573 $last_after = $n; 3581 $last_after = $n;
3582 $space_after = 1;
3583 }
3584 }
3585 if ($rtrim_before || $space_after) {
3586 if ($rtrim_before) {
3587 $good = rtrim($fix_elements[$n]) . trim($fix_elements[$n + 1]);
3588 } else {
3589 $good = $fix_elements[$n] . trim($fix_elements[$n + 1]);
3590 }
3591 if ($space_after) {
3592 $good .= " ";
3574 } 3593 }
3575 } 3594 }
3576 3595