diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-12-02 23:33:06 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-12-02 23:33:06 +0100 |
commit | 72f5867f144cec8fc7848cbcc772683fe845652d (patch) | |
tree | 7513af27b59332bf111f406d304977adc8c8612e /bin/syncqt.pl | |
parent | 13777097118c496391d4b9656b95097ac25e4a40 (diff) | |
parent | bf0af8b5a24de7e595929a64948a3548936aaaee (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
src/corelib/kernel/qcoreapplication.cpp
src/corelib/kernel/qeventdispatcher_blackberry.cpp
src/network/bearer/qnetworkconfiguration.cpp
src/plugins/bearer/blackberry/qbbengine.cpp
src/plugins/platforms/android/androidjnimain.cpp
src/plugins/platforms/android/qandroidplatformtheme.cpp
src/plugins/platforms/qnx/qqnxbpseventfilter.cpp
src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp
src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
src/plugins/platforms/qnx/qqnxintegration.cpp
src/plugins/platforms/qnx/qqnxnavigatorbps.cpp
src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp
src/plugins/platforms/qnx/qqnxwindow.cpp
src/widgets/kernel/qwidgetwindow.cpp
src/widgets/styles/qwindowsvistastyle.cpp
src/widgets/styles/qwindowsxpstyle.cpp
src/widgets/widgets/qtoolbararealayout.cpp
tests/auto/corelib/global/qflags/qflags.pro
tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp
tests/auto/corelib/tools/qversionnumber/qversionnumber.pro
tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
Change-Id: I37be88c6c185bb85404823353e027a0a6acdbce4
Diffstat (limited to 'bin/syncqt.pl')
-rwxr-xr-x | bin/syncqt.pl | 184 |
1 files changed, 79 insertions, 105 deletions
diff --git a/bin/syncqt.pl b/bin/syncqt.pl index 83e8350f81..72b678041f 100755 --- a/bin/syncqt.pl +++ b/bin/syncqt.pl @@ -81,6 +81,8 @@ our @qpa_headers = (); # will be derived from sync.profile our %reverse_classnames = (); +my %ignore_for_include_check = (); +my %ignore_for_qt_begin_namespace_check = (); # global variables (modified by options) my $isunix = 0; @@ -319,6 +321,75 @@ sub classNames { return @ret; } +sub check_header { + my ($lib, $header, $iheader, $public_header, $private_header) = @_; + my $header_skip_qt_begin_namespace_test = 0; + + if ($public_header) { + return if ($ignore_for_include_check{$header}); + $header_skip_qt_begin_namespace_test = 1 if ($ignore_for_qt_begin_namespace_check{$header}); + } + + open(F, "<$iheader") or return; + my $qt_begin_namespace_found = 0; + my $qt_end_namespace_found = 0; + my $qt_namespace_suffix = ""; + my $line; + my $stop_processing = 0; + my $we_mean_it = 0; + while ($line = <F>) { + chomp $line; + my $output_line = 1; + if ($line =~ /^ *\# *pragma (qt_no_included_check|qt_sync_stop_processing)/) { + $stop_processing = 1; + last; + } + if ($line =~ /^ *\# *include/) { + my $include = $line; + if ($line =~ /<.*>/) { + $include =~ s,.*<(.*)>.*,$1,; + } elsif ($line =~ /".*"/) { + $include =~ s,.*"(.*)".*,$1,; + } else { + $include = 0; + } + if ($include && $public_header) { + print STDERR "$lib: ERROR: $iheader includes private header $include\n" if ($include =~ /_p.h$/); + for my $trylib (keys(%modules)) { + if (-e "$out_basedir/include/$trylib/$include") { + print "$lib: WARNING: $iheader includes $include when it should include $trylib/$include\n"; + } + } + } + } elsif (!$private_header) { + if ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_BEGIN_NAMESPACE(_[A-Z_]+)?\s*$/) { + $qt_namespace_suffix = defined($1) ? $1 : ""; + $qt_begin_namespace_found = 1; + } elsif ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_END_NAMESPACE$qt_namespace_suffix\s*$/) { + $qt_end_namespace_found = 1; + } + } elsif ($line =~ "^// We mean it.") { + ++$we_mean_it; + } + } + + if ($public_header) { + if ($header_skip_qt_begin_namespace_test == 0 and $stop_processing == 0) { + if ($qt_begin_namespace_found == 0) { + print "$lib: WARNING: $iheader does not include QT_BEGIN_NAMESPACE\n"; + } + + if ($qt_begin_namespace_found && $qt_end_namespace_found == 0) { + print "$lib: WARNING: $iheader has QT_BEGIN_NAMESPACE$qt_namespace_suffix but no QT_END_NAMESPACE$qt_namespace_suffix\n"; + } + } + } elsif ($private_header) { + print "$lib: WARNING: $iheader does not have the \"We mean it.\" warning\n" if (!$we_mean_it); + } + + close(F); +} + sub make_path { my ($dir, $lib, $be_verbose) = @_; unless(-e $dir) { @@ -801,6 +872,8 @@ loadSyncProfile(\$basedir, \$out_basedir); @modules_to_sync = keys(%modules) if($#modules_to_sync == -1); my %allmoduleheadersprivate = map { $_ => 1 } @allmoduleheadersprivate; +%ignore_for_include_check = map { $_ => 1 } @ignore_for_include_check; +%ignore_for_qt_begin_namespace_check = map { $_ => 1 } @ignore_for_qt_begin_namespace_check; $isunix = checkUnix; #cache checkUnix @@ -931,6 +1004,12 @@ 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) { + # We need both $public_header and $private_header because QPA headers count as neither + my $private_header = !$public_header && !$qpa_header + && $header =~ /_p\.h$/ && $subdir !~ /3rdparty/; + check_header($lib, $header, $iheader, $public_header, $private_header); + } my @classes = $public_header && (!$minimal && $is_qt) ? classNames($iheader, \$clean_header) : (); if($showonly) { print "$header [$lib]\n"; @@ -1128,109 +1207,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) { - my $header_skip_qt_begin_namespace_test = 0; - $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 $_); - } - if($public_header) { - foreach (@ignore_for_include_check) { - $public_header = 0 if($header eq $_); - } - foreach(@ignore_for_qt_begin_namespace_check) { - $header_skip_qt_begin_namespace_test = 1 if ($header eq $_); - } - } - } - - my $iheader = $subdir . "/" . $header; - if (open(F, "<$iheader")) { - my $qt_begin_namespace_found = 0; - my $qt_end_namespace_found = 0; - my $qt_namespace_suffix = ""; - my $line; - my $stop_processing = 0; - my $we_mean_it = 0; - while ($line = <F>) { - chomp $line; - my $output_line = 1; - if ($line =~ /^ *\# *pragma (qt_no_included_check|qt_sync_stop_processing)/) { - $stop_processing = 1; - last; - } elsif ($line =~ /^ *\# *include/) { - my $include = $line; - if ($line =~ /<.*>/) { - $include =~ s,.*<(.*)>.*,$1,; - } elsif ($line =~ /".*"/) { - $include =~ s,.*"(.*)".*,$1,; - } else { - $include = 0; - } - if ($include) { - if ($public_header) { - print STDERR "$lib: ERROR: $iheader includes private header $include\n" if ($include =~ /_p.h$/); - for my $trylib (keys(%modules)) { - if(-e "$out_basedir/include/$trylib/$include") { - print "$lib: WARNING: $iheader includes $include when it should include $trylib/$include\n"; - } - } - } - } - } elsif (!$private_header) { - if ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_BEGIN_NAMESPACE(_[A-Z_]+)?\s*$/) { - $qt_namespace_suffix = defined($1) ? $1 : ""; - $qt_begin_namespace_found = 1; - } elsif ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_END_NAMESPACE$qt_namespace_suffix\s*$/) { - $qt_end_namespace_found = 1; - } - } elsif ($line =~ "^// We mean it.") { - ++$we_mean_it; - } - } - - if ($public_header) { - if ($header_skip_qt_begin_namespace_test == 0 and $stop_processing == 0) { - if ($qt_begin_namespace_found == 0) { - print "$lib: WARNING: $iheader does not include QT_BEGIN_NAMESPACE\n"; - } - - if ($qt_begin_namespace_found && $qt_end_namespace_found == 0) { - print "$lib: WARNING: $iheader has QT_BEGIN_NAMESPACE$qt_namespace_suffix but no QT_END_NAMESPACE$qt_namespace_suffix\n"; - } - } - } elsif ($private_header) { - print "$lib: WARNING: $iheader does not have the \"We mean it.\" warning\n" if (!$we_mean_it); - } - - close(F); - } - } - } - } - } -} - exit 0; |