Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
CC makes C::B hang in ExpandBackticks
Alpha:
Congratulations, you have discovered not one bug, but two! Compiler::GetExecName() is supposed to return the passed argument, if it is not a macro to be expanded. Also, it appears that asynchronous use of wxExecute() acts differently on Linux and Windows.
--- Code: ---Index: src/sdk/compiler.cpp
===================================================================
--- src/sdk/compiler.cpp (revision 8756)
+++ src/sdk/compiler.cpp (working copy)
@@ -1138,20 +1138,20 @@
}
wxSetEnv(wxT("PATH"), path);
cmd[0] = GetExecName(cmd[0]);
- if (node->GetAttribute(wxT("regex"), &test))
+
+ long ret;
{
- long ret;
- {
- wxLogNull logNo;
- ret = wxExecute(GetStringFromArray(cmd, wxT(" "), false), cmd);
- }
+ wxLogNull logNo; // do not warn if execution fails
+ ret = wxExecute(GetStringFromArray(cmd, wxT(" "), false), cmd);
+ }
+
+ if (ret != 0) // execution failed
+ val = (node->GetAttribute(wxT("default"), wxEmptyString) == wxT("true"));
+ else if (node->GetAttribute(wxT("regex"), &test))
+ {
wxRegEx re;
- if (ret != 0)
+ if (re.Compile(test))
{
- val = (node->GetAttribute(wxT("default"), wxEmptyString) == wxT("true"));
- }
- else if (re.Compile(test))
- {
for (size_t i = 0; i < cmd.GetCount(); ++i)
{
if (re.Matches(cmd[i]))
@@ -1162,20 +1162,17 @@
}
}
}
- else
- {
- wxLogNull logNo;
- long ret = wxExecute(GetStringFromArray(cmd, wxT(" "), false));
- val = (ret != 0);
- }
- wxSetEnv(wxT("PATH"), origPath);
+ else // execution succeeded (and no regex test given)
+ val = true;
+
+ wxSetEnv(wxT("PATH"), origPath); // restore path
}
return val;
}
wxString Compiler::GetExecName(const wxString& name)
{
- wxString ret;
+ wxString ret = name;
if (name == wxT("C"))
ret = m_Programs.C;
else if (name == wxT("CPP"))
--- End code ---
MortenMacFly:
Does this one:
--- Quote from: Alpha on January 05, 2013, 04:10:30 am ---Congratulations, you have discovered not one bug, but two! [...]
--- Code: ---Index: src/sdk/compiler.cpp
--- End code ---
--- End quote ---
...make this one:
--- Quote from: jens on January 05, 2013, 02:02:45 am ---Yes, they are caused by the xml compiler code, Alpha can you look at them?
[...]
I suggest catching the error output and either give a more clear error message or just suppress it.
--- Code: ---Index: src/plugins/compilergcc/resources/compilers/options_clang.xml
--- End code ---
--- End quote ---
...obsolete?
Jenna:
--- Quote from: MortenMacFly on January 05, 2013, 07:30:25 am ---Does this one:
--- Quote from: Alpha on January 05, 2013, 04:10:30 am ---Congratulations, you have discovered not one bug, but two! [...]
--- Code: ---Index: src/sdk/compiler.cpp
--- End code ---
--- End quote ---
...make this one:
--- Quote from: jens on January 05, 2013, 02:02:45 am ---Yes, they are caused by the xml compiler code, Alpha can you look at them?
[...]
I suggest catching the error output and either give a more clear error message or just suppress it.
--- Code: ---Index: src/plugins/compilergcc/resources/compilers/options_clang.xml
--- End code ---
--- End quote ---
...obsolete?
--- End quote ---
The error-message ("execvp(som ething, someargument) failed with error 2!" will still occur, because wxExecute is called for a not existent exe.
It will only be visible from a console, but as it is not meant for the user it should be caught (with a wxArrayString) and dismissed.
oBFusCATed:
Also, this is a real problem because the linking with clang is broken. Probably logging some errors here in the normal log will be needed.
Jenna:
--- Quote from: oBFusCATed on January 05, 2013, 12:29:37 pm ---Also, this is a real problem because the linking with clang is broken. Probably logging some errors here in the normal log will be needed.
--- End quote ---
There should probably a predefined error-message in the xml-file, which can be shown if the execution fails.
The actual message is not very helpful, at least not for many users, who seem to have problems with more clear messages sometimes :( .
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version