diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2022-08-15 21:52:05 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2022-09-06 13:43:02 -0300 |
commit | 5d903a64aca37ee7c2836e479e175336e9b7ca87 (patch) | |
tree | 8a465d1e2274249edda124186d6c74303dd8f61d /mkspecs | |
parent | 734e0a2fbe18546780fb350af5e8b4ee2eb16d68 (diff) |
findclasslist.pl: match unexported classes too
Unexported structs do mark private API too. This change necessitated fixing
the negative-lookahead, because otherwise we'd match a line like:
class QVariant;
With $1 = "QVarian" and the "t" stood for the negative lookahead.
Pick-to: 6.4
Change-Id: Ic6547f8247454b47baa8fffd170bba2c68c29dbc
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'mkspecs')
-rw-r--r-- | mkspecs/features/data/unix/findclasslist.pl | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/mkspecs/features/data/unix/findclasslist.pl b/mkspecs/features/data/unix/findclasslist.pl index ca5f856156..3d224aeedf 100644 --- a/mkspecs/features/data/unix/findclasslist.pl +++ b/mkspecs/features/data/unix/findclasslist.pl @@ -6,6 +6,13 @@ use strict; my $syntax = "findclasslist.pl\n" . "Replaces each \@FILE:filename\@ in stdin with the classes found in that file\n"; +# Match a struct or class declaration at the top-level, but not a forward +# declaration +my $classmatch = qr/^(?:struct|class)(?:\s+Q_\w*_EXPORT)?\s+(\w+)(\s*;$)?/; + +# Match an exported namespace +my $nsmatch = qr/^namespace\s+Q_\w+_EXPORT\s+(\w+)/; + $\ = $/; while (<STDIN>) { chomp; @@ -24,9 +31,10 @@ while (<STDIN>) { next if $1 eq "ignore" or $1 eq "ignore-next"; } - # Match a struct or class declaration, but not a forward declaration - $line =~ /^(?:struct|class|namespace) (?:Q_.*_EXPORT)? (\w+)(?!;)/ or next; - print $comment if $comment; + $line =~ s,\s*(//.*)?$,,; # remove // comments and trailing space + next unless $line =~ $nsmatch or $line =~ $classmatch; + next if $2 ne ""; # forward declaration + printf " *%d%s*;\n", length $1, $1; $comment = 0; } |