Editing Other People's Code to Eliminate Compiler Warnings

General questions regarding the usage of CodeLite
User avatar
ColleenKobe
CodeLite Expert
Posts: 130
Joined: Wed Mar 30, 2016 4:31 pm
Genuine User: Yes
IDE Question: C++
Contact:

Editing Other People's Code to Eliminate Compiler Warnings

Post by ColleenKobe »

My question is in regards to compiler warnings generated by other people's code.

When I compile my programs, I often get compiler warnings like this:

Code: Select all

C:\Windows\system32\cmd.exe /C C:/TDM-GCC-64/bin/mingw32-make.exe -e -f  Makefile
"----------Building project:[ GoButtonProject - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'F:/Prototypes_CPP/PushAButtonWorkspace/GoButtonProject'
C:/TDM-GCC-32/bin/g++.exe  -c  "F:/Prototypes_CPP/PushAButtonWorkspace/GoButtonProject/main.cpp" -g -O0 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -IC:/wxWidgets/lib/gcc_dll/mswu -IC:/wxWidgets/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0  -fno-keep-inline-dllexport -std=c++11    -o ./Debug/main.cpp.o -I. -I.
In file included from F:/Prototypes_CPP/PushAButtonWorkspace/GoButtonProject/main.cpp:1:0:
C:/wxWidgets/include/wx/app.h:896:69: warning: 'virtual void wxWindowBase::SetInitialBestSize(const wxSize&)' is deprecated: use SetInitialSize() instead. [-Wdeprecated-declarations]
 #define IMPLEMENT_APP(app)                      wxIMPLEMENT_APP(app);
                                                                     ^
F:/Prototypes_CPP/PushAButtonWorkspace/GoButtonProject/main.cpp:25:1: note: in expansion of macro 'IMPLEMENT_APP'
 IMPLEMENT_APP(MainApp)
 ^
In file included from C:/wxWidgets/include/wx/xrc/xmlreshandler.h:22:0,
                 from C:/wxWidgets/include/wx/xrc/xmlres.h:30,
                 from F:/Prototypes_CPP/PushAButtonWorkspace/GoButtonProject/wxcrafter.h:11,
                 from F:/Prototypes_CPP/PushAButtonWorkspace/GoButtonProject/MainFrame.h:3,
                 from F:/Prototypes_CPP/PushAButtonWorkspace/GoButtonProject/main.cpp:3:
C:/wxWidgets/include/wx/window.h:1917:13: note: declared here
 inline void wxWindowBase::SetInitialBestSize(const wxSize& size)
             ^
In file included from F:/Prototypes_CPP/PushAButtonWorkspace/GoButtonProject/main.cpp:1:0:
C:/wxWidgets/include/wx/app.h:896:69: warning: 'virtual void wxWindowBase::SetInitialBestSize(const wxSize&)' is deprecated: use SetInitialSize() instead. [-Wdeprecated-declarations]
 #define IMPLEMENT_APP(app)                      wxIMPLEMENT_APP(app);
                                                                     ^
F:/Prototypes_CPP/PushAButtonWorkspace/GoButtonProject/main.cpp:25:1: note: in expansion of macro 'IMPLEMENT_APP'
 IMPLEMENT_APP(MainApp)
 ^
In file included from C:/wxWidgets/include/wx/xrc/xmlreshandler.h:22:0,
                 from C:/wxWidgets/include/wx/xrc/xmlres.h:30,
                 from F:/Prototypes_CPP/PushAButtonWorkspace/GoButtonProject/wxcrafter.h:11,
                 from F:/Prototypes_CPP/PushAButtonWorkspace/GoButtonProject/MainFrame.h:3,
                 from F:/Prototypes_CPP/PushAButtonWorkspace/GoButtonProject/main.cpp:3:
C:/wxWidgets/include/wx/window.h:1917:13: note: declared here
 inline void wxWindowBase::SetInitialBestSize(const wxSize& size)
             ^
In file included from F:/Prototypes_CPP/PushAButtonWorkspace/GoButtonProject/main.cpp:1:0:
C:/wxWidgets/include/wx/app.h:896:69: warning: 'virtual void wxWindowBase::SetInitialBestSize(const wxSize&)' is deprecated: use SetInitialSize() instead. [-Wdeprecated-declarations]
 #define IMPLEMENT_APP(app)                      wxIMPLEMENT_APP(app);
                                                                     ^
F:/Prototypes_CPP/PushAButtonWorkspace/GoButtonProject/main.cpp:25:1: note: in expansion of macro 'IMPLEMENT_APP'
 IMPLEMENT_APP(MainApp)
 ^
My question is about the "x is deprecated" warnings. I see that the compiler is telling me to use another procedure instead of the one in use. However, I did not write the code that is generating the warnings.

I am still new to open-sourced code. Is it "okay" to edit someone else's code, to get rid of those warnings? Or is that "trespassing"?


My Software Versions:
---------------------
  • CodeLite = 9.1.5
    tdm-gcc = 5.1.0.3
    Windows 7 = 6.1
    wxWidgets = 3.1.0
User avatar
Jarod42
CodeLite Expert
Posts: 239
Joined: Wed Sep 30, 2009 5:54 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: Editing Other People's Code to Eliminate Compiler Warnin

Post by Jarod42 »

You have to look at the license to know if you can edit those headers.

A local "workaround" is to tell to your compiler that there are system header, and so warnings from these headers are not reported:

For gcc/clang: use `-isystem` instead of `-I`.

See https://gcc.gnu.org/onlinedocs/cpp/System-Headers.html for more details.
User avatar
ColleenKobe
CodeLite Expert
Posts: 130
Joined: Wed Mar 30, 2016 4:31 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Editing Other People's Code to Eliminate Compiler Warnin

Post by ColleenKobe »

Terrific! Thank you, Jarod42! That worked. Thank you also for the helpful link. :-D

Colleen
Post Reply