User forums > Using Code::Blocks

How to see the generated compiler parameters?

<< < (2/2)

Jenna:
It would be easy to expand macros in backticked expressions before evaluating them:


--- Code: ---Index: compilercommandgenerator.cpp
===================================================================
--- compilercommandgenerator.cpp (Revision 7071)
+++ compilercommandgenerator.cpp (Arbeitskopie)
@@ -919,6 +919,7 @@
 /** Adds support for backtick'd expressions under windows. */
 wxString CompilerCommandGenerator::ExpandBackticks(wxString& str)
 {
+    Manager::Get()->GetMacrosManager()->ReplaceMacros(str);
     wxString ret;
 
     // this function is not windows-only anymore because we parse the backticked command's output

--- End code ---

@other devs:
Is there any obvious reason I miss not to do it ?

MortenMacFly:

--- Quote from: jens on April 03, 2011, 11:54:42 pm ---Is there any obvious reason I miss not to do it ?

--- End quote ---
Such things are usually dangerous for auto-generated files because the macros may be expanded too early. I didn't see when this is called though (no access to the sources). You should play the tutorial from the WiKi concerning auto-generated files and see it that would still work. If that's the case I see not reason not to do it.

Also, verify what gets saved to the project. Remember: This is a by reference call... not that we loose the original setup.

Jenna:

--- Quote from: MortenMacFly on April 04, 2011, 06:32:12 am ---
--- Quote from: jens on April 03, 2011, 11:54:42 pm ---Is there any obvious reason I miss not to do it ?

--- End quote ---
Such things are usually dangerous for auto-generated files because the macros may be expanded too early. I didn't see when this is called though (no access to the sources). You should play the tutorial from the WiKi concerning auto-generated files and see it that would still work. If that's the case I see not reason not to do it.

--- End quote ---
Which tutorial ?


--- Quote from: MortenMacFly on April 04, 2011, 06:32:12 am ---Also, verify what gets saved to the project. Remember: This is a by reference call... not that we loose the original setup.

--- End quote ---
Both calls to ExpandBackticks use temporary strings at the moment, so it does not harm.
And what's more the actual code also changes the wxString passed to the function (it replaces the backtick-part with the evaluated stuff).

cacb:

--- Quote from: jens on April 04, 2011, 08:54:42 am ---Both calls to ExpandBackticks use temporary strings at the moment, so it does not harm.
And what's more the actual code also changes the wxString passed to the function (it replaces the backtick-part with the evaluated stuff).

--- End quote ---

Just saying that I appreciate your efforts here... It would indeed be useful to allow the expansion inside backticks! As mentioned, it is obviously important that the expanded string is not written back to the .cbp file. It must be left as written.

MortenMacFly:

--- Quote from: jens on April 04, 2011, 08:54:42 am ---Which tutorial ?

--- End quote ---
This one:

http://wiki.codeblocks.org/index.php?title=Adding_support_for_non_C/C%2B%2B_files_to_the_build_system

(Sorry, forgot to mention that...)

Navigation

[0] Message Index

[*] Previous page

Go to full version