summaryrefslogtreecommitdiffstats
path: root/bin/syncqt.pl
diff options
context:
space:
mode:
Diffstat (limited to 'bin/syncqt.pl')
-rwxr-xr-xbin/syncqt.pl73
1 files changed, 40 insertions, 33 deletions
diff --git a/bin/syncqt.pl b/bin/syncqt.pl
index 3b3e127e86..ff539f5fe0 100755
--- a/bin/syncqt.pl
+++ b/bin/syncqt.pl
@@ -786,6 +786,7 @@ while ( @ARGV ) {
# if we have no $basedir we cannot be sure which sources you want, so die
die "Could not find any sync.profile for your module!\nPass <module directory> to syncqt to sync your header files.\nsyncqt failed" if (!$basedir);
+die "The -version argument is mandatory" if (!$module_version);
our @ignore_headers = ();
our @ignore_for_master_contents = ();
@@ -803,13 +804,6 @@ my %allmoduleheadersprivate = map { $_ => 1 } @allmoduleheadersprivate;
$isunix = checkUnix; #cache checkUnix
-if (!$module_version) {
- my $filco = fileContents($basedir."/src/corelib/global/qglobal.h");
- if ($filco !~ m,.*^#[ \t]*define[ \t]+QT_VERSION_STR[ \t]+"([^"]+)".*,sm) {
- die "Cannot determine Qt/Module version. Use -version.\n";
- }
- $module_version = $1;
-}
foreach my $lib (@modules_to_sync) {
die "No such module: $lib" unless(defined $modules{$lib});
@@ -1149,9 +1143,12 @@ if($check_includes) {
$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 {
@@ -1169,43 +1166,51 @@ if($check_includes) {
}
my $iheader = $subdir . "/" . $header;
- if($public_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;
- 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 (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 ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_BEGIN_NAMESPACE(_[A-Z_]+)?\s*$/) {
+ }
+ } 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";
@@ -1215,9 +1220,11 @@ if($check_includes) {
print "$lib: WARNING: $iheader has QT_BEGIN_NAMESPACE$qt_namespace_suffix but no QT_END_NAMESPACE$qt_namespace_suffix\n";
}
}
-
- close(F);
+ } elsif ($private_header) {
+ print "$lib: WARNING: $iheader does not have the \"We mean it.\" warning\n" if (!$we_mean_it);
}
+
+ close(F);
}
}
}