Bug 145687 - Makeactionfilter fails to parse compiler build output
Summary: Makeactionfilter fails to parse compiler build output
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Output Views (show other bugs)
Version: 3.4.1
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Andreas Pakulat
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-20 00:01 UTC by Heiko Gerdau
Modified: 2007-06-03 22:28 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
above mentioned patch (1.59 KB, patch)
2007-05-20 00:05 UTC, Heiko Gerdau
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Heiko Gerdau 2007-05-20 00:01:14 UTC
Version:           3.4.1 (using KDE 3.5.5 "release 45" , openSUSE 10.2)
Compiler:          Target: i586-suse-linux
OS:                Linux (i686) release 2.6.18.2-34-default

Hi,

the makeactionfilters do not correctly parse the output from the build process for the following example:

"g++ -c  -o test.o -myoptions -I/mypath test.cpp"

If the makeactionfilters parse this line they create the following modified short version for the message view:
"compiling mypath (g++)"
but it should be
"compiling test.cpp (g++)"

Based on the kdevelop-3.4.1 release this could be easily fixed by adding "(?:-\S*\s*)*" to the RegExp in kdevelop-3.4.1/parts/outputviews/makeactionfilter.cpp line 76. Change
ActionFormat( i18n("compiling"), 1, 2, "(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*-o (?:\\S* )(?:[^/;]*/)*([^/\\s;]+)"),

into 

ActionFormat( i18n("compiling"), 1, 2, "(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*-o (?:\\S* )(?:-\\S*\\s*)*(?:[^/;]*/)*([^/\\s;]+)"),

This is a minimal change to resolve the problem but I would rather suggest the following RegExp to match all compile testcases with a single and easier RegExp.

