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

how to remove those compiler warnings

<< < (2/4) > >>

oBFusCATed:

--- Quote from: oBFusCATed on June 04, 2012, 10:58:03 pm ---p.s. I suppose the best we could do is to make operator= an unimplemented private function.

--- End quote ---
Turns out that the script bindings are using the operator=, but the versions in EditorBase and cbEditor both throw an exception,
so the second best thing is to remove the virtual keyword in their declarations.

EditorBase:
virtual void operator=(const EditorBase& /*rhs*/){ cbThrow(_T("Can't assign an EditorBase* !!!")); }
cbEditor:
virtual void operator=(const cbEditor& /*rhs*/){ cbThrow(_T("Can't assign an cbEditor* !!!")); }

No inheritance is used here...

ollydbg:

--- Quote from: oBFusCATed on June 05, 2012, 10:23:44 am ---
--- Quote from: oBFusCATed on June 04, 2012, 10:58:03 pm ---p.s. I suppose the best we could do is to make operator= an unimplemented private function.

--- End quote ---
Turns out that the script bindings are using the operator=, but the versions in EditorBase and cbEditor both throw an exception,
so the second best thing is to remove the virtual keyword in their declarations.

EditorBase:
virtual void operator=(const EditorBase& /*rhs*/){ cbThrow(_T("Can't assign an EditorBase* !!!")); }
cbEditor:
virtual void operator=(const cbEditor& /*rhs*/){ cbThrow(_T("Can't assign an cbEditor* !!!")); }

No inheritance is used here...

--- End quote ---

Ok, remove the "virtual" keyword, then there is not such warning now.

I see another kind of warning:

--- Quote ---include\cbplugin.h:169:22: warning: 'virtual bool cbPlugin::BuildToolBar(wxToolBar*, int&)' was hidden [-Woverloaded-virtual]
include\cbplugin.h:408:22: warning:   by 'virtual bool cbDebuggerPlugin::BuildToolBar(wxToolBar*)' [-Woverloaded-virtual]

--- End quote ---

Here:in cbPlugin:

--- Code: ---        virtual bool BuildToolBar(wxToolBar* toolBar) = 0;
        virtual bool BuildToolBar(wxToolBar* toolBar, int &priority) { priority = 50; return BuildToolBar(toolBar); }
--- End code ---

and in derived class:

--- Code: ---virtual bool BuildToolBar(wxToolBar* toolBar);

--- End code ---

oBFusCATed:
This one should be fixed using "using bla bla".

ptDev:

--- Quote from: ollydbg on June 07, 2012, 03:47:32 am ---I see another kind of warning:

--- Quote ---include\cbplugin.h:169:22: warning: 'virtual bool cbPlugin::BuildToolBar(wxToolBar*, int&)' was hidden [-Woverloaded-virtual]
include\cbplugin.h:408:22: warning:   by 'virtual bool cbDebuggerPlugin::BuildToolBar(wxToolBar*)' [-Woverloaded-virtual]

--- End quote ---

Here:in cbPlugin:

--- Code: ---        virtual bool BuildToolBar(wxToolBar* toolBar) = 0;
        virtual bool BuildToolBar(wxToolBar* toolBar, int &priority) { priority = 50; return BuildToolBar(toolBar); }
--- End code ---

and in derived class:

--- Code: ---virtual bool BuildToolBar(wxToolBar* toolBar);

--- End code ---

--- End quote ---

Does cbPlugin::BuildToolBar(wxToolBar* toolBar, int &priority) really need to be virtual? I would fix that by making it non-virtual. Otherwise, you lose the method (or need to re-implement it) in the derived class.

jarod42:
I would suggest to rename the method to avoid future similar warnings for derived class.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version