From: Sven Eden Date: Fri, 25 May 2018 05:51:27 +0000 (+0200) Subject: check_tree.pl: Fixed check_musl(), it must track mask state changes itself. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=abf81110d0dd8d9d9b9ac8280dd4cc9e78944aff;p=elogind.git check_tree.pl: Fixed check_musl(), it must track mask state changes itself. --- diff --git a/pwx/check_tree.pl b/pwx/check_tree.pl index de67ba28b..80b080b8d 100755 --- a/pwx/check_tree.pl +++ b/pwx/check_tree.pl @@ -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; } diff --git a/pwx/last_mutual_commits.csv b/pwx/last_mutual_commits.csv index 60af65140..a9334f715 100644 --- a/pwx/last_mutual_commits.csv +++ b/pwx/last_mutual_commits.csv @@ -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