Author Topic: Hacking compiler warnings  (Read 6281 times)

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Hacking compiler warnings
« on: November 02, 2013, 12:48:52 am »
Force Code::Blocks to only parse/output unique messages from the compiler.  Useful in sorting through large numbers of warnings without just silencing them.
Code
diff --git a/src/plugins/compilergcc/compilergcc.cpp b/src/plugins/compilergcc/compilergcc.cpp
index cdc47a0..4568326 100644
--- a/src/plugins/compilergcc/compilergcc.cpp
+++ b/src/plugins/compilergcc/compilergcc.cpp
@@ -1694,6 +1694,7 @@ void CompilerGCC::DoClearErrors()
     m_Errors.Clear();
     m_pListLog->Clear();
     m_NotifiedMaxErrors = false;
+    m_LoggedMessages.clear();
 }
 
 int CompilerGCC::RunSingleFile(const wxString& filename)
@@ -3337,6 +3338,10 @@ void CompilerGCC::AddOutputLine(const wxString& output, bool forceErrorColour)
         }
     }
 
+    if (m_LoggedMessages.find(output) != m_LoggedMessages.end())
+        return;
+    m_LoggedMessages.insert(output);
+
     Compiler* compiler = CompilerFactory::GetCompiler(m_CompilerId);
     if (!compiler)
         return;
diff --git a/src/plugins/compilergcc/compilergcc.h b/src/plugins/compilergcc/compilergcc.h
index f6a0e58..e535e87 100644
--- a/src/plugins/compilergcc/compilergcc.h
+++ b/src/plugins/compilergcc/compilergcc.h
@@ -321,6 +321,8 @@ class CompilerGCC : public cbCompilerPlugin
         size_t m_CurrentProgress;
         bool   m_LogBuildProgressPercentage;
 
+        std::set<wxString> m_LoggedMessages;
+
         DECLARE_EVENT_TABLE()
 };
 
(No warranty on safety.  Use with caution :).)