aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl36
1 files changed, 18 insertions, 18 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 88027f237cd..8afa88aaed9 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -858,6 +858,19 @@ sub annotate_values {
858 print "CLOSE($1)\n" if ($dbg_values > 1); 858 print "CLOSE($1)\n" if ($dbg_values > 1);
859 $type = 'N'; 859 $type = 'N';
860 860
861 } elsif ($cur =~ /^(-(?![->])|\+(?!\+)|\*|\&(?!\&))/o) {
862 my $variant;
863
864 print "OPV($1)\n" if ($dbg_values > 1);
865 if ($type eq 'V') {
866 $variant = 'B';
867 } else {
868 $variant = 'U';
869 }
870
871 substr($var, length($res), 1, $variant);
872 $type = 'N';
873
861 } elsif ($cur =~ /^($Operators)/o) { 874 } elsif ($cur =~ /^($Operators)/o) {
862 print "OP($1)\n" if ($dbg_values > 1); 875 print "OP($1)\n" if ($dbg_values > 1);
863 if ($1 ne '++' && $1 ne '--') { 876 if ($1 ne '++' && $1 ne '--') {
@@ -1573,22 +1586,8 @@ sub process {
1573 my $ptr = substr($blank, 0, $off) . "^"; 1586 my $ptr = substr($blank, 0, $off) . "^";
1574 my $hereptr = "$hereline$ptr\n"; 1587 my $hereptr = "$hereline$ptr\n";
1575 1588
1576 # Classify operators into binary, unary, or 1589 # Pull out the value of this operator.
1577 # definitions (* only) where they have more
1578 # than one mode.
1579 my $op_type = substr($curr_values, $off + 1, 1); 1590 my $op_type = substr($curr_values, $off + 1, 1);
1580 my $op_left = substr($curr_values, $off, 1);
1581 my $is_unary;
1582 if ($op_type eq 'T') {
1583 $is_unary = 2;
1584 } elsif ($op_left eq 'V') {
1585 $is_unary = 0;
1586 } else {
1587 $is_unary = 1;
1588 }
1589 #if ($op eq '-' || $op eq '&' || $op eq '*') {
1590 # print "UNARY: <$op_left$op_type $is_unary $a:$op:$c> <$ca:$op:$cc> <$unary_ctx>\n";
1591 #}
1592 1591
1593 # Get the full operator variant. 1592 # Get the full operator variant.
1594 my $opv = $op . substr($curr_vars, $off, 1); 1593 my $opv = $op . substr($curr_vars, $off, 1);
@@ -1625,18 +1624,19 @@ sub process {
1625 } 1624 }
1626 1625
1627 # '*' as part of a type definition -- reported already. 1626 # '*' as part of a type definition -- reported already.
1628 } elsif ($op eq '*' && $is_unary == 2) { 1627 } elsif ($opv eq '*_') {
1629 #warn "'*' is part of type\n"; 1628 #warn "'*' is part of type\n";
1630 1629
1631 # unary operators should have a space before and 1630 # unary operators should have a space before and
1632 # none after. May be left adjacent to another 1631 # none after. May be left adjacent to another
1633 # unary operator, or a cast 1632 # unary operator, or a cast
1634 } elsif ($op eq '!' || $op eq '~' || 1633 } elsif ($op eq '!' || $op eq '~' ||
1635 ($is_unary && ($op eq '*' || $op eq '-' || $op eq '&'))) { 1634 $opv eq '*U' || $opv eq '-U' ||
1635 $opv eq '&U') {
1636 if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) { 1636 if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) {
1637 ERROR("space required before that '$op' $at\n" . $hereptr); 1637 ERROR("space required before that '$op' $at\n" . $hereptr);
1638 } 1638 }
1639 if ($op eq '*' && $cc =~/\s*const\b/) { 1639 if ($op eq '*' && $cc =~/\s*const\b/) {
1640 # A unary '*' may be const 1640 # A unary '*' may be const
1641 1641
1642 } elsif ($ctx =~ /.xW/) { 1642 } elsif ($ctx =~ /.xW/) {