(?:^|[^=])\b(gcc|CC|cc|distcc|c\+\+|g\+\+)\s+.*-c.*[/ '\\]+(\w+\.(?:cpp|c))

It's based on the file extensions and supports also MS Windows type path separators which might be an issue in the future.
There might be a reason why you don't use file extensions for the regexp in the first place. So sorry if I have overseen something.

Anyway here is the proposed patch:

--- makeactionfilter.ori.cpp	2007-05-19 21:12:26.000000000 +0200
+++ makeactionfilter.cpp	2007-05-19 21:20:00.000000000 +0200
@@ -72,9 +72,7 @@
 MakeActionFilter::ActionFormat* MakeActionFilter::actionFormats()
 {
 	static ActionFormat formats[] = {
-		ActionFormat( i18n("compiling"), 1, 2, "(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*`[^`]*`(?:[^/\\s;]*/)*([^/\\s;]+)"),
-		ActionFormat( i18n("compiling"), 1, 2, "(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*-o (?:\\S* )(?:[^/;]*/)*([^/\\s;]+)"),
-		ActionFormat( i18n("compiling"), 1, 2, "(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*(?:[^/]*/)*([^/\\s;]*)"),
+		ActionFormat( i18n("compiling"), 1, 2, "(?:^|[^=])\\b(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\s+.*-c.*[/ '\\\\]+(\\w+\\.(?:cpp|c))"),
 		ActionFormat( i18n("compiling"), 1, 1, "^compiling (.*)" ), //unsermake
 		ActionFormat( i18n("compiling"), 1, 1, "\\[.+%\\] Building .* object (.*)" ), //cmake
 
@@ -172,6 +170,10 @@
 		"g++ -c -pipe -Wall -W -O2 -DQT_NO_DEBUG -I/home/john/src/kde/qt-copy/mkspecs/default -I. "
 		"-I/home/john/src/kde/qt-copy/include -o test.o test.cpp",
 		"compiling", "g++", "test.cpp" )
+	<< TestItem( // simple qmake compile different option order
+		"g++ -c -o test.o -pipe -Wall -W -O2 -DQT_NO_DEBUG -I/home/john/src/kde/qt-copy/mkspecs/default -I. "
+		"-I/home/john/src/kde/qt-copy/include test.cpp",
+		"compiling", "g++", "test.cpp" )
 	<< TestItem( // simple qmake link
 		"g++ -o ../bin/test test.o -Wl,-rpath,/home/john/src/kde/qt-copy/lib -L/home/john/src/kde/qt-copy/lib "
 		"-L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm",
Comment 1 Heiko Gerdau 2007-05-20 00:05:52 UTC
Created attachment 20636 [details]
above mentioned patch

see above
Comment 2 Andreas Pakulat 2007-05-25 03:26:55 UTC
SVN commit 668073 by apaku:

Use file extension for finding source files that are compiled, patch from Heiko Gerdau, thanks.
BUG:145687

 M  +5 -3      makeactionfilter.cpp  


--- branches/KDE/3.5/kdevelop/parts/outputviews/makeactionfilter.cpp #668072:668073
@@ -72,9 +72,7 @@
 MakeActionFilter::ActionFormat* MakeActionFilter::actionFormats()
 {
 	static ActionFormat formats[] = {
-		ActionFormat( i18n("compiling"), 1, 2, "(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*`[^`]*`(?:[^/\\s;]*/)*([^/\\s;]+)"),
-		ActionFormat( i18n("compiling"), 1, 2, "(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*-o (?:\\S* )(?:[^/;]*/)*([^/\\s;]+)"),
-		ActionFormat( i18n("compiling"), 1, 2, "(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*(?:[^/]*/)*([^/\\s;]*)"),
+		ActionFormat( i18n("compiling"), 1, 2, "(?:^|[^=])\\b(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\s+.*-c.*[/'\\\\]+(\\w+\\.(?:cpp|CPP|c|C|cxx|CXX|cs|java|hpf|f|F|f90|F90|f95|F95))"),
 		ActionFormat( i18n("compiling"), 1, 1, "^compiling (.*)" ), //unsermake
 		ActionFormat( i18n("compiling"), 1, 1, "\\[.+%\\] Building .* object (.*)" ), //cmake
 
@@ -172,6 +170,10 @@
 		"g++ -c -pipe -Wall -W -O2 -DQT_NO_DEBUG -I/home/john/src/kde/qt-copy/mkspecs/default -I. "
 		"-I/home/john/src/kde/qt-copy/include -o test.o test.cpp",
 		"compiling", "g++", "test.cpp" )
+	<< TestItem( // simple qmake compile different option order
+		"g++ -c -o test.o -pipe -Wall -W -O2 -DQT_NO_DEBUG -I/home/john/src/kde/qt-copy/mkspecs/default -I. "
+		"-I/home/john/src/kde/qt-copy/include test.cpp",
+		"compiling", "g++", "test.cpp" )
 	<< TestItem( // simple qmake link
 		"g++ -o ../bin/test test.o -Wl,-rpath,/home/john/src/kde/qt-copy/lib -L/home/john/src/kde/qt-copy/lib "
 		"-L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm",
Comment 3 Andreas Pakulat 2007-06-02 20:56:07 UTC
SVN commit 670868 by apaku:

Revert my last commit, it breaks simple gcc lines (somehow the DEBUG define that my configure gets doesn't work).
CCBUG:145687


 M  +3 -5      makeactionfilter.cpp  


--- branches/KDE/3.5/kdevelop/parts/outputviews/makeactionfilter.cpp #670867:670868
@@ -72,7 +72,9 @@
 MakeActionFilter::ActionFormat* MakeActionFilter::actionFormats()
 {
 	static ActionFormat formats[] = {
-		ActionFormat( i18n("compiling"), 1, 2, "(?:^|[^=])\\b(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\s+.*-c.*[/'\\\\]+(\\w+\\.(?:cpp|CPP|c|C|cxx|CXX|cs|java|hpf|f|F|f90|F90|f95|F95))"),
+		ActionFormat( i18n("compiling"), 1, 2, "(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*`[^`]*`(?:[^/\\s;]*/)*([^/\\s;]+)"),
+		ActionFormat( i18n("compiling"), 1, 2, "(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*-o (?:\\S* )(?:[^/;]*/)*([^/\\s;]+)"),
+		ActionFormat( i18n("compiling"), 1, 2, "(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*(?:[^/]*/)*([^/\\s;]*)"),
 		ActionFormat( i18n("compiling"), 1, 1, "^compiling (.*)" ), //unsermake
 		ActionFormat( i18n("compiling"), 1, 1, "\\[.+%\\] Building .* object (.*)" ), //cmake
 
@@ -170,10 +172,6 @@
 		"g++ -c -pipe -Wall -W -O2 -DQT_NO_DEBUG -I/home/john/src/kde/qt-copy/mkspecs/default -I. "
 		"-I/home/john/src/kde/qt-copy/include -o test.o test.cpp",
 		"compiling", "g++", "test.cpp" )
-	<< TestItem( // simple qmake compile different option order
-		"g++ -c -o test.o -pipe -Wall -W -O2 -DQT_NO_DEBUG -I/home/john/src/kde/qt-copy/mkspecs/default -I. "
-		"-I/home/john/src/kde/qt-copy/include test.cpp",
-		"compiling", "g++", "test.cpp" )
 	<< TestItem( // simple qmake link
 		"g++ -o ../bin/test test.o -Wl,-rpath,/home/john/src/kde/qt-copy/lib -L/home/john/src/kde/qt-copy/lib "
 		"-L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm",
Comment 4 Andreas Pakulat 2007-06-02 20:58:39 UTC
Hi, I had to revert the commit as it causes various of the tests to fail. Heiko I don't fully understand the format of these expressions, would you please see if you can fix the first line starting with a "-" in my last commit message (i.e. the one that uses file extensions for the matching).
Comment 5 Heiko Gerdau 2007-06-03 10:53:16 UTC
Hi Andreas,
there are two differences compared to my original patch. You added other file extentions which should be ok, but you have also dropped a blanc in [/ '\\\\]. I have played with different KDevelop and KDE versions currently and thus have broken my compile setup for version 3.4.1. But the following regexp should be ok again. At least for the included test cases.      

 ActionFormat( i18n("compiling"), 1, 2, "(?:^|[^=])\\b(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\s+.*-c.*[/ '\\\\]+(\\w+\\.(?:cpp|CPP|c|C|cxx|CXX|cs|java|hpf|f|F|f90|F90|f95|F95))"),
Comment 6 Andreas Pakulat 2007-06-03 17:39:08 UTC
aaah, the problem is that you provided the patch inline, it would've been better to provide it as attachment. If you select the patch-lines you will see that the one whitespace is not in there.
Comment 7 Andreas Pakulat 2007-06-03 17:40:33 UTC
SVN commit 671038 by apaku:

Fix the patch, a whitespace got lost because the patch was provided inline.
BUG:145687


 M  +5 -3      makeactionfilter.cpp  


--- branches/KDE/3.5/kdevelop/parts/outputviews/makeactionfilter.cpp #671037:671038
@@ -72,9 +72,7 @@
 MakeActionFilter::ActionFormat* MakeActionFilter::actionFormats()
 {
 	static ActionFormat formats[] = {
-		ActionFormat( i18n("compiling"), 1, 2, "(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*`[^`]*`(?:[^/\\s;]*/)*([^/\\s;]+)"),
-		ActionFormat( i18n("compiling"), 1, 2, "(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*-o (?:\\S* )(?:[^/;]*/)*([^/\\s;]+)"),
-		ActionFormat( i18n("compiling"), 1, 2, "(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-c (?:\\S* )*(?:[^/]*/)*([^/\\s;]*)"),
+		ActionFormat( i18n("compiling"), 1, 2, "(?:^|[^=])\\b(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\s+.*-c.*[/ '\\\\]+(\\w+\\.(?:cpp|CPP|c|C|cxx|CXX|cs|java|hpf|f|F|f90|F90|f95|F95))"),
 		ActionFormat( i18n("compiling"), 1, 1, "^compiling (.*)" ), //unsermake
 		ActionFormat( i18n("compiling"), 1, 1, "\\[.+%\\] Building .* object (.*)" ), //cmake
 
@@ -172,6 +170,10 @@
 		"g++ -c -pipe -Wall -W -O2 -DQT_NO_DEBUG -I/home/john/src/kde/qt-copy/mkspecs/default -I. "
 		"-I/home/john/src/kde/qt-copy/include -o test.o test.cpp",
 		"compiling", "g++", "test.cpp" )
+	<< TestItem( // simple qmake compile different option order
+		"g++ -c -o test.o -pipe -Wall -W -O2 -DQT_NO_DEBUG -I/home/john/src/kde/qt-copy/mkspecs/default -I. "
+		"-I/home/john/src/kde/qt-copy/include test.cpp",
+		"compiling", "g++", "test.cpp" )
 	<< TestItem( // simple qmake link
 		"g++ -o ../bin/test test.o -Wl,-rpath,/home/john/src/kde/qt-copy/lib -L/home/john/src/kde/qt-copy/lib "
 		"-L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm",
Comment 8 Heiko Gerdau 2007-06-03 22:28:30 UTC
I provided the patch inline and as attachment. See Comment#1 directly after my original post.

And what do you mean by "if you select the patch-lines you will see that the one whitespace is not in there" ??
If I look above at my original post I see the whitespace and after select and copy the lines from the inline patch I have the whitespace still in there.

Anyway, whatever has caused the confusion, I'm glad that it's working now.
Thanks

Heiko