Developer forums (C::B DEVELOPMENT STRICTLY!) > Compiler Framework Redesign

XML based compilers

<< < (27/41) > >>

killerbot:
testing this again this evening

killerbot:
good and bad news.

The 2 compiler options remain in pace.

However it still breaks existing configuration of compilers. I have told CB that gcc, is to be gcc-4.7.
Aka that means in default.conf the following :

--- Code: --- <gcc>
<NAME>
<str>
<![CDATA[GNU GCC Compiler]]>
</str>
</NAME>
<MASTER_PATH>
<str>
<![CDATA[/usr]]>
</str>
</MASTER_PATH>
<C_COMPILER>
<str>
<![CDATA[gcc-4.7]]>
</str>
</C_COMPILER>
<CPP_COMPILER>
<str>
<![CDATA[g++-4.7]]>
</str>
</CPP_COMPILER>
<LINKER>
<str>
<![CDATA[g++-4.7]]>
</str>
</LINKER>
</gcc>

--- End code ---

However with the new build this is back to defaults in the default.conf (as also through the GUI)
==> only NAME/MASTER_PATH remain, the other are gone.

Personally I think we should fix this first, since this breaks users existing configurations.

Alpha:

--- Quote from: killerbot on September 03, 2012, 08:18:21 pm ---Personally I think we should fix this first, since this breaks users existing configurations.

--- End quote ---
After four hours of just trying to find the cause of the bug, I would agree, it should be fixed first ;).  This bug was far worse than first apparent.  It actually deletes all renamed executables on the second launch after the change has been made.

My last bug fix patch fixed a small problem, but created this much larger one.  The following patch fixes it (and has been much more thoroughly tested both on Windows and Linux).

--- Code: ---Index: src/sdk/compiler.cpp
===================================================================
--- src/sdk/compiler.cpp (revision 8345)
+++ src/sdk/compiler.cpp (working copy)
@@ -843,23 +843,41 @@
                 continue;
             }
         }
-        else if (node->GetName() == wxT("Program"))
+        else if (node->GetName() == wxT("Program")) // configuration is read so execution of renamed programs work, m_Mirror is needed to reset names to their defaults before leaving this function
         {
             wxString prog = node->GetAttribute(wxT("name"), wxEmptyString);
             if (prog == wxT("C"))
-                m_Programs.C       = cfg->Read(cmpKey + wxT("/c_compiler"),   value);
+            {
+                m_Programs.C = cfg->Read(cmpKey + wxT("/c_compiler"), value);
+                m_Mirror.Programs.C = value;
+            }
             else if (prog == wxT("CPP"))
-                m_Programs.CPP     = cfg->Read(cmpKey + wxT("/cpp_compiler"), value);
+            {
+                m_Programs.CPP = cfg->Read(cmpKey + wxT("/cpp_compiler"), value);
+                m_Mirror.Programs.CPP = value;
+            }
             else if (prog == wxT("LD"))
-                m_Programs.LD      = cfg->Read(cmpKey + wxT("/linker"),       value);
+            {
+                m_Programs.LD = cfg->Read(cmpKey + wxT("/linker"), value);
+                m_Mirror.Programs.LD = value;
+            }
             else if (prog == wxT("DBGconfig"))
                 m_Programs.DBGconfig = value;
             else if (prog == wxT("LIB"))
-                m_Programs.LIB     = cfg->Read(cmpKey + wxT("/lib_linker"),   value);
+            {
+                m_Programs.LIB = cfg->Read(cmpKey + wxT("/lib_linker"), value);
+                m_Mirror.Programs.LIB = value;
+            }
             else if (prog == wxT("WINDRES"))
+            {
                 m_Programs.WINDRES = cfg->Read(cmpKey + wxT("/res_compiler"), value);
+                m_Mirror.Programs.WINDRES = value;
+            }
             else if (prog == wxT("MAKE"))
-                m_Programs.MAKE    = cfg->Read(cmpKey + wxT("/make"),         value);
+            {
+                m_Programs.MAKE = cfg->Read(cmpKey + wxT("/make"), value);
+                m_Mirror.Programs.MAKE = value;
+            }
         }
         else if (node->GetName() == wxT("Switch"))
         {
@@ -1000,6 +1018,13 @@
         }
         node = node->GetNext();
     }
