Author Topic: how to remove those compiler warnings  (Read 19146 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: how to remove those compiler warnings
« Reply #15 on: June 15, 2012, 09:55:13 am »
Please commit them as separate changes and, also please increase the SDK version number in cbplugin.h and remember to fix all plugins to use the new API.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: how to remove those compiler warnings
« Reply #16 on: June 15, 2012, 10:20:48 am »
Done in rev 8048 and rev 8049. Thanks for all your guy's suggestions!!!
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: how to remove those compiler warnings
« Reply #17 on: June 17, 2012, 07:33:21 am »
There are still some warnings like:
Code
[ 35.4%] g++.exe -Wall -g -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE  -Woverloaded-virtual -DEXPORT_LIB -DEXPORT_EVENTS -DWXMAKINGDLL_PROPGRID -DwxPG_USE_WXMODULE=0 -DWXMAKINGDLL_SCI    -iquote.objs\include -I.objs\include -I. -IE:\code\cb\wx\wxWidgets-2.8.12\include -IE:\code\cb\wx\wxWidgets-2.8.12\contrib\include -IE:\code\cb\wx\wxWidgets-2.8.12\lib\gcc_dll\mswu -Isdk\wxscintilla\include -Isdk\wxpropgrid\include -Iinclude\tinyxml -Iinclude -Iinclude\tinyxml -Iinclude\scripting\bindings -Iinclude\scripting\include -Iinclude\scripting\sqplus -Iinclude\mozilla_chardet -Isdk\wxpropgrid\include  -c sdk\scripting\bindings\sc_progress.cpp -o .objs\sdk\scripting\bindings\sc_progress.o
E:\code\cb\wx\wxWidgets-2.8.12\include/wx/generic/progdlgg.h:55:17: warning: 'virtual bool wxProgressDialog::Update(int, const wxString&, bool*)' was hidden [-Woverloaded-virtual]
sdk\scripting\bindings\sc_progress.cpp:42:14: warning:   by 'bool ProgressDialog::Update(int, const wxString&)' [-Woverloaded-virtual]
E:\code\cb\wx\wxWidgets-2.8.12\include/wx/generic/progdlgg.h:62:18: warning: 'virtual void wxProgressDialog::Update()' was hidden [-Woverloaded-virtual]
sdk\scripting\bindings\sc_progress.cpp:42:14: warning:   by 'bool ProgressDialog::Update(int, const wxString&)' [-Woverloaded-virtual]

Code
class ProgressDialog : public wxProgressDialog
{
    public:
        ProgressDialog()
            : wxProgressDialog(_("Progress"),
                                _("Please wait while operation is in progress..."),
                                100, 0,
                                wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT)
        {
        }

        ~ProgressDialog()
        {
        }

        ProgressDialog& operator=(const ProgressDialog&)
        {
            cbThrow(_T("ProgressDialog copy constructor should never be called!"));
        }

        bool Update(int value, const wxString& newmsg)
        {
            return wxProgressDialog::Update(value, newmsg, 0);
        }
};

and

Code
class WXDLLEXPORT wxProgressDialog : public wxDialog
{
DECLARE_DYNAMIC_CLASS(wxProgressDialog)
public:
   /* Creates and displays dialog, disables event handling for other
       frames or parent frame to avoid recursion problems.
       @param title title for window
       @param message message to display in window
       @param maximum value for status bar, if <= 0, no bar is shown
       @param parent window or NULL
       @param style is the bit mask of wxPD_XXX constants from wx/defs.h
   */
   wxProgressDialog(const wxString &title, wxString const &message,
                    int maximum = 100,
                    wxWindow *parent = NULL,
                    int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE);
   /* Destructor.
       Re-enables event handling for other windows.
   */
   virtual ~wxProgressDialog();

   /* Update the status bar to the new value.
       @param value new value
       @param newmsg if used, new message to display
       @returns true if ABORT button has not been pressed
   */
   virtual bool Update(int value, const wxString& newmsg = wxEmptyString, bool *skip = NULL);

    /* Switches the dialog to use a gauge in indeterminate mode and calls
       wxGauge::Pulse() to show to the user a bit of progress */
    virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool *skip = NULL);

    // Must provide overload to avoid hiding it (and warnings about it)
    virtual void Update() { wxDialog::Update(); }

Any ideas to handle this issue? Thanks.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline jarod42

  • Multiple posting newcomer
  • *
  • Posts: 87
Re: how to remove those compiler warnings
« Reply #18 on: June 18, 2012, 12:40:49 pm »
Code
class DerivedClass : public BaseClass
{
using BaseClass::hiddenFunction;

// other stuff.
};
should remove the warnings.

but as seeing the code,
Code
ProgressDialog::update
may be removed.

Note also that
Code
ProgressDialog::operator =
should be private without implementation (or with the 'delete' keyword with C++11).

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: how to remove those compiler warnings
« Reply #19 on: June 18, 2012, 08:00:25 pm »
...be careful here, this is a script binding. Squirrel needs an equality operator exactly as it is setup. So this might look weird, but its a requirement. You better don't change it, but we should comment these workarounds in the code.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