bump product version to 5.0.4.1
[LibreOffice.git] / bin / find-unusedheaders.pl
blobdef1bd45abf974b8e4230bac405c0bfe08a46a97
1 #!/usr/bin/perl
2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 use strict;
10 use warnings;
11 use File::Find qw(finddepth);
12 use File::Basename;
14 # Find dirs in:
15 # workdir/Dep/CxxObject/
16 # workdir/Dep/CObject
18 # Concat these files and compare them with the output of
19 # `git ls-tree HEAD -r --name-only` and report files in the git ls-tree that aren't in the first.
21 my @files;
22 my $tmp;
23 my %data = ();
25 # define a wanted function
26 sub wanted {
27 return if($_ eq '.' || $_ eq '..' || -d $_);
28 $tmp = basename($File::Find::name);
29 # remove file extension ( .o )
30 $tmp =~ s/\.[^.]*$//;
31 $data{$tmp} = $File::Find::name;
34 finddepth(\&wanted, 'workdir/Dep/CxxObject');
35 finddepth(\&wanted, 'workdir/Dep/CObject');
37 my @gitfiles = `git ls-tree HEAD -r --name-only`;
39 # loop over found gitfiles
40 foreach my $file (@gitfiles){
41 if($file =~ /\.[hxx|h|c|cxx]$/){
42 $tmp = basename($file);
43 $tmp =~ s/\.[^.]*$//;
44 chomp($tmp);
45 if(!exists($data{$tmp})){
46 print $file;