chiark / gitweb /
check_tree.pl: Fixed check_musl(), it must track mask state changes itself.
authorSven Eden <yamakuzure@gmx.net>
Fri, 25 May 2018 05:51:27 +0000 (07:51 +0200)
committerSven Eden <yamakuzure@gmx.net>
Fri, 25 May 2018 05:51:27 +0000 (07:51 +0200)
pwx/check_tree.pl
pwx/last_mutual_commits.csv

index de67ba28b676d78d50743a7d1fd3f1fe365fe009..80b080b8dca01d7050d3fa1ebad8975d05b1a40c 100755 (executable)
@@ -790,8 +790,7 @@ sub check_includes {
                                }
                                if ($all_same) {
                                        # The insertion is right before or after the removal. That's pointless.
-                                       $undos{$i} = 1;
-                                       $undos{$hIncs{$inc}{insert}{lineid}} = 1;
+                                       $undos{$hIncs{$inc}{remove}{lineid}} = 1;
                                        $hIncs{$inc}{applied}  = 1;
                                        $hIncs{$inc}{insert}{spliceme} = 1;
                                        next;
@@ -807,7 +806,7 @@ sub check_includes {
                                $hIncs{$inc}{applied}  = 1;
                        } elsif ( $hIncs{$inc}{insert}{elogind} ) {
                                # Do not move masked includes under our block.
-                               $undos{$i} = 1;
+                               $undos{$hIncs{$inc}{remove}{lineid}} = 1;
                                $hIncs{$inc}{applied}  = 1;
                                $hIncs{$inc}{insert}{spliceme} = 1;
                        } else {
@@ -1046,9 +1045,26 @@ sub check_musl {
        # and the alternative block.
        my $regular_ifs = 0;
 
+       # Remember the final mask state for later reversal
+       # ------------------------------------------------
+       my $hunk_ends_in_mask = $in_mask_block;
+       my $hunk_ends_in_else = $in_else_block;
+       $in_else_block = 0;
+       $hHunk->{masked_start} and $in_mask_block = 1 or $in_mask_block = 0;
+
        for (my $i = 0; $i < $hHunk->{count}; ++$i) {
                my $line = \$hHunk->{lines}[$i]; ## Shortcut
 
+               # Quick mask checks, we must have the intermediate states
+               # -------------------------------------------------------
+               is_mask_start($$line) and ++$in_mask_block and next;
+               is_mask_else($$line)  and ++$in_else_block and next;
+               if (is_mask_end($$line)) {
+                       $in_mask_block--;
+                       $in_else_block--;
+                       next;
+               }
+
                # Entering a __GLIBC__ block
                # ---------------------------------------
                if ( $$line =~ m/^-#if.+__GLIBC__/ ) {
@@ -1090,6 +1106,11 @@ sub check_musl {
                }
        } ## End of looping lines
 
+       # Revert the final mask state remembered above
+       # ------------------------------------------------
+       $in_mask_block = $hunk_ends_in_mask;
+       $in_else_block = $hunk_ends_in_else;
+
        return 1;
 }
 
@@ -1108,6 +1129,13 @@ sub check_name_reverts {
        # Note down what is changed, so we can have inline updates
        my %hRemovals = ();
 
+       # Remember the final mask state for later reversal
+       # ------------------------------------------------
+       my $hunk_ends_in_mask = $in_mask_block;
+       my $hunk_ends_in_else = $in_else_block;
+       $in_else_block = 0;
+       $hHunk->{masked_start} and $in_mask_block = 1 or $in_mask_block = 0;
+
        for (my $i = 0; $i < $hHunk->{count}; ++$i) {
                my $line = \$hHunk->{lines}[$i]; ## Shortcut
 
@@ -1115,6 +1143,16 @@ sub check_name_reverts {
                        or return hunk_failed("check_name_reverts: Line "
                                . ($i + 1) . "/$hHunk->{count} is undef?");
 
+               # Quick mask checks, we must have the intermediate states
+               # -------------------------------------------------------
+               is_mask_start($$line) and ++$in_mask_block and next;
+               is_mask_else($$line)  and ++$in_else_block and next;
+               if (is_mask_end($$line)) {
+                       $in_mask_block = 0;
+                       $in_else_block = 0;
+                       next;
+               }
+
                # Note down removals
                # ---------------------------------
                if ($$line =~ m/^-[# ]*\s*(.*elogind.*)\s*$/) {
@@ -1171,6 +1209,11 @@ sub check_name_reverts {
                }
        }
 
+       # Revert the final mask state remembered above
+       # ------------------------------------------------
+       $in_mask_block = $hunk_ends_in_mask;
+       $in_else_block = $hunk_ends_in_else;
+
        return 1;
 }
 
@@ -2131,9 +2174,14 @@ sub read_includes {
        my $in_elogind_block = 0;
        for (my $i = 0; $i < $hHunk->{count}; ++$i) {
                my $line = \$hHunk->{lines}[$i]; ## Shortcut
-               # Note down removes of includes we commented out
+
+               # Note down removals of includes we commented out
                if ( $$line =~ m,^-\s*//+\s*#include\s+([<"'])([^>"']+)[>"'], ) {
-                       $hIncs{$2}{remove} = { hunkid => $hHunk->{idx}, lineid => $i, sysinc => $1 eq "<" };
+                       $hIncs{$2}{remove} = {
+                               hunkid => $hHunk->{idx},
+                               lineid => $i,
+                               sysinc => $1 eq "<"
+                       };
                        next;
                }
 
index 60af651402fd84eab77c307d8fbf6f8ce3a3f60d..a9334f7159ebe205dad31c4f5fc0ed98eefbb98d 100644 (file)
@@ -11,4 +11,4 @@
 ../systemd-upstream master      265710c20 src-efaa3176a x
 ../systemd-upstream v234        d6d0473dc src-782c925f7 x
 ../systemd-upstream v236        83fefc888 src-f78a88bec x
-../systemd-upstream v237        245992a0c src-6d8c71eb8 tgt-970cccece
+../systemd-upstream v237        590171d1c956ac3b073bc73a7ca1f5529b01ab83 x x