Code::Blocks Forums

User forums => Help => Topic started by: mdelfede on July 13, 2006, 09:07:30 pm

Title: missing 'const' in CompilerCommandGenerator::GetOrderedOptions(...)
Post by: mdelfede on July 13, 2006, 09:07:30 pm
There's a missing 'const' in sdk/CompilerCommandGenerator.cpp :

** Arrange order of options.
  * Depending on the order defined for the build target, it concatenates
  * @c project_options with @c target_options and returns the result.
  */
wxString CompilerCommandGenerator::GetOrderedOptions(ProjectBuildTarget* target, OptionsRelationType rel, const wxString& project_options, const wxString& target_options)


should be

wxString CompilerCommandGenerator::GetOrderedOptions(const ProjectBuildTarget* target, OptionsRelationType rel, const wxString& project_options, const wxString& target_options)

GCC complains about it.

Ciao

Max
Title: Re: missing 'const' in CompilerCommandGenerator::GetOrderedOptions(...)
Post by: thomas on July 13, 2006, 09:12:40 pm
My compiler (which happens to be gcc) does not complain about it (and I see no reason why target should be const, either).

Mind posting the full commandline including the exact error message?
Title: Re: missing 'const' in CompilerCommandGenerator::GetOrderedOptions(...)
Post by: mdelfede on July 13, 2006, 09:14:54 pm
My compiler (which happens to be gcc) does not complain about it (and I see no reason why target should be const, either).

Mind posting the full commandline including the exact error message?

Sorry, I forgot the revision, is 2746.
I'll take off the 'const' again and post the mesage...

Here is it :

:: === Code::Blocks, sdk ===
sdk\compilercommandgenerator.cpp:581: error: prototype for `wxString CompilerCommandGenerator::GetOrderedOptions(ProjectBuildTarget*, OptionsRelationType, const wxString&, const wxString&)' does not match any in class `CompilerCommandGenerator'
sdk\compilercommandgenerator.h:42: error: candidate is: virtual wxString CompilerCommandGenerator::GetOrderedOptions(const ProjectBuildTarget*, OptionsRelationType, const wxString&, const wxString&)
:: === Build finished: 2 errors, 0 warnings ===

btw, or the 'target' must be 'const' in cpp file, or he mustn't be const in header file....

Ciao

Max
Title: Re: missing 'const' in CompilerCommandGenerator::GetOrderedOptions(...)
Post by: thomas on July 13, 2006, 09:28:19 pm
Ah, ok... this was introduced in 2746 and fixed in 2747   :)

You're right, the function's signature was changed.
Title: Re: missing 'const' in CompilerCommandGenerator::GetOrderedOptions(...)
Post by: killerbot on July 13, 2006, 10:24:37 pm
woops my mistake, somethin went wrong in my merge. My scratch svn was ok, but my commit svn, I forgot the implementation to the change. Sorry ...

By the way, that way you could not see my comment I made to the source ;-)
Code
wxString CompilerCommandGenerator::GetOrderedOptions(const ProjectBuildTarget* target, OptionsRelationType rel, const wxString& project_options, const wxString& target_options)
{ // NOTE : this should not be a member method, does not use nor alter the state


By the way, it should be const, since nothing is bound to change to the target argument.