From b03ee91ebf31bf317e49cb1295a923bd7ed0d958 Mon Sep 17 00:00:00 2001 From: Terunao HIROTA Date: Thu, 8 Aug 2019 11:57:08 +0900 Subject: syncqt: Fix to work correctly when the line endings are LF in Win-msys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Windows-msys syncqt.pl expects CRLF line endings, and does not work correctly with LF. syncqt.pl was fixed to be line-ending-agnostic. Task-number: QTBUG-77192 Change-Id: Ie8029238bdd580bcf042ede0d0f64d5f01488406 Reviewed-by: Jörg Bornemann --- bin/syncqt.pl | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'bin') diff --git a/bin/syncqt.pl b/bin/syncqt.pl index 8226edfb76..43ecff53dd 100755 --- a/bin/syncqt.pl +++ b/bin/syncqt.pl @@ -79,9 +79,6 @@ normalizePath(\$out_basedir); our $build_basedir; our $basedir; -# Make sure we use Windows line endings for chomp and friends on Windows. -$INPUT_RECORD_SEPARATOR = "\r\n" if ($^O eq "msys"); - # will be defined based on the modules sync.profile our (%modules, %moduleheaders, @allmoduleheadersprivate, %classnames, %deprecatedheaders); our (@qpa_headers, @private_headers); @@ -182,10 +179,10 @@ sub shouldMasterInclude { my ($iheader) = @_; return 0 if (basename($iheader) =~ /_/); return 0 if (basename($iheader) =~ /qconfig/); + local $/ = "\x0a"; if (open(F, "<$iheader")) { while () { - chomp; - chop if /\r$/; + s/\x0d?\x0a//; return 0 if (/^\#pragma qt_no_master_include$/); } close(F); @@ -215,11 +212,11 @@ sub classNames { my $ihdrbase = basename($iheader); my $parsable = ""; + local $/ = "\x0a"; if(open(F, "<$iheader")) { while() { + s/\x0d?\x0a//; my $line = $_; - chomp $line; - chop $line if ($line =~ /\r$/); if($line =~ /^\#/) { $$clean = 0 if ($line =~ m/^#pragma qt_sync_skip_header_check/); return @ret if($line =~ m/^#pragma qt_sync_stop_processing/); @@ -336,6 +333,7 @@ sub check_header { $header_skip_qt_begin_namespace_test = 1 if ($ignore_for_qt_begin_namespace_check{$header}); } + local $/ = "\x0a"; open(F, "<$iheader") or return; my $qt_begin_namespace_found = 0; my $qt_end_namespace_found = 0; @@ -344,7 +342,7 @@ sub check_header { my $stop_processing = 0; my $we_mean_it = 0; while ($line = ) { - chomp $line; + $line =~ s/\x0d?\x0a//; my $output_line = 1; if ($line =~ /^ *\# *pragma (qt_no_included_check|qt_sync_stop_processing)/) { $stop_processing = 1; @@ -965,9 +963,10 @@ foreach my $lib (@modules_to_sync) { #push @files, "$out_basedir/include/Qt/$t" if(-e "$out_basedir/include/Qt/$t"); foreach my $file (@files) { my $remove_file = 0; + local $/ = "\x0a"; if(open(F, "<$file")) { while(my $line = ) { - chomp $line; + $line =~ s/\x0d?\x0a//; if($line =~ /^\#include \"([^\"]*)\"$/) { my $include = $1; $include = $subdir . "/" . $include unless(substr($include, 0, 1) eq "/"); -- cgit v1.2.3 From 8ce653e048746d65ae46773f555ee8786b10ff68 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Fri, 30 Aug 2019 10:18:22 +0200 Subject: Make sure QLatin1Literal fwd header is generated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This broke when QLatin1Literal got deprecated in change 45373c19243aea335897ba0f371a1dd53ae8f079 Both hunks in this patch are needed. The hunk in syncqt.pl removes the QT_DEPRECATED_X(...) macro if it appears solely on a line in source code, the second hunk inserts a newline after the QT_DEPRECATED_X(...) macro usage to trigger that code path in the Perl script. Before/after comparison of the headers generated in include/QtCore: ``` % diff ~/old.txt ~/new.txt 105a106 > QLatin1Literal ``` Change-Id: I468dd2dd54bf115521ed82c6182236905556f568 Reviewed-by: Jörg Bornemann --- bin/syncqt.pl | 1 + 1 file changed, 1 insertion(+) (limited to 'bin') diff --git a/bin/syncqt.pl b/bin/syncqt.pl index 43ecff53dd..1258994f93 100755 --- a/bin/syncqt.pl +++ b/bin/syncqt.pl @@ -228,6 +228,7 @@ sub classNames { $line .= ";" if($line =~ m/^Q_[A-Z_0-9]*\(.*\)[\r\n]*$/); #qt macro $line .= ";" if($line =~ m/^QT_(BEGIN|END)_HEADER[\r\n]*$/); #qt macro $line .= ";" if($line =~ m/^QT_(BEGIN|END)_NAMESPACE(_[A-Z]+)*[\r\n]*$/); #qt macro + $line .= ";" if($line =~ m/^QT_DEPRECATED_X\(.*\)[\r\n]*$/); #qt macro $line .= ";" if($line =~ m/^QT_MODULE\(.*\)[\r\n]*$/); # QT_MODULE macro $line .= ";" if($line =~ m/^QT_WARNING_(PUSH|POP|DISABLE_\w+\(.*\))[\r\n]*$/); # qt macros $$requires = $1 if ($line =~ m/^QT_REQUIRE_CONFIG\((.*)\);[\r\n]*$/); -- cgit v1.2.3