Author Topic: Detecting "unrecognized command line option" errors with GCC  (Read 23406 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Is it possible to add a regexp for this kind of errors?
The problem is that the error is not shown in the Build messages tab, only in the Build log.
To reproduce enbled the option in gcc-4.6
Code
cc1plus: error: unrecognized command line option ‘-std=c++11’
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Detecting "unrecognized command line option" errors with GCC
« Reply #1 on: June 23, 2012, 04:28:12 am »
Does the following work?
Code
m_RegExes.Add(RegExStruct(_("Compiler error (unrecognized option)"), cltError, _T(".*cc.*:[ \t]([Uu]nrecognized.*option.*)"), 1));

Offline xunxun

  • Almost regular
  • **
  • Posts: 187
Re: Detecting "unrecognized command line option" errors with GCC
« Reply #2 on: June 23, 2012, 07:10:44 am »
Does the following work?
Code
m_RegExes.Add(RegExStruct(_("Compiler error (unrecognized option)"), cltError, _T(".*cc.*:[ \t]([Uu]nrecognized.*option.*)"), 1));
Maybe remove cc is better? because it maybe exist in other compilers such as f951...
Regards,
xunxun

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Detecting "unrecognized command line option" errors with GCC
« Reply #3 on: June 24, 2012, 12:28:16 am »
I think you are right.
Code
m_RegExes.Add(RegExStruct(_("Unrecognized option"), cltError, _T(".*:[ \t]([Uu]nrecognized.*option.*)"), 1));
This will make the regex "Linker error (unrecognized option)" obsolete, so it should be removed.

(Sorry I cannot provide the patch currently; I can guarantee that if I created a diff from my local source, it would change a bit more than just one regex in the compiler... ;))

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Detecting "unrecognized command line option" errors with GCC
« Reply #4 on: June 24, 2012, 10:48:45 am »
Alpha: no one stops you from having two working copies :)
But I don't like this regexp, I think it is too generic.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Detecting "unrecognized command line option" errors with GCC
« Reply #5 on: June 24, 2012, 01:41:34 pm »
Alpha: no one stops you from having two working copies :)
(Hit forehead.)  Wow; sometimes I even surprise myself at my lack of ability to see the obvious.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Detecting "unrecognized command line option" errors with GCC
« Reply #6 on: June 24, 2012, 02:08:06 pm »
Code
Index: src/plugins/compilergcc/compilerGNUARM.cpp
===================================================================
--- src/plugins/compilergcc/compilerGNUARM.cpp (revision 8065)
+++ src/plugins/compilergcc/compilerGNUARM.cpp (working copy)
@@ -220,6 +220,7 @@
     m_RegExes.Add(RegExStruct(_("Undefined reference"), cltError, _T("(") + FilePathWithSpaces + _T("):[ \t](undefined reference.*)"), 2, 1));
     m_RegExes.Add(RegExStruct(_("General warning"), cltWarning, _T("([Ww]arning:[ \t].*)"), 1));
     m_RegExes.Add(RegExStruct(_("Auto-import info"), cltInfo, _T("([Ii]nfo:[ \t].*)\\(auto-import\\)"), 1));
+    m_RegExes.Add(RegExStruct(_("Compiler error (unrecognized option)"), cltError, _T(".*cc.*:[ \t]([Uu]nrecognized.*option.*)"), 1));
 }
 
 AutoDetectResult CompilerGNUARM::AutoDetectInstallationDir()
Index: src/plugins/compilergcc/compilerGNUAVR.cpp
===================================================================
--- src/plugins/compilergcc/compilerGNUAVR.cpp (revision 8065)
+++ src/plugins/compilergcc/compilerGNUAVR.cpp (working copy)
@@ -260,6 +260,7 @@
     m_RegExes.Add(RegExStruct(_("Undefined reference"), cltError, _T("(") + FilePathWithSpaces + _T("):[ \t](undefined reference.*)"), 2, 1));
     m_RegExes.Add(RegExStruct(_("General warning"), cltWarning, _T("([Ww]arning:[ \t].*)"), 1));
     m_RegExes.Add(RegExStruct(_("Auto-import info"), cltInfo, _T("([Ii]nfo:[ \t].*)\\(auto-import\\)"), 1));
+    m_RegExes.Add(RegExStruct(_("Compiler error (unrecognized option)"), cltError, _T(".*cc.*:[ \t]([Uu]nrecognized.*option.*)"), 1));
 } // end of LoadDefaultRegExArray
 
 AutoDetectResult CompilerGNUAVR::AutoDetectInstallationDir()
