Thread: False failure during repeated windows build.
Hello. I found it quite annoying that it stops with complaining as "unused defines" during repeated execution of build.pl. The subroutine GenerateConfigHeader prepares %defines_copy before checking the newness of $config_header and even if it decides not to generate new one, the following code makes sure if the %defines_copy is empty, then of course it fails with the message. The attached fixes that. regards. -- Kyotaro Horiguchi NTT Open Source Software Center From b276face1b8f7b2e7a3ce9b3060205d6f04a1735 Mon Sep 17 00:00:00 2001 From: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Date: Tue, 18 Feb 2020 15:29:55 +0900 Subject: [PATCH] Fix behavior for repeated build on Windows. Even after the function GenerateConfigHeader in Solution.pm decided not to generate a new file, it wrongly checks for the remaining macro defintions and stops with failure. Fix it by not doing the check if it skipped file generation. --- src/tools/msvc/Solution.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm index 8412ef298e..cf16144b02 100644 --- a/src/tools/msvc/Solution.pm +++ b/src/tools/msvc/Solution.pm @@ -839,13 +839,14 @@ EOF sub GenerateConfigHeader { my ($self, $config_header, $defines, $required) = @_; - my %defines_copy = %$defines; my $config_header_in = $config_header . '.in'; if (IsNewer($config_header, $config_header_in) || IsNewer($config_header, __FILE__)) { + my %defines_copy = %$defines; + open(my $i, '<', $config_header_in) || confess "Could not open $config_header_in\n"; open(my $o, '>', $config_header) @@ -884,10 +885,11 @@ sub GenerateConfigHeader } close($o); close($i); - } - if ($required && scalar(keys %defines_copy) > 0) - { - croak "unused defines: " . join(' ', keys %defines_copy); + + if ($required && scalar(keys %defines_copy) > 0) + { + croak "unused defines: " . join(' ', keys %defines_copy); + } } } -- 2.18.2
On Tue, Feb 18, 2020 at 8:06 AM Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote:
The attached fixes that.
After commit 9573384 this patch no longer applies, but with a trivial rebase it fixes the issue.
Regards,
Juan José Santamaría Flecha
At Fri, 21 Feb 2020 14:02:40 +0100, Juan José Santamaría Flecha <juanjo.santamaria@gmail.com> wrote in > After commit 9573384 this patch no longer applies, but with a trivial > rebase it fixes the issue. Thanks! This is the rebased version. I'll register this to the next CF. regards. -- Kyotaro Horiguchi NTT Open Source Software Center From 70a725f2f8fab8b490106f2625ac821ab7680675 Mon Sep 17 00:00:00 2001 From: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Date: Tue, 18 Feb 2020 15:29:55 +0900 Subject: [PATCH v2] Fix behavior for repeated build on Windows. Even after the function GenerateConfigHeader in Solution.pm decided not to generate a new file, it wrongly checks for the remaining macro defintions and stops with failure. Fix it by not doing the check if it skipped file generation. --- src/tools/msvc/Solution.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm index 75f916399c..6b4a6eec2a 100644 --- a/src/tools/msvc/Solution.pm +++ b/src/tools/msvc/Solution.pm @@ -826,13 +826,14 @@ EOF sub GenerateConfigHeader { my ($self, $config_header, $defines, $required) = @_; - my %defines_copy = %$defines; my $config_header_in = $config_header . '.in'; if (IsNewer($config_header, $config_header_in) || IsNewer($config_header, __FILE__)) { + my %defines_copy = %$defines; + open(my $i, '<', $config_header_in) || confess "Could not open $config_header_in\n"; open(my $o, '>', $config_header) @@ -871,10 +872,11 @@ sub GenerateConfigHeader } close($o); close($i); - } - if ($required && scalar(keys %defines_copy) > 0) - { - croak "unused defines: " . join(' ', keys %defines_copy); + + if ($required && scalar(keys %defines_copy) > 0) + { + croak "unused defines: " . join(' ', keys %defines_copy); + } } } -- 2.18.2
On Tue, Feb 25, 2020 at 10:14:10AM +0900, Kyotaro Horiguchi wrote: > At Fri, 21 Feb 2020 14:02:40 +0100, Juan José Santamaría Flecha <juanjo.santamaria@gmail.com> wrote in > > After commit 9573384 this patch no longer applies, but with a trivial > > rebase it fixes the issue. > > Thanks! This is the rebased version. I'll register this to the next CF. That's annoying, and you are right. So, committed. -- Michael
Attachment
At Tue, 25 Feb 2020 14:02:04 +0900, Michael Paquier <michael@paquier.xyz> wrote in > On Tue, Feb 25, 2020 at 10:14:10AM +0900, Kyotaro Horiguchi wrote: > > At Fri, 21 Feb 2020 14:02:40 +0100, Juan José Santamaría Flecha <juanjo.santamaria@gmail.com> wrote in > > > After commit 9573384 this patch no longer applies, but with a trivial > > > rebase it fixes the issue. > > > > Thanks! This is the rebased version. I'll register this to the next CF. > > That's annoying, and you are right. So, committed. Thank you for committing. regards. -- Kyotaro Horiguchi NTT Open Source Software Center