62 my %unique_message_counts; |
65 my %unique_message_counts; |
63 my %all_message_counts; |
66 my %all_message_counts; |
64 my $next_message_id = 1; |
67 my $next_message_id = 1; |
65 my %packages_by_file; |
68 my %packages_by_file; |
66 my %package_count_by_file; |
69 my %package_count_by_file; |
67 |
70 my %missing_ELF_symbol; |
|
71 my %missing_export; |
|
72 my %excess_export; |
|
73 |
|
74 sub handle_message($$$$$) |
|
75 { |
|
76 my ($package,$filename,$lineno,$messagetype,$message) = @_; |
|
77 |
|
78 my $generic_message = "$messagetype: $message"; |
|
79 $generic_message =~ s/'offsetof'/"offsetof"/; |
|
80 $generic_message =~ s/'([^a-zA-Z])'/"\1"/g; # don't catch ';' in next substitution |
|
81 $generic_message =~ s/['`][^']+'/XX/g; # suppress quoted bits of the actual instance |
|
82 $generic_message =~ s/pasting ""(.*)"" and ""(.*)""/pasting XX and YY/g; # suppress detail of "pasting" error |
|
83 |
|
84 my $message_id = $next_message_id; |
|
85 if (!defined $message_ids{$generic_message}) |
|
86 { |
|
87 $next_message_id++; |
|
88 $message_ids{$generic_message} = $message_id; |
|
89 $messages_by_id{$message_id} = $generic_message; |
|
90 $all_message_counts{$message_id} = 1; |
|
91 } |
|
92 else |
|
93 { |
|
94 $message_id = $message_ids{$generic_message}; |
|
95 $all_message_counts{$message_id} += 1; |
|
96 } |
|
97 my $instance = sprintf("%s:%d: %s-#%d", $filename, $lineno, $messagetype, $message_id); |
|
98 |
|
99 my $packages = $packages_by_file{$filename}; |
|
100 if (!defined $packages) |
|
101 { |
|
102 $packages_by_file{$filename} = "\t$package\t"; |
|
103 $package_count_by_file{$filename} = 1; |
|
104 } |
|
105 else |
|
106 { |
|
107 if (index($packages,"\t$package\t") < 0) |
|
108 { |
|
109 $packages_by_file{$filename} .= "\t$package\t"; |
|
110 $package_count_by_file{$filename} += 1; |
|
111 } |
|
112 } |
|
113 |
|
114 if (defined $files{$instance}) |
|
115 { |
|
116 # already seen this one |
|
117 return; |
|
118 } |
|
119 |
|
120 if (!defined $unique_message_counts{$message_id}) |
|
121 { |
|
122 $unique_message_counts{$message_id} = 1; |
|
123 } |
|
124 else |
|
125 { |
|
126 $unique_message_counts{$message_id} += 1; |
|
127 } |
|
128 $files{$instance} = $message; |
|
129 |
|
130 if (!defined $files_by_message_id{$message_id}) |
|
131 { |
|
132 $files_by_message_id{$message_id} = $filename; |
|
133 } |
|
134 else |
|
135 { |
|
136 $files_by_message_id{$message_id} .= "\n$filename"; |
|
137 } |
|
138 |
|
139 my $error = sprintf "%-5d: %s: %s", $lineno, $messagetype, $message; |
|
140 if (!defined $errors_by_file{$filename}) |
|
141 { |
|
142 $errors_by_file{$filename} = $error; |
|
143 $error_count_by_file{$filename} = 1; |
|
144 } |
|
145 else |
|
146 { |
|
147 $errors_by_file{$filename} .= "\n$error"; |
|
148 $error_count_by_file{$filename} += 1; |
|
149 } |
|
150 } |
68 |
151 |
69 my $line; |
152 my $line; |
70 while ($line = <>) |
153 while ($line = <>) |
71 { |
154 { |
72 # </pre>os/usb, usb_CompilerCompatibility.005, SF_builds/usb/builds/CompilerCompatibility/usb_CompilerCompatibility.005/html/os_usb_failures.html |
155 # </pre>os/usb, usb_CompilerCompatibility.005, SF_builds/usb/builds/CompilerCompatibility/usb_CompilerCompatibility.005/html/os_usb_failures.html |
75 { |
158 { |
76 $current_package = $1; |
159 $current_package = $1; |
77 $current_package =~ s/_/\//; |
160 $current_package =~ s/_/\//; |
78 next; |
161 next; |
79 } |
162 } |
|
163 |
|
164 # <recipe ... bldinf='M:/sf/os/bt/atext/group/bld.inf' ... |
|
165 |
|
166 if ($line =~ /^<recipe/o) |
|
167 { |
|
168 if ($line =~ / bldinf='..(\S+)' mmp='..(\S+)'/) |
|
169 { |
|
170 my $bldinf = $1; |
|
171 $current_mmp = $2; |
|
172 my ($root, $sf, $layer, $package, @rest) = split /\//, $bldinf; |
|
173 $current_package = "$layer/$package"; |
|
174 } |
|
175 next; |
|
176 } |
|
177 |
|
178 # remember context from various commands |
|
179 if (substr($line,0,1) eq "+") |
|
180 { |
|
181 if ($line =~ /g\+\+\.exe .* -o (\S+)\.sym /oi) |
|
182 { |
|
183 $current_link_target = $1; |
|
184 next; |
|
185 } |
|
186 if ($line =~ /^elf2e32.exe .* --output=(\S+) /oi) |
|
187 { |
|
188 $current_link_target = $1; # admittedly an E32 image file, but never mind... |
|
189 next; |
|
190 } |
|
191 } |
|
192 |
|
193 # M:/sf/os/kernelhwsrv/kernel/eka/drivers/soundsc/soundldd.cpp:2927: undefined reference to `__aeabi_uidiv' |
80 |
194 |
81 # M:/epoc32/include/elements/nm_interfaces.h:255: warning: dereferencing type-punned pointer will break strict-aliasing rules |
195 # M:/epoc32/include/elements/nm_interfaces.h:255: warning: dereferencing type-punned pointer will break strict-aliasing rules |
82 # M:/epoc32/include/f32file.h:2169: warning: invalid access to non-static data member 'TVolFormatParam::iUId' of NULL object |
196 # M:/epoc32/include/f32file.h:2169: warning: invalid access to non-static data member 'TVolFormatParam::iUId' of NULL object |
83 # M:/epoc32/include/f32file.h:2169: warning: (perhaps the 'offsetof' macro was used incorrectly) |
197 # M:/epoc32/include/f32file.h:2169: warning: (perhaps the 'offsetof' macro was used incorrectly) |
84 # M:/epoc32/include/comms-infras/ss_nodemessages.h:301: error: wrong number of template arguments (3, should be 4) |
198 # M:/epoc32/include/comms-infras/ss_nodemessages.h:301: error: wrong number of template arguments (3, should be 4) |
85 # M:/epoc32/include/elements/nm_signatures.h:496: error: provided for 'template<class TSIGNATURE, int PAYLOADATTRIBOFFSET, class TATTRIBUTECREATIONPOLICY, int PAYLOADBUFFERMAXLEN> class Messages::TSignatureWithPolymorphicPayloadMetaType' |
199 # M:/epoc32/include/elements/nm_signatures.h:496: error: provided for 'template<class TSIGNATURE, int PAYLOADATTRIBOFFSET, class TATTRIBUTECREATIONPOLICY, int PAYLOADBUFFERMAXLEN> class Messages::TSignatureWithPolymorphicPayloadMetaType' |
86 # M:/epoc32/include/comms-infras/ss_nodemessages.h:301: error: invalid type in declaration before ';' token |
200 # M:/epoc32/include/comms-infras/ss_nodemessages.h:301: error: invalid type in declaration before ';' token |
87 |
201 |
88 if ($line =~ /(^...*):(\d+): ([^:]+): (.*)$/) |
202 if ($line =~ /(^...*):(\d+): (([^:]+): )?(.*)$/) |
89 { |
203 { |
90 my $filename = $1; |
204 my $filename = $1; |
91 my $lineno = $2; |
205 my $lineno = $2; |
92 my $messagetype = $3; |
206 my $messagetype = $4; |
93 my $message = $4; |
207 my $message = $5; |
94 |
208 |
95 # Heuristic for guessing the problem file for assembler issues |
|
96 # |
|
97 if ($filename =~ /\\TEMP\\/i) |
|
98 { |
|
99 $filename = $saved_filename; |
|
100 $lineno = 0; |
|
101 } |
|
102 else |
|
103 { |
|
104 $saved_filename = $filename; |
|
105 } |
|
106 |
|
107 if ($messagetype eq "note") |
|
108 { |
|
109 next; # ignore notes |
|
110 } |
|
111 if ($messagetype eq "warning" && !$warnings) |
|
112 { |
|
113 next; # ignore warnings |
|
114 } |
|
115 if ($message =~ /.*: No such file/ && !$warnings) |
|
116 { |
|
117 next; # ignore "no such file", as these aren't likely to be GCC-specific |
|
118 } |
|
119 |
|
120 $filename =~ s/^.://; # remove drive letter |
209 $filename =~ s/^.://; # remove drive letter |
121 |
210 |
122 $message =~ s/&/&/g; |
211 $message =~ s/&/&/g; |
123 $message =~ s/>/>/g; |
212 $message =~ s/>/>/g; |
124 $message =~ s/</</g; |
213 $message =~ s/</</g; |
125 $message =~ s/'/'/g; |
214 $message =~ s/'/'/g; |
126 my $generic_message = "$messagetype: $message"; |
215 |
127 $generic_message =~ s/'offsetof'/"offsetof"/; |
216 if ($messagetype eq "") |
128 $generic_message =~ s/'([^a-zA-Z])'/"\1"/g; # don't catch ';' in next substitution |
217 { |
129 $generic_message =~ s/['`][^']+'/XX/g; # suppress quoted bits of the actual instance |
218 if ($message =~ /^undefined reference to .([^\']+).$/) |
130 $generic_message =~ s/pasting ""(.*)"" and ""(.*)""/pasting XX and YY/g; # suppress detail of "pasting" error |
219 { |
|
220 my $symbol = $1; |
|
221 $missing_ELF_symbol{"$current_package\t$filename $lineno\t$symbol\timpacts $current_link_target"} = 1; |
|
222 $messagetype = "error"; # linker error, fall through to the rest of the processing |
|
223 } |
|
224 else |
|
225 { |
|
226 next; |
|
227 } |
|
228 } |
|
229 # Heuristic for guessing the problem file for assembler issues |
|
230 # |
|
231 if ($filename =~ /\\TEMP\\/i) |
|
232 { |
|
233 $filename = $saved_filename; |
|
234 $lineno = 0; |
|
235 } |
|
236 else |
|
237 { |
|
238 $saved_filename = $filename; |
|
239 } |
131 |
240 |
132 my $message_id = $next_message_id; |
241 if ($messagetype eq "note") |
133 if (!defined $message_ids{$generic_message}) |
242 { |
134 { |
243 next; # ignore notes |
135 $next_message_id++; |
244 } |
136 $message_ids{$generic_message} = $message_id; |
245 if ($messagetype eq "warning" && !$warnings) |
137 $messages_by_id{$message_id} = $generic_message; |
246 { |
138 $all_message_counts{$message_id} = 1; |
247 next; # ignore warnings |
139 } |
248 } |
140 else |
249 if ($messagetype eq "Warning" && $message =~ /No relevant classes found./) |
141 { |
250 { |
142 $message_id = $message_ids{$generic_message}; |
251 next; # ignore Qt code generation warnings |
143 $all_message_counts{$message_id} += 1; |
252 } |
144 } |
253 if ($message =~ /.*: No such file/ && !$warnings) |
145 my $instance = sprintf("%s:%d: %s-#%d", $filename, $lineno, $messagetype, $message_id); |
254 { |
146 |
255 # next; # ignore "no such file", as these aren't likely to be GCC-specific |
147 my $packages = $packages_by_file{$filename}; |
256 } |
148 if (!defined $packages) |
257 |
149 { |
258 handle_message($current_package,$filename,$lineno,$messagetype,$message); |
150 $packages_by_file{$filename} = "\t$current_package\t"; |
259 next; |
151 $package_count_by_file{$filename} = 1; |
260 } |
152 } |
261 |
153 else |
262 # Error: unrecognized option -mapcs |
154 { |
263 |
155 if (index($packages,"\t$current_package\t") < 0) |
264 if ($line =~ /^Error: (.*)$/) |
|
265 { |
|
266 my $message = $1; |
|
267 handle_message($current_package,$current_mmp,0,"Error",$message); |
|
268 next; |
|
269 } |
|
270 |
|
271 # Elf2e32: Warning: New Symbol _ZN15DMMCMediaChangeC1Ei found, export(s) not yet Frozen |
|
272 # elf2e32 : Error: E1036: Symbol _ZN21CSCPParamDBControllerD0Ev,_ZN21CSCPParamDBControllerD1Ev,_ZN21CSCPParamDBControllerD2Ev Missing from ELF File : M:/epoc32/release/armv5/udeb/scpdatabase.dll.sym. |
|
273 |
|
274 if ($line =~ /^elf2e32 ?: ([^:]+): (.*)$/oi) |
|
275 { |
|
276 my $messagetype = $1; |
|
277 my $message = $2; |
|
278 |
|
279 $message =~ s/&/&/g; |
|
280 $message =~ s/>/>/g; |
|
281 $message =~ s/</</g; |
|
282 |
|
283 if ($message =~ /E1036: Symbol (\S+) Missing from ELF File : (.*)\.sym/i) |
|
284 { |
|
285 my $symbol_list = $1; |
|
286 my $linktarget = $2; |
|
287 |
|
288 foreach my $symbol (split /,/, $symbol_list) |
156 { |
289 { |
157 $packages_by_file{$filename} .= "\t$current_package\t"; |
290 $missing_export{"$current_package\t???\t$symbol\timpacts $linktarget"} = 1; |
158 $package_count_by_file{$filename} += 1; |
291 } |
159 } |
292 next; |
160 } |
293 } |
161 |
294 |
162 if (defined $files{$instance}) |
295 if ($message =~ /New Symbol (\S+) found, export.s. not yet Frozen/oi) |
163 { |
296 { |
164 # already seen this one |
297 my $symbol = $1; |
165 next; |
298 $excess_export{"$current_package\t???\t$symbol\textra in $current_link_target"} = 1; |
166 } |
299 next; |
167 |
300 } |
168 if (!defined $unique_message_counts{$message_id}) |
|
169 { |
|
170 $unique_message_counts{$message_id} = 1; |
|
171 } |
|
172 else |
|
173 { |
|
174 $unique_message_counts{$message_id} += 1; |
|
175 } |
|
176 $files{$instance} = $message; |
|
177 |
|
178 if (!defined $files_by_message_id{$message_id}) |
|
179 { |
|
180 $files_by_message_id{$message_id} = $filename; |
|
181 } |
|
182 else |
|
183 { |
|
184 $files_by_message_id{$message_id} .= "\n$filename"; |
|
185 } |
|
186 |
|
187 my $error = sprintf "%-5d: %s: %s", $lineno, $messagetype, $message; |
|
188 if (!defined $errors_by_file{$filename}) |
|
189 { |
|
190 $errors_by_file{$filename} = $error; |
|
191 $error_count_by_file{$filename} = 1; |
|
192 } |
|
193 else |
|
194 { |
|
195 $errors_by_file{$filename} .= "\n$error"; |
|
196 $error_count_by_file{$filename} += 1; |
|
197 } |
|
198 |
|
199 next; |
|
200 } |
301 } |
201 } |
302 } |
202 |
303 |
203 # clean up the file lists |
304 # clean up the file lists |
204 my %filecount_by_message_id; |
305 my %filecount_by_message_id; |
258 if ($current_package ne "") |
361 if ($current_package ne "") |
259 { |
362 { |
260 printf "%-6d\t%s\n", scalar @currentfiles, $current_package; |
363 printf "%-6d\t%s\n", scalar @currentfiles, $current_package; |
261 print join("\n",@currentfiles); |
364 print join("\n",@currentfiles); |
262 print "\n"; |
365 print "\n"; |
|
366 my $bugreport = sprintf "\"%s\",%d,\"GCC compilation issues in %s\",\"GCC_SURGE\"", $current_package, scalar @currentfiles, $current_packagename; |
|
367 $bugreport .= ",\"" . join("<br>", "Issues identified in the following source files:", @currentfiles) . "\""; |
|
368 push @bugzilla_stuff, $bugreport; |
263 } |
369 } |
264 $current_package = $package; |
370 $current_package = $package; |
|
371 $current_packagename = $packagename; |
265 @currentfiles = (); |
372 @currentfiles = (); |
266 } |
373 } |
267 my $filedetails = sprintf "\t%-6d\t%s", $error_count_by_file{$file}, $file; |
374 my $filedetails = sprintf "\t%-6d\t%s", $error_count_by_file{$file}, $file; |
268 push @currentfiles, $filedetails; |
375 push @currentfiles, $filedetails; |
269 } |
376 } |
270 printf "%-6d\t%s\n", scalar @currentfiles, $current_package; |
377 printf "%-6d\t%s\n", scalar @currentfiles, $current_package; |
271 print join("\n",@currentfiles); |
378 print join("\n",@currentfiles); |
272 print "\n"; |
379 print "\n"; |
|
380 my $bugreport = sprintf "\"%s\",%d,\"GCC compilation issues in %s\",\"GCC_SURGE\"", $current_package, scalar @currentfiles, $current_packagename; |
|
381 $bugreport .= ',"' . join("<br>", "Issues identified in the following source files:", @currentfiles) . '"'; |
|
382 push @bugzilla_stuff, $bugreport; |
|
383 |
273 |
384 |
274 print "\n\n====Messages by file\n"; |
385 print "\n\n====Messages by file\n"; |
275 foreach my $file ( sort keys %error_count_by_file) |
386 foreach my $file ( sort keys %error_count_by_file) |
276 { |
387 { |
277 my @details = split "\n", $errors_by_file{$file}; |
388 my @details = split "\n", $errors_by_file{$file}; |
278 printf "%-6d\t%s\n\t", $error_count_by_file{$file}, $file; |
389 printf "%-6d\t%s\n\t", $error_count_by_file{$file}, $file; |
279 print join("\n\t", @details); |
390 print join("\n\t", @details); |
280 print "\n"; |
391 print "\n"; |
281 } |
392 } |
282 |
393 |
|
394 my %visibility_summary; |
|
395 print "\n\n====Visibility problems - all\n"; |
|
396 foreach my $problem ( sort (keys %missing_ELF_symbol, keys %missing_export, keys %excess_export)) |
|
397 { |
|
398 print "$problem\n"; |
|
399 my ($package,$file,$symbol,$impact) = split /\t/, $problem; |
|
400 my $key = "$symbol\t$package"; |
|
401 if (!defined $visibility_summary{$key}) |
|
402 { |
|
403 $visibility_summary{$key} = 0; |
|
404 } |
|
405 $visibility_summary{$key} += 1; |
|
406 } |
|
407 |
|
408 print "\n\n====Symbol visibility problems (>1 instance)\n"; |
|
409 my $current_symbol = ""; |
|
410 my $references = 0; |
|
411 my @packagelist = (); |
|
412 foreach my $problem ( sort keys %visibility_summary) |
|
413 { |
|
414 my ($symbol, $package) = split /\t/, $problem; |
|
415 if ($symbol ne $current_symbol) |
|
416 { |
|
417 if ($current_symbol ne "" && $references > 1) |
|
418 { |
|
419 printf "%-6d\t%s\n", $references, $current_symbol; |
|
420 printf "\t%-6d\t%s\n", scalar @packagelist, join(", ", @packagelist); |
|
421 } |
|
422 $current_symbol = $symbol; |
|
423 $references = 0; |
|
424 @packagelist = (); |
|
425 } |
|
426 $references += $visibility_summary{$problem}; |
|
427 push @packagelist, $package; |
|
428 } |
|
429 if ($references > 1) |
|
430 { |
|
431 printf "%-6d\t%s\n", $references, $current_symbol; |
|
432 printf "\t%-6d\t%s\n", scalar @packagelist, join(", ", @packagelist); |
|
433 } |
|
434 |
|
435 print "\n\n====Missing symbols causing ELF link failures\n"; |
|
436 foreach my $problem ( sort keys %missing_ELF_symbol) |
|
437 { |
|
438 print "$problem\n"; |
|
439 } |
|
440 |
|
441 |
|
442 my @simple_exports = (); |
|
443 my @vague_exports = (); |
|
444 foreach my $problem (keys %missing_export) |
|
445 { |
|
446 my ($package,$file,$symbol,$impact) = split /\t/, $problem; |
|
447 if ($symbol =~ /^(_ZN\d|[^_]|__)/) |
|
448 { |
|
449 push @simple_exports, $problem; |
|
450 } |
|
451 else |
|
452 { |
|
453 push @vague_exports, $problem; |
|
454 } |
|
455 } |
|
456 printf "\n\n====Simple exports missing from linked ELF executables - (%d)\n", scalar @simple_exports; |
|
457 print join("\n", sort @simple_exports, ""); |
|
458 printf "\n\n====Vague linkage exports missing from linked ELF executables - (%d)\n", scalar @vague_exports; |
|
459 print join("\n", sort @vague_exports, ""); |
|
460 |
|
461 @simple_exports = (); |
|
462 @vague_exports = (); |
|
463 foreach my $problem (keys %excess_export) |
|
464 { |
|
465 my ($package,$file,$symbol,$impact) = split /\t/, $problem; |
|
466 if ($symbol =~ /^(_ZN\d|_Z\d|[^_]|__)/) |
|
467 { |
|
468 push @simple_exports, $problem; |
|
469 } |
|
470 else |
|
471 { |
|
472 push @vague_exports, $problem; |
|
473 } |
|
474 } |
|
475 |
|
476 printf "\n\n====Simple unfrozen exports found in linked ELF executables - (%d)\n", scalar @simple_exports; |
|
477 print join("\n", sort @simple_exports, ""); |
|
478 printf "\n\n====Vague linkage unfrozen exports found in linked ELF executables - (%d)\n", scalar @vague_exports; |
|
479 print join("\n", sort @vague_exports, ""); |
|
480 |
|
481 |
|
482 print "\n\n====Bugzilla CSV input\n"; |
|
483 print "\"product\",\"count\",\"short_desc\",\"keywords\",\"long_desc\"\n"; |
|
484 print join("\n", @bugzilla_stuff, ""); |
|
485 |