Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: BlueHazzard on October 06, 2021, 02:47:53 pm

Title: Search for ideas: Report errors in macro replacement to build log pane
Post by: BlueHazzard on October 06, 2021, 02:47:53 pm
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 */;
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...
Title: Re: Search for ideas: Report errors in macro replacement to build log pane
Post by: Miguel Gimenez on October 06, 2021, 02:59:14 pm
Can't you just use Manager::Get()->GetLogManager()?
Title: Re: Search for ideas: Report errors in macro replacement to build log pane
Post by: BlueHazzard on October 06, 2021, 03:24:13 pm
Can't you just use Manager::Get()->GetLogManager()?
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