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

Search for ideas: Report errors in macro replacement to build log pane

(1/1)

BlueHazzard:
Hi,
I currently rework the global variables part of codeblocks and i stumbled on a problem in MacrosManager:
The compiler plugin an many other places use this set of functions:

--- Code: ---    void ReplaceMacros(wxString& buffer, const ProjectBuildTarget* target = nullptr, bool subrequest = false);
    wxString ReplaceMacros(const wxString& buffer, const ProjectBuildTarget* target = nullptr);
    void ReplaceEnvVars(wxString& buffer) { ReplaceMacros(buffer); }  /* misnomer, should be ReplaceVariables */;

--- End code ---
There is no possibility to report any error from this function, or deeper function for example if the global variable is not defined ecc...
Are there any ideas, how we can add error reporting?

One idea from me is, that we add a pointer to a "logger" class.
If the pointer is present log some error messages, if it is nullptr do nothing
A other idea would be to throw an exception
Any other ideas?

Keep in mind, this should work in any place in codeblocks:
* scripting
* plugins (ex. Tools menu)
* build process
* pre, post build steps
* ecc...

Miguel Gimenez:
Can't you just use Manager::Get()->GetLogManager()?

BlueHazzard:

--- Quote from: Miguel Gimenez on October 06, 2021, 02:59:14 pm ---Can't you just use Manager::Get()->GetLogManager()?

--- End quote ---
It would be nice to report this errors in the build log when it comes from the compiler for example...
If the build fails i do not look in the codeblocks log window for errors, but in the build log

Navigation

[0] Message Index

Go to full version