Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

invalid_ compiler, should break the build

(1/1)

oBFusCATed:
It turned out that if you have an invali_d compiler and then try to debug something, there is no error message shown as it should.
I'm talking about the debugger's branch of course.

I've debugged it a bit and the reason is that the exit code from the compiler is not set to != 0.
I've tried this patch and it works:

--- Code: ---Index: src/plugins/compilergcc/compilergcc.cpp
===================================================================
--- src/plugins/compilergcc/compilergcc.cpp (revision 7860)
+++ src/plugins/compilergcc/compilergcc.cpp (working copy)
@@ -2387,6 +2387,7 @@
                            _T("Skipping..."),
                            prj->GetTitle().wx_str(), tlist[x].wx_str(), compilerName.wx_str(), compilerName2.wx_str());
                 Manager::Get()->GetLogManager()->LogWarning(msg, m_PageIndex);
+                m_LastExitCode = 1;
                 continue;
             }
             else if (!tgt->SupportsCurrentPlatform())
Index: src/plugins/debuggergdb/debuggergdb.cpp
===================================================================
--- src/plugins/debuggergdb/debuggergdb.cpp (revision 7860)
+++ src/plugins/debuggergdb/debuggergdb.cpp (working copy)
@@ -2126,7 +2126,10 @@
 bool DebuggerGDB::CompilerFinished(bool compilerFailed, StartType startType)
 {
     if (compilerFailed || startType == StartTypeUnknown)
+    {
+        m_Canceled = true;
         return false;
+    }
     if (DoDebug(startType == StartTypeStepInto) != 0)
         return false;
     return true;

--- End code ---

Is it OK, to commit it? (The m_LastExitCode is going to be committed in trunk).

p.s. Morten can you add me to an exclude list, so I can post about invalid __ compilers?

killerbot:
what exactly will this mean. Something that should NOT break are the following use cases. A project with several targets, each building with a different compiler. It is well possible that sometimes certain compilers are not installed. Then a build 'all' (aka every target) should not fail, because some compiler is missing.
This is just for compiling/linking, not for launching the debugger off course.

oBFusCATed:
Two corrections to the patch:

--- Code: ---Index: src/plugins/compilergcc/compilergcc.cpp
===================================================================
--- src/plugins/compilergcc/compilergcc.cpp (revision 7860)
+++ src/plugins/compilergcc/compilergcc.cpp (working copy)
@@ -1152,6 +1152,7 @@
             cmd = m_CommandQueue.Next();
             if (!cmd && m_BuildState == bsNone && m_NextBuildState == bsNone)
             {
+                m_LastExitCode = 0;
                 NotifyJobDone(true);
                 ResetBuildState();
                 if (m_RunAfterCompile)
@@ -2387,6 +2388,7 @@
                            _T("Skipping..."),
                            prj->GetTitle().wx_str(), tlist[x].wx_str(), compilerName.wx_str(), compilerName2.wx_str());
                 Manager::Get()->GetLogManager()->LogWarning(msg, m_PageIndex);
+                m_LastExitCode = 1;
                 continue;
             }
             else if (!tgt->SupportsCurrentPlatform())
@@ -2395,6 +2397,7 @@
                 msg.Printf(_T("\"%s - %s\" does not support the current platform. Skipping..."),
                             prj->GetTitle().wx_str(), tlist[x].wx_str());
                 Manager::Get()->GetLogManager()->LogWarning(msg, m_PageIndex);
+                m_LastExitCode = 1;
                 continue;
             }
             BuildJobTarget bjt;
Index: src/plugins/debuggergdb/debuggergdb.cpp
===================================================================
--- src/plugins/debuggergdb/debuggergdb.cpp (revision 7860)
+++ src/plugins/debuggergdb/debuggergdb.cpp (working copy)
@@ -2126,7 +2126,10 @@
 bool DebuggerGDB::CompilerFinished(bool compilerFailed, StartType startType)
 {
     if (compilerFailed || startType == StartTypeUnknown)
+    {
+        m_Canceled = true;
         return false;
+    }
     if (DoDebug(startType == StartTypeStepInto) != 0)
         return false;
     return true;

--- End code ---


The "m_LastExitCode = 0;" part is needed, because if I have two target project and I try to build a failing target, then switch to the correct target and try to launch the debugger, it thinks that the build failed.

killerbot: You case seems to work and I think the reason is that the invalid_compiler message is printed at the beginning of the build, so if there is something that modifies the m_LastExitCode after I've set it, everything is OK.
Also m_LastExitCode it not used inside the compiler, it is meant for the outside world:)

MortenMacFly:

--- Quote from: oBFusCATed on February 26, 2012, 11:44:16 pm ---Is it OK, to commit it? (The m_LastExitCode is going to be committed in trunk).

--- End quote ---
If it doesn't break other builds (i.e. building C::B) go ahead.


--- Quote from: oBFusCATed on February 26, 2012, 11:44:16 pm ---p.s. Morten can you add me to an exclude list, so I can post about invalid __ compilers?

--- End quote ---
Not possible, sorry. That's a kind of "global search & replace) independent of users. The same would happen to me and even Yiannis.

...but I saw you find a work-around... ;-)

Navigation

[0] Message Index

Go to full version