28 my $n; |
28 my $n; |
29 my $m; |
29 my $m; |
30 my $counter; |
30 my $counter; |
31 my $short_name; |
31 my $short_name; |
32 my $del_ok_issues = 1; # This variable determines whether to delete OK issues first. |
32 my $del_ok_issues = 1; # This variable determines whether to delete OK issues first. |
33 my $gen_missing_report = 1; # This variable determines whether to produce report for missing libraries. |
33 my $del_non_public = 1; # This variable determines whether to delete non-public API issues. |
|
34 my $gen_missing_report = 0; # This variable determines whether to produce report for missing libraries. |
34 my $issues_num; |
35 my $issues_num; |
35 my $issue_name; |
36 my $issue_name; |
36 my ($xref_name, $xref_type, $xref_line, $xref_hdr, $xref_def); |
37 my ($xref_name, $xref_type, $xref_line, $xref_hdr, $xref_def); |
37 my $delete_node; |
38 my $delete_node; |
38 my @non_public_list; |
39 my @non_public_list; |
39 my $current_item; |
40 my $current_item; |
40 my $check_against_xref; |
41 my $check_against_xref; |
41 my $temp_lib_num; |
42 my $temp_lib_num; |
42 my $temp_counter; |
43 my $temp_counter; |
43 my $sub_reports = 1; # This variable determines whether to generate sub-reports per package. |
44 my $sub_reports = 0; # This variable determines whether to generate sub-reports per package. |
44 my @lines_to_ignore = ("\\\\build\\\\", "\\\\compsupp\\\\", "\\\\uc_dll."); # This is the list of key words based on which a line potentially containing a package name will be ignored (skipped). |
45 my @lines_to_ignore = ("\\\\build\\\\", "\\\\compsupp\\\\", "\\\\uc_dll."); # This is the list of key words based on which a line potentially containing a package name will be ignored (skipped). |
45 my @pkgs; |
46 my @pkgs; |
46 my $baselinedlldir; |
47 my $baselinedlldir; |
47 my $lib_name; |
48 my $lib_name; |
48 my $map_name; |
49 my $map_name; |
123 $lib_num = @{$current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}}; |
124 $lib_num = @{$current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}}; |
124 print "Number of remaining libraries with issues: $lib_num \n"; |
125 print "Number of remaining libraries with issues: $lib_num \n"; |
125 } |
126 } |
126 |
127 |
127 # Delete non-public API issues. |
128 # Delete non-public API issues. |
128 $n = 0; |
129 if ($del_non_public) { |
129 $counter = 1; |
130 $n = 0; |
130 $temp_counter = 0; |
131 $counter = 1; |
131 $temp_lib_num = $lib_num; |
132 $temp_counter = 0; |
132 # Temporary variables - namespace fix. |
133 $temp_lib_num = $lib_num; |
133 my $count; |
134 # Temporary variables - namespace fix. |
134 my $temp_issue; |
135 my $count; |
135 while ($n < $lib_num) { |
136 my $temp_issue; |
136 print "Processing library: $current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'shortname'}->[0] ( $counter out of $temp_lib_num )\n"; |
137 while ($n < $lib_num) { |
137 $issues_num = @{$current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'issue'}}; |
138 print "Processing library: $current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'shortname'}->[0] ( $counter out of $temp_lib_num )\n"; |
138 $m = 0; |
139 $issues_num = @{$current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'issue'}}; |
139 while ($m < $issues_num) { |
140 $m = 0; |
140 $delete_node = 1; |
141 while ($m < $issues_num) { |
141 $issue_name = ""; |
142 $delete_node = 1; |
142 # Get issue name based on funcname or newfuncname (If both available get newfuncname). |
143 $issue_name = ""; |
143 if ($current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'issue'}->[$m]->{'newfuncname'}->[0]) { |
144 # Get issue name based on funcname or newfuncname (If both available get newfuncname). |
144 $issue_name = $current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'issue'}->[$m]->{'newfuncname'}->[0]; |
145 if ($current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'issue'}->[$m]->{'newfuncname'}->[0]) { |
145 # print "newfuncname - $issue_name \n"; |
146 $issue_name = $current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'issue'}->[$m]->{'newfuncname'}->[0]; |
146 } elsif ($current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'issue'}->[$m]->{'funcname'}->[0]) { |
147 # print "newfuncname - $issue_name \n"; |
147 $issue_name = $current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'issue'}->[$m]->{'funcname'}->[0]; |
148 } elsif ($current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'issue'}->[$m]->{'funcname'}->[0]) { |
148 # print "funcname - $issue_name \n"; |
149 $issue_name = $current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'issue'}->[$m]->{'funcname'}->[0]; |
149 } |
150 # print "funcname - $issue_name \n"; |
150 if ($issue_name) { |
151 } |
|
152 if ($issue_name) { |
151 # Leave only Class name - modified to fix namespace issue. |
153 # Leave only Class name - modified to fix namespace issue. |
152 # $issue_name =~ s/::.*//; |
154 # $issue_name =~ s/::.*//; |
153 # Find '(' and delete all characters following it. |
155 # Find '(' and delete all characters following it. |
154 $issue_name =~ s/\(.*//; |
156 $issue_name =~ s/\(.*//; |
155 # Count the number of '::'. |
157 # Count the number of '::'. |
163 # For vtable/typeinfo issues like: typeinfo for CommsFW::TCFDeregisterHookSignal get rid of the 1st part. |
165 # For vtable/typeinfo issues like: typeinfo for CommsFW::TCFDeregisterHookSignal get rid of the 1st part. |
164 $issue_name =~ s/^.* .*:://; |
166 $issue_name =~ s/^.* .*:://; |
165 # Leave only the 1st part (xx) for other issues. |
167 # Leave only the 1st part (xx) for other issues. |
166 $issue_name =~ s/::.*//; |
168 $issue_name =~ s/::.*//; |
167 } |
169 } |
168 # Find '<' and delete all characters following it, e.g. TMeta<CommsDat |
170 # Find '<' and delete all characters following it, e.g. TMeta<CommsDat |
169 $issue_name =~ s/<.*//; |
171 $issue_name =~ s/<.*//; |
170 # Delete for example: 'typeinfo for ', 'vtable for ', etc. - will only be done for the likes of vtable for CTransportSelfSender (without '::'). |
172 # Delete for example: 'typeinfo for ', 'vtable for ', etc. - will only be done for the likes of vtable for CTransportSelfSender (without '::'). |
171 $issue_name =~ s/^.* //; |
173 $issue_name =~ s/^.* //; |
172 # print $issue_name . "\n"; |
174 # print $issue_name . "\n"; |
173 # Check if Class/Macro already on the internal non-public API list. |
175 # Check if Class/Macro already on the internal non-public API list. |
174 $check_against_xref = 1; |
176 $check_against_xref = 1; |
175 foreach $current_item (@non_public_list) { |
177 foreach $current_item (@non_public_list) { |
176 if (lc($issue_name) eq lc($current_item)) { # Keep the node to be deleted and skip checking against the xref file. |
178 if (lc($issue_name) eq lc($current_item)) { # Keep the node to be deleted and skip checking against the xref file. |
177 $check_against_xref = 0; |
179 $check_against_xref = 0; |
178 last; |
|
179 } |
|
180 } |
|
181 if ($check_against_xref) { |
|
182 # Load xref file. |
|
183 open FILE, "<$xref_file" or print "Failed to read $xref_file: $!\n" and return; |
|
184 while ($line = <FILE>) |
|
185 { |
|
186 chomp $line; |
|
187 ($xref_name, $xref_type, $xref_line, $xref_hdr, $xref_def) = split /\s+/,$line; |
|
188 if (lc($issue_name) eq lc($xref_name)) { # Mark the node to NOT be deleted. |
|
189 # Insert reference to header file. |
|
190 $current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'issue'}->[$m]->{'refheaderfile'}->[0] = $xref_hdr; |
|
191 $delete_node = 0; |
|
192 print "Found issue: $issue_name in public header file: $xref_hdr\n"; |
|
193 last; |
180 last; |
194 } |
181 } |
195 } |
182 } |
196 # Close xref file. |
183 if ($check_against_xref) { |
197 close FILE; |
184 # Load xref file. |
198 } |
185 open FILE, "<$xref_file" or die("Failed to read $xref_file: $!\n"); |
199 } else { # No newfuncname/funcname available (e.g. typeinfo only for missing DLLs or typeid only for not shown ones). |
186 while ($line = <FILE>) |
200 # print "Unclassified issue in $current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'shortname'}->[0] \n"; |
187 { |
201 } |
188 chomp $line; |
202 if ($delete_node) { # Delete the issue (Not public API-related). |
189 ($xref_name, $xref_type, $xref_line, $xref_hdr, $xref_def) = split /\s+/,$line; |
203 splice(@{$current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'issue'}},$m, 1); |
190 if (lc($issue_name) eq lc($xref_name)) { # Mark the node to NOT be deleted. |
204 $issues_num--; |
191 # Insert reference to header file. |
205 if (($issue_name) && ($check_against_xref)) { # Looked for not found in the xref file - add the issue to the internal non-public API list. |
192 $current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'issue'}->[$m]->{'refheaderfile'}->[0] = $xref_hdr; |
206 push @non_public_list, $issue_name; |
193 $delete_node = 0; |
207 } |
194 print "Found issue: $issue_name in public header file: $xref_hdr\n"; |
208 $temp_counter++; # To count how many issues deleted. |
195 last; |
|
196 } |
|
197 } |
|
198 # Close xref file. |
|
199 close FILE; |
|
200 } |
|
201 } else { # No newfuncname/funcname available (e.g. typeinfo only for missing DLLs or typeid only for not shown ones). |
|
202 # print "Unclassified issue in $current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'shortname'}->[0] \n"; |
|
203 } |
|
204 if ($delete_node) { # Delete the issue (Not public API-related). |
|
205 splice(@{$current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}->[$n]->{'issue'}},$m, 1); |
|
206 $issues_num--; |
|
207 if (($issue_name) && ($check_against_xref)) { # Looked for not found in the xref file - add the issue to the internal non-public API list. |
|
208 push @non_public_list, $issue_name; |
|
209 } |
|
210 $temp_counter++; # To count how many issues deleted. |
|
211 } else { |
|
212 $m++; |
|
213 } |
|
214 } |
|
215 if ($issues_num == 0) { # If all issues deleted - remove the whole entry. |
|
216 splice(@{$current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}},$n, 1); |
|
217 $lib_num--; |
209 } else { |
218 } else { |
210 $m++; |
219 $n++; |
211 } |
220 } |
212 } |
221 $counter++; |
213 if ($issues_num == 0) { # If all issues deleted - remove the whole entry. |
222 } |
214 splice(@{$current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}},$n, 1); |
223 print "$temp_counter issue(s) has been deleted \n"; |
215 $lib_num--; |
224 # Get number of libraries again. |
216 } else { |
225 $lib_num = @{$current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}}; |
217 $n++; |
226 print "Final number of libraries with public API-related issues: $lib_num \n"; |
218 } |
227 } |
219 $counter++; |
|
220 } |
|
221 print "$temp_counter issue(s) has been deleted \n"; |
|
222 # Get number of libraries again. |
|
223 $lib_num = @{$current_report->{'bbcresults'}->{'issuelist'}->[0]->{'library'}}; |
|
224 print "Final number of libraries with public API-related issues: $lib_num \n"; |
|
225 |
228 |
226 # Write new XML to dest file. |
229 # Write new XML to dest file. |
227 open OUT,">$destfile" or die("Cannot open file \"$destfile\" for writing. $!\n"); |
230 open OUT,">$destfile" or die("Cannot open file \"$destfile\" for writing. $!\n"); |
228 print OUT XMLout($current_report, keeproot => 1); |
231 print OUT XMLout($current_report, keeproot => 1); |
229 close OUT; |
232 close OUT; |