Issues parsing buildoutput

Peter M. Clausen petermichaelclausen at gmail.com
Tue Oct 16 00:27:07 UTC 2012


Hi Morten,

I will not be hacking much in KDE - I'm a fortran guy, not C++ :-)) So
before I add an account and all I would ask if you perhaps would to look at
the (fairly trivial) changes I made? And if they are OK push them into the
master branch. I'm new to git as well, so I dont really get it regarding
pushing changes...

I believe that the files attached are OK ('modified_files.tar.gz') - if you
want the diff it is in 'diff_origin_master.txt'. I've modified the tests as
well, and they run without errors.

One thing I dont understand is that it does NOT work for gfortran in
kdevelop! (see Screenshot_kdev.png). It does not highlight and I cant jump
in code. If you install gfortran it should be strainght forward to open the
Cmake-mini-test_f (in 'test_f.tar.gz') I've made.

It is only gfortran thats a problem - intel fortran works like a charm with
highlighting as well as jumping to the correct places in the code.

Thanks for your help!

Best regards

Peter




2012/10/15 Morten Volden <mvolden2 at gmail.com>

> Hi Peter
>
> As far as I know the re-factoring of the output filtering is not in the
> 4.4. branch, so when you say 4.4. branch I assume you mean master.
>
> The ErrorFormat class constructors looks like this:
>
> ErrorFormat( const QString& regExp, int file, int line, int text, int column=-1 );
>
> ErrorFormat( const QString& regExp, int file, int line, int text, const QString& comp, int column=-1 );
>
> The 'file', 'line', 'text', and 'column' integers indicate what group in
> the regExp that information is found (for example the file information is
> found in the second pair of parentheses in the regular expression in the
> ErrorFormat constructor below.)
>
> I am not near my workstation right now so I cannot say for certain, but
> something like the ErrorFormat constructor below should work (In master).
>
> ErrorFormat( "^fortcom: ([a-zA-Z]+): (.*), line ([0-9]+):(.*)", 2, 3, 1, "
> intel" )
>
> In the outputview/test directory there is a file called
> filteringstrategytest.cpp. I highly recommend that you implement a unittest
> for your case there.
>
> Once you have a working patch and test in place, you can use kdevelop to
> post that on git.reviewboard.kde.org
>
> Hope this helps
>
> /Morten
>
> 2012/10/15 Peter M. Clausen <petermichaelclausen at gmail.com>
>
>> sorry - I used the wrong list...
>>
>>
>> ---------- Forwarded message ----------
>> From: Peter M. Clausen <petermichaelclausen at gmail.com>
>> Date: 2012/10/15
>> Subject: Issues parsing buildoutput
>> To: kdevelop at kdevelop.org
>>
>>
>> Hi
>>
>> I'm working with kdevelop 4.3.1 (Ubuntu 12.04). I was trying to fix an
>> issue parsing intel fortran (ifort) build output. I am able to do so in
>> 4.3.1 branch, but not in 4.4. (latest) branch.
>>
>> Problem using Intel Fortran: "Info" output cannot be 'clicked' on and let
>> cursor jump to problematic place. "Error" is OK.
>>
>> I looked into the file
>> kdevelop-4.3.1/projectbuilders/makebuilder/outputfilters.cpp line 38:
>>    org:
>>     << ErrorFormat( "fortcom: (.*), line ([0-9]+):(.*)", 1, 2, 3, "intel"
>> )
>>
>>    new:
>>     << ErrorFormat( "[a-zA-Z]+: [a-zA-Z]+: (.*), line ([0-9]+):(.*)", 1,
>> 2, 3, "intel" )
>>
>> Thus it will match both following lines:
>> fortcom: Error: /scratch/var_r_en.f90, line 292: Syntax error, found ')'
>> when expecting one of: ( <IDENTIFIER> <CHAR_CON_KIND_PARAM>
>> <CHAR_NAM_KIND_PARAM> <CHARACTER_CONSTANT> <INTEGER_CONSTANT> ...
>>             if (record_exists==)
>> fortcom: Info: /scratch/var_r_en.f90, line 101: This variable has not
>> been used.   [D]
>>   real D
>>
>>
>> I tried to look at this in 4.4. branch (
>> http://anongit.kde.org/kdevplatform/kdevplatform-latest.tar.gz) and it
>> looks like it has been moved
>> to: ./kdevplatform/outputview/outputfilteringstrategies.cpp
>> But here I cant make it work. I've changed the line 88:
>>    org:
>>     << ErrorFormat( "^fortcom: (Error): (.*), line ([0-9]+):(.*)", 2, 3,
>> 1, "intel" )
>>    new:
>>     << ErrorFormat( "^[a-zA-Z]+: [a-zA-Z]+: (.*), line ([0-9]+):(.*)", 1,
>> 2, 3, "intel" )
>>
>> But it does not work as in 4.3.1. Doing the above change only matches the
>> first error, not any info or any other errors afterwards. Could someone
>> please help me here? I was also wondering why "2, 3, 1" should be the new
>> order of arguments, compare to 4.3.1 branch.
>>
>> I have never submitted anything to a KDE-project, so I would be thankfull
>> if someone could point me to a "how to".
>>
>> Best regards
>>
>> Peter
>>
>> PS. Keep up the good work on my favorite IDE.
>>
>>
>> --
>> KDevelop-devel mailing list
>> KDevelop-devel at kdevelop.org
>> https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel
>>
>>
>
>
> --
> - When the split is pulled, mr. Grenade is no longer our friend
>
> --
> KDevelop-devel mailing list
> KDevelop-devel at kdevelop.org
> https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20121016/2c06f644/attachment.html>
-------------- next part --------------
diff --git a/outputview/outputfilteringstrategies.cpp b/outputview/outputfilteringstrategies.cpp
index c407c93..beda16b 100644
--- a/outputview/outputfilteringstrategies.cpp
+++ b/outputview/outputfilteringstrategies.cpp
@@ -82,10 +82,12 @@ const QList<ErrorFormat> ERROR_FILTERS = QList<ErrorFormat>()
     << ErrorFormat( "No rule to make target", 0, 0, 0 )
     // Fortran
     << ErrorFormat( "\"(.*)\", line ([0-9]+):(.*)", 1, 2, 3 )
+    // GFortran
+    << ErrorFormat( "^(.*):([0-9]+)\\.([0-9]+):(.*)", 1, 2, 4, 3 )
     // Jade
     << ErrorFormat( "^[a-zA-Z]+:([^: \t]+):([0-9]+):[0-9]+:[a-zA-Z]:(.*)", 1, 2, 3 )
     // ifort
-    << ErrorFormat( "^fortcom: (Error): (.*), line ([0-9]+):(.*)", 2, 3, 1, "intel" )
+    << ErrorFormat( "^fortcom: (.*): (.*), line ([0-9]+):(.*)", 2, 3, 1, "intel" )
     // PGI
     << ErrorFormat( "PGF9(.*)-(.*)-(.*)-(.*) \\((.*): ([0-9]+)\\)", 5, 6, 4, "pgi" )
     // PGI (2)
@@ -248,7 +250,11 @@ FilteredItem CompilerFilterStrategy::errorInLine(const QString& line)
             if(txt.contains("note", Qt::CaseInsensitive)) {
                 item.type = FilteredItem::InformationItem;
             }
-
+            
+            if(txt.contains("info", Qt::CaseInsensitive)) {
+                item.type = FilteredItem::InformationItem;
+            }
+            
             // Make the item clickable if it comes with the necessary file & line number information
             if (curErrFilter.fileGroup > 0 && curErrFilter.lineGroup > 0) {
                 item.isActivatable = true;
diff --git a/outputview/tests/filteringstrategytest.cpp b/outputview/tests/filteringstrategytest.cpp
index 0c54d43..e21beda 100644
--- a/outputview/tests/filteringstrategytest.cpp
+++ b/outputview/tests/filteringstrategytest.cpp
@@ -262,15 +262,30 @@ void FilteringStrategyTest::testExtractionOfLineAndCulmn_data()
     QTest::newRow("gcc-no-col")
         << "/path/to/file.cpp:123: error ..."
         << "/path/to/file.cpp" << 122 << 0 << FilteredItem::ErrorItem;
-    QTest::newRow("fortcom")
-        << "fortcom: Error: Ogive8.f90, line 123: ..."
-        << "./Ogive8.f90" << 122 << 0 << FilteredItem::ErrorItem;
+    QTest::newRow("fortcomError")
+        << "fortcom: Error: ./Ogive8.f90, line 123: ..."
+        << "././Ogive8.f90" << 122 << 0 << FilteredItem::ErrorItem;
+    QTest::newRow("fortcomWarning")
+        << "fortcom: Warning: /path/Ogive8.f90, line 123: ..."
+        << "/path/Ogive8.f90" << 122 << 0 << FilteredItem::WarningItem;
+    QTest::newRow("fortcomInfo")
+        << "fortcom: Info: Ogive8.f90, line 123: ..."
+        << "./Ogive8.f90" << 122 << 0 << FilteredItem::InformationItem;
     QTest::newRow("libtool")
         << "libtool: link: warning: ..."
         << "" << -1 << 0  << FilteredItem::WarningItem;
-//     QTest::newRow("gfortran") This row does not currently hit on any of the errorFormats
-//         << "/path/to/file.f90:123.456:"
-//         << "/path/to/file.f90" << 122 << 455  << FilteredItem::ErrorItem;
+    QTest::newRow("gfortranError1") 
+        << "/path/to/file.f90:123.456:Error: ...."
+        << "/path/to/file.f90" << 122 << 455  << FilteredItem::ErrorItem;
+    QTest::newRow("gfortranError2")
+        << "/path/flib.f90:3567.22:"
+" "
+"  INTEGER(I4K) CHR_CNT"
+"                      1"
+"Error: Name 'chr_cnt' at (1) is an ambiguous reference to 'chr_cnt' from current program unit"
+        << "/path/flib.f90" << 3566 << 21 << FilteredItem::ErrorItem;
+                
+        
 }
 
 void FilteringStrategyTest::testExtractionOfLineAndCulmn()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_f.tar.gz
Type: application/x-gzip
Size: 472 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20121016/2c06f644/attachment.gz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: modified_files.tar.gz
Type: application/x-gzip
Size: 5482 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20121016/2c06f644/attachment-0001.gz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot_kdev.png
Type: image/png
Size: 91870 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20121016/2c06f644/attachment.png>


More information about the KDevelop-devel mailing list