+    // reset programs to their actual defaults (customized settings are loaded in a different function)
+    m_Programs.C       = m_Mirror.Programs.C;
+    m_Programs.CPP     = m_Mirror.Programs.CPP;
+    m_Programs.LD      = m_Mirror.Programs.LD;
+    m_Programs.LIB     = m_Mirror.Programs.LIB;
+    m_Programs.WINDRES = m_Mirror.Programs.WINDRES;
+    m_Programs.MAKE    = m_Mirror.Programs.MAKE;
 }
 
 void Compiler::LoadRegExArray(const wxString& name, bool globalPrecedence, int recursion)

--- End code ---

Alpha:

--- Quote from: Alpha on September 04, 2012, 01:13:46 am ---The following patch fixes it (and has been much more thoroughly tested both on Windows and Linux).

--- End quote ---
... but not thoroughly enough.  There is still a small recursion issue that needs to be dealt with.

Alpha:

--- Quote from: Alpha on September 04, 2012, 02:03:27 am ---There is still a small recursion issue that needs to be dealt with.

--- End quote ---
... and dealt with.

--- Code: ---Index: src/sdk/compiler.cpp
===================================================================
--- src/sdk/compiler.cpp (revision 8345)
+++ src/sdk/compiler.cpp (working copy)
@@ -843,23 +843,41 @@
                 continue;
             }
         }
-        else if (node->GetName() == wxT("Program"))
+        else if (node->GetName() == wxT("Program")) // configuration is read so execution of renamed programs work, m_Mirror is needed to reset before leaving this function
         {
             wxString prog = node->GetAttribute(wxT("name"), wxEmptyString);
             if (prog == wxT("C"))
-                m_Programs.C       = cfg->Read(cmpKey + wxT("/c_compiler"),   value);
+            {
+                m_Programs.C = cfg->Read(cmpKey + wxT("/c_compiler"), value);
+                m_Mirror.Programs.C = value;
+            }
             else if (prog == wxT("CPP"))
-                m_Programs.CPP     = cfg->Read(cmpKey + wxT("/cpp_compiler"), value);
+            {
+                m_Programs.CPP = cfg->Read(cmpKey + wxT("/cpp_compiler"), value);
+                m_Mirror.Programs.CPP = value;
+            }
             else if (prog == wxT("LD"))
-                m_Programs.LD      = cfg->Read(cmpKey + wxT("/linker"),       value);
+            {
+                m_Programs.LD = cfg->Read(cmpKey + wxT("/linker"), value);
+                m_Mirror.Programs.LD = value;
+            }
             else if (prog == wxT("DBGconfig"))
                 m_Programs.DBGconfig = value;
             else if (prog == wxT("LIB"))
-                m_Programs.LIB     = cfg->Read(cmpKey + wxT("/lib_linker"),   value);
+            {
+                m_Programs.LIB = cfg->Read(cmpKey + wxT("/lib_linker"), value);
+                m_Mirror.Programs.LIB = value;
+            }
             else if (prog == wxT("WINDRES"))
+            {
                 m_Programs.WINDRES = cfg->Read(cmpKey + wxT("/res_compiler"), value);
+                m_Mirror.Programs.WINDRES = value;
+            }
             else if (prog == wxT("MAKE"))
-                m_Programs.MAKE    = cfg->Read(cmpKey + wxT("/make"),         value);
+            {
+                m_Programs.MAKE = cfg->Read(cmpKey + wxT("/make"), value);
+                m_Mirror.Programs.MAKE = value;
+            }
         }
         else if (node->GetName() == wxT("Switch"))
         {
@@ -1000,6 +1018,15 @@
         }
         node = node->GetNext();
     }
+    if (recursion == 0) // reset programs to their actual defaults (customized settings are loaded in a different function)
+    {
+        m_Programs.C       = m_Mirror.Programs.C;
+        m_Programs.CPP     = m_Mirror.Programs.CPP;
+        m_Programs.LD      = m_Mirror.Programs.LD;
+        m_Programs.LIB     = m_Mirror.Programs.LIB;
+        m_Programs.WINDRES = m_Mirror.Programs.WINDRES;
+        m_Programs.MAKE    = m_Mirror.Programs.MAKE;
+    }
 }
 
 void Compiler::LoadRegExArray(const wxString& name, bool globalPrecedence, int recursion)

--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version