| 
									
										
										
										
											2014-01-20 12:43:38 +01:00
										 |  |  | #!/usr/bin/perl -w | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-15 14:52:30 +01:00
										 |  |  | # Copyright (C) 2016 The Qt Company Ltd. | 
					
						
							| 
									
										
										
										
											2022-08-19 15:59:36 +02:00
										 |  |  | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0 | 
					
						
							| 
									
										
										
										
											2016-01-15 14:52:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-20 12:43:38 +01:00
										 |  |  | =head1 NAME | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | msvc2tasks.pl - Convert GCC warnings into Qt Creator task files. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | =head1 SYNOPSIS | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     gcc2tasks.pl < logfile > taskfile | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | =cut | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | use strict; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | while (my $line = <STDIN> ) { | 
					
						
							|  |  |  |     chomp($line); | 
					
						
							|  |  |  |     # --- extract file name based matching: | 
					
						
							|  |  |  |     # file.cpp:214:37: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] | 
					
						
							| 
									
										
										
										
											2017-02-20 15:19:57 +01:00
										 |  |  |     if ($line =~ /^([^:]+):(\d+):\d*:? (warning|error): (.*)$/) { | 
					
						
							| 
									
										
										
										
											2014-01-20 12:43:38 +01:00
										 |  |  |         my $fileName = $1; | 
					
						
							|  |  |  |         my $lineNumber = $2; | 
					
						
							| 
									
										
										
										
											2017-02-20 15:19:57 +01:00
										 |  |  |         my $type = $3 eq 'warning' ? 'warn' : 'err'; | 
					
						
							|  |  |  |         my $text = $4; | 
					
						
							| 
									
										
										
										
											2014-01-20 12:43:38 +01:00
										 |  |  |         $fileName =~ s|\\|/|g; | 
					
						
							| 
									
										
										
										
											2017-02-20 15:19:57 +01:00
										 |  |  |         print $fileName, "\t", $lineNumber, "\t", $type, "\t", $text,"\n"; | 
					
						
							| 
									
										
										
										
											2014-01-20 12:43:38 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | } |