OK, I've tried to use the $REMOVE_QUOTES{} macro with a variable as argument and C::B entered infinite loop.
To reproduce:
1. create a variable in build options - $TEST="-ftest -ftest2"
2. set compiler -> other options to $REMOVE_QUOTES{$TEST}
3. build
Looking at the code this infinite loop will happen if the argument to $REMOVE_QUOTES isn't quoted.
Here is a patch that fixes both problems, but I wonder if I really need the if statement that checks if the argument starts with '$'.
Can I skip it? What other macros should be fixed in a similar fashion?
@dev: Please comment on the above...
Index: src/sdk/macrosmanager.cpp
===================================================================
--- src/sdk/macrosmanager.cpp (revision 8898)
+++ src/sdk/macrosmanager.cpp (working copy)
@@ -490,12 +490,16 @@ void MacrosManager::ReplaceMacros(wxString& buffer, ProjectBuildTarget* target,
while (m_RE_RemoveQuotes.Matches(buffer))
{
search = m_RE_RemoveQuotes.GetMatch(buffer, 0);
- const wxString content = m_RE_RemoveQuotes.GetMatch(buffer, 1);
+ wxString content = m_RE_RemoveQuotes.GetMatch(buffer, 1).Trim().Trim(false);
+ if (content.StartsWith(wxT("$")))
+ ReplaceMacros(content, target, subrequest);
if (content.Len()>2 && content.StartsWith(wxT("\"")) && content.EndsWith(wxT("\"")))
{
replace = content.Mid(1,content.Len()-2); // with first and last char (the quotes) removed
buffer.Replace(search, replace, false);
}
+ else
+ buffer.Replace(search, content, false);
}
while (m_RE_Unix.Matches(buffer))