News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

missing 'const' in CompilerCommandGenerator::GetOrderedOptions(...)

Started by mdelfede, July 13, 2006, 09:07:30 PM

Previous topic - Next topic

mdelfede

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

thomas

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?
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

mdelfede

Quote from: 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?

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

thomas

Ah, ok... this was introduced in 2746 and fixed in 2747   :)

You're right, the function's signature was changed.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

killerbot

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 ;-)
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.