From eddb938c39d03e163ef47c965ea07ab19250eeed Mon Sep 17 00:00:00 2001
From: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Date: Fri, 27 Nov 2015 12:19:33 +0100
Subject: [PATCH] Remove duplicated header iteration code

Do not iterate separately over all header files. This removes
duplicated header iteration code which already was out of sync.
As a side-effect, we do run the header check only on header files that
are considered part of the module, if moduleheaders is set in
sync.profile.

Change-Id: Iec4c8febe9128139d2f377a1da8ce08c24110a77
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
---
 bin/syncqt.pl | 40 +++-------------------------------------
 1 file changed, 3 insertions(+), 37 deletions(-)

diff --git a/bin/syncqt.pl b/bin/syncqt.pl
index 6b8d847a782..faa39aa351f 100755
--- a/bin/syncqt.pl
+++ b/bin/syncqt.pl
@@ -1004,6 +1004,9 @@ foreach my $lib (@modules_to_sync) {
                         my $clean_header;
                         my $iheader = $subdir . "/" . $header;
                         $iheader =~ s/^\Q$basedir\E/$out_basedir/ if ($shadow);
+                        if ($check_includes) {
+                            check_header($lib, $header, $iheader, $public_header, !$public_header && !$qpa_header);
+                        }
                         my @classes = $public_header && (!$minimal && $is_qt) ? classNames($iheader, \$clean_header) : ();
                         if($showonly) {
                             print "$header [$lib]\n";
@@ -1201,41 +1204,4 @@ foreach my $lib (@modules_to_sync) {
     }
 }
 
-if($check_includes) {
-    foreach my $lib (@modules_to_sync) {
-        next if ($modules{$lib} =~ /^!/);
-            #calc subdirs
-            my @subdirs = listSubdirs(map { s/^\^//; $_ } split(/;/, $modules{$lib}));
-
-            foreach my $subdir (@subdirs) {
-                my @headers = findFiles($subdir, "^[-a-z0-9_]*\\.h\$" , 0);
-                foreach my $header (@headers) {
-                    $header = 0 if($header =~ /^ui_.*.h/);
-                    $header = 0 if ($header eq lc($lib)."version.h");
-                    foreach (@ignore_headers) {
-                        $header = 0 if($header eq $_);
-                    }
-                    if($header) {
-                        # We need both $public_header and $private_header because QPA headers count as neither
-                        my $public_header = $header;
-                        my $private_header = 0;
-                        if($public_header =~ /_p.h$/ || $public_header =~ /_pch.h$/) {
-                            $public_header = 0;
-                            $private_header = $header =~ /_p.h$/ && $subdir !~ /3rdparty/
-                        } elsif (isQpaHeader($public_header)) {
-                            $public_header = 0;
-                        } else {
-                            foreach (@ignore_for_master_contents) {
-                                $public_header = 0 if($header eq $_);
-                            }
-                        }
-
-                        my $iheader = $subdir . "/" . $header;
-                        check_header($lib, $header, $iheader, $public_header, $private_header);
-                    }
-                }
-            }
-    }
-}
-
 exit 0;
-- 
GitLab