Index: src/plugins/compilergcc/compilerGNUTRICORE.cpp
===================================================================
--- src/plugins/compilergcc/compilerGNUTRICORE.cpp (revision 8065)
+++ src/plugins/compilergcc/compilerGNUTRICORE.cpp (working copy)
@@ -211,6 +211,7 @@
     m_RegExes.Add(RegExStruct(_("Undefined reference"), cltError, _T("(") + FilePathWithSpaces + _T("):[ \t](undefined reference.*)"), 2, 1));
     m_RegExes.Add(RegExStruct(_("General warning"), cltWarning, _T("([Ww]arning:[ \t].*)"), 1));
     m_RegExes.Add(RegExStruct(_("Auto-import info"), cltInfo, _T("([Ii]nfo:[ \t].*)\\(auto-import\\)"), 1));
+    m_RegExes.Add(RegExStruct(_("Compiler error (unrecognized option)"), cltError, _T(".*cc.*:[ \t]([Uu]nrecognized.*option.*)"), 1));
 }
 
 AutoDetectResult CompilerGNUTRICORE::AutoDetectInstallationDir()
Index: src/plugins/compilergcc/compilerGNUPOWERPC.cpp
===================================================================
--- src/plugins/compilergcc/compilerGNUPOWERPC.cpp (revision 8065)
+++ src/plugins/compilergcc/compilerGNUPOWERPC.cpp (working copy)
@@ -214,6 +214,7 @@
     m_RegExes.Add(RegExStruct(_("Undefined reference"), cltError, _T("(") + FilePathWithSpaces + _T("):[ \t](undefined reference.*)"), 2, 1));
     m_RegExes.Add(RegExStruct(_("General warning"), cltWarning, _T("([Ww]arning:[ \t].*)"), 1));
     m_RegExes.Add(RegExStruct(_("Auto-import info"), cltInfo, _T("([Ii]nfo:[ \t].*)\\(auto-import\\)"), 1));
+    m_RegExes.Add(RegExStruct(_("Compiler error (unrecognized option)"), cltError, _T(".*cc.*:[ \t]([Uu]nrecognized.*option.*)"), 1));
 }
 
 AutoDetectResult CompilerGNUPOWERPC::AutoDetectInstallationDir()
Index: src/plugins/compilergcc/compilerGNUMSP430.cpp
===================================================================
--- src/plugins/compilergcc/compilerGNUMSP430.cpp (revision 8065)
+++ src/plugins/compilergcc/compilerGNUMSP430.cpp (working copy)
@@ -287,6 +287,7 @@
     m_RegExes.Add(RegExStruct(_("Undefined reference"), cltError, _T("(") + FilePathWithSpaces + _T("):[ \t](undefined reference.*)"), 2, 1));
     m_RegExes.Add(RegExStruct(_("General warning"), cltWarning, _T("([Ww]arning:[ \t].*)"), 1));
     m_RegExes.Add(RegExStruct(_("Auto-import info"), cltInfo, _T("([Ii]nfo:[ \t].*)\\(auto-import\\)"), 1));
+    m_RegExes.Add(RegExStruct(_("Compiler error (unrecognized option)"), cltError, _T(".*cc.*:[ \t]([Uu]nrecognized.*option.*)"), 1));
 }
 
 AutoDetectResult CompilerGNUMSP430::AutoDetectInstallationDir()
Index: src/plugins/compilergcc/compilerMINGW.cpp
===================================================================
--- src/plugins/compilergcc/compilerMINGW.cpp (revision 8065)
+++ src/plugins/compilergcc/compilerMINGW.cpp (working copy)
@@ -230,6 +230,7 @@
     m_RegExes.Add(RegExStruct(_("Linker error (lib not found)"), cltError, _T(".*(ld.*):[ \t](cannot find.*)"), 2, 1));
     m_RegExes.Add(RegExStruct(_("Linker error (cannot open output file)"), cltError, _T(".*(ld.*):[ \t](cannot open output file.*):[ \t](.*)"), 2, 1, 0, 3));
     m_RegExes.Add(RegExStruct(_("Linker error (unrecognized option)"), cltError, _T(".*(ld.*):[ \t](unrecognized option.*)"), 2, 1));
+    m_RegExes.Add(RegExStruct(_("Compiler error (unrecognized option)"), cltError, _T(".*cc.*:[ \t]([Uu]nrecognized.*option.*)"), 1));
     m_RegExes.Add(RegExStruct(_("No such file or directory"), cltError, _T(".*:(.*):[ \t](No such file or directory.*)"), 2, 1));
     m_RegExes.Add(RegExStruct(_("Undefined reference"), cltError, _T("(") + FilePathWithSpaces + _T("):[ \t](undefined reference.*)"), 2, 1));
     m_RegExes.Add(RegExStruct(_("General warning"), cltWarning, _T("([Ww]arning:[ \t].*)"), 1));


Offline xunxun

  • Almost regular
  • **
  • Posts: 187
Re: Detecting "unrecognized command line option" errors with GCC
« Reply #7 on: June 24, 2012, 03:23:11 pm »
If we can merge all the similar compiler warnings or errors or infos regexp to your xml based compilers, it will be better, and it will be maintained more easily.
Regards,
xunxun