Opened 5 years ago

Last modified 16 months ago

#5550 new defect

Compiler warnings as of May 2022 (macOS, LLVM 10)

Reported by: Krinkle Owned by: Stan
Priority: Should Have Milestone: Backlog
Component: Core engine Keywords:
Cc: Patch: Phab:D3177

Description

On latest trunk as of writing (r22600)

$ clang --version
Apple LLVM version 10.0.1 (clang-1001.0.46.4)


build/workspaces$ ./clean-workspaces.sh 
build/workspaces$ ./update-workspaces.sh 
build/workspaces/gcc$ make pyrogenesis -j4

Short version

==== Building glooxwrapper (release) ====
glooxwrapper.h:642:10: warning: private field 'm_Owned' is not used

==== Building engine (release) ====
../../../source/gui/IGUITextOwner.h:67:15: warning: 'HandleMessage' overrides a member function but is not marked 'override'
../../../source/gui/IGUITextOwner.h:72:15: warning: 'UpdateCachedSize' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
../../../source/gui/IGUITextOwner.h:89:15: warning: 'MouseOverIcon' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
../../../source/ps/XML/XeroXMB.h:221:15: warning: private field 'm_Pointer' is not used [-Wunused-private-field]
../../../source/ps/XML/XeroXMB.h:290:15: warning: private field 'm_Pointer' is not used [-Wunused-private-field]

==== Building atlas (release) ====
../../../source/gui/IGUITextOwner.h:67:15: warning: 'HandleMessage' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
../../../source/gui/IGUITextOwner.h:72:15: warning: 'UpdateCachedSize' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
../../../source/gui/IGUITextOwner.h:89:15: warning: 'MouseOverIcon' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]

==== Building gui (release) ====
../../../source/gui/IGUITextOwner.h:67:15: warning: 'HandleMessage' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
../../../source/gui/IGUITextOwner.h:72:15: warning: 'UpdateCachedSize' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
../../../source/gui/IGUITextOwner.h:89:15: warning: 'MouseOverIcon' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]

==== Building lowlevel (release) ====
../../../source/lib/res/h_mgr.cpp:99:18: warning: unused variable 'TAG_MASK' [-Wunused-const-variable]
../../../source/lib/res/h_mgr.cpp:114:19: warning: unused function 'h_tag' [-Wunused-function]
../../../source/lib/sysdep/os/osx/osx.cpp:91:7: warning: comparison of function 'CGDisplayCopyDisplayMode' not equal to a null pointer is always true [-Wtautological-pointer-compare]
../../../source/lib/sysdep/os/osx/osx.cpp:122:7: warning: comparison of function 'CGDisplayCopyDisplayMode' not equal to a null pointer is always true
../../../source/lib/sysdep/os/unix/unix.cpp:66:67: warning: unused parameter 'text' [-Wunused-parameter]
../../../source/lib/sysdep/os/unix/unix.cpp:66:78: warning: unused parameter 'manual_break' [-Wunused-parameter]
../../../source/lib/sysdep/os/unix/unix.cpp:66:97: warning: unused parameter 'allow_suppress' [-Wunused-parameter]
../../../source/lib/sysdep/os/unix/unix.cpp:66:118: warning: unused parameter 'no_continue' [-Wunused-parameter]

Long version with notes

==== Building glooxwrapper (release) ====
In file included from ../../../source/lobby/glooxwrapper/glooxwrapper.cpp:20:
../../../source/lobby/glooxwrapper/glooxwrapper.h:642:10: warning: private field 'm_Owned' is not used [-Wunused-private-field]
                                bool m_Owned;
                                     ^
==== Building engine (release) ====
In file included from ../../../source/ps/GameSetup/GameSetup.cpp:38:
In file included from ../../../source/gui/GUI.h:51:
../../../source/gui/IGUITextOwner.h:67:15: warning: 'HandleMessage' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void HandleMessage(SGUIMessage& Message);
                     ^
../../../source/gui/IGUIObject.h:291:15: note: overridden virtual function is here
        virtual void HandleMessage(SGUIMessage& UNUSED(Message)) {}
                     ^
In file included from ../../../source/ps/GameSetup/GameSetup.cpp:38:
In file included from ../../../source/gui/GUI.h:51:
../../../source/gui/IGUITextOwner.h:72:15: warning: 'UpdateCachedSize' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void UpdateCachedSize();
                     ^
../../../source/gui/IGUIObject.h:207:15: note: overridden virtual function is here
        virtual void UpdateCachedSize();
                     ^
In file included from ../../../source/ps/GameSetup/GameSetup.cpp:38:
In file included from ../../../source/gui/GUI.h:51:
../../../source/gui/IGUITextOwner.h:89:15: warning: 'MouseOverIcon' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual bool MouseOverIcon();
                     ^
../../../source/gui/IGUIObject.h:129:15: note: overridden virtual function is here
        virtual bool MouseOverIcon();
                     ^
…

In file included from ../../../source/ps/XML/XeroXMB.cpp:20:
In file included from ../../../source/ps/XML/Xeromyces.h:32:
../../../source/ps/XML/XeroXMB.h:221:15: warning: private field 'm_Pointer' is not used [-Wunused-private-field]
                const char* m_Pointer;
                            ^
../../../source/ps/XML/XeroXMB.h:290:15: warning: private field 'm_Pointer' is not used [-Wunused-private-field]
                const char* m_Pointer;
                            ^


==== Building atlas (release) ====

In file included from ../../../source/tools/atlas/GameInterface/Handlers/MiscHandlers.cpp:28:
In file included from ../../../source/gui/GUI.h:51:
../../../source/gui/IGUITextOwner.h:67:15: warning: 'HandleMessage' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void HandleMessage(SGUIMessage& Message);
                     ^
../../../source/gui/IGUIObject.h:291:15: note: overridden virtual function is here
        virtual void HandleMessage(SGUIMessage& UNUSED(Message)) {}
                     ^
In file included from ../../../source/tools/atlas/GameInterface/Handlers/MiscHandlers.cpp:28:
In file included from ../../../source/gui/GUI.h:51:
../../../source/gui/IGUITextOwner.h:72:15: warning: 'UpdateCachedSize' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void UpdateCachedSize();
                     ^
../../../source/gui/IGUIObject.h:207:15: note: overridden virtual function is here
        virtual void UpdateCachedSize();
                     ^
In file included from ../../../source/tools/atlas/GameInterface/Handlers/MiscHandlers.cpp:28:
In file included from ../../../source/gui/GUI.h:51:
../../../source/gui/IGUITextOwner.h:89:15: warning: 'MouseOverIcon' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual bool MouseOverIcon();
                     ^
../../../source/gui/IGUIObject.h:129:15: note: overridden virtual function is here
        virtual bool MouseOverIcon();
                     ^

==== Building gui (release) ====
In file included from ../../../source/pch/gui/precompiled.h:28:
In file included from ../../../source/gui/GUI.h:51:
../../../source/gui/IGUITextOwner.h:67:15: warning: 'HandleMessage' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void HandleMessage(SGUIMessage& Message);
                     ^
../../../source/gui/IGUIObject.h:291:15: note: overridden virtual function is here
        virtual void HandleMessage(SGUIMessage& UNUSED(Message)) {}
                     ^
In file included from ../../../source/pch/gui/precompiled.h:28:
In file included from ../../../source/gui/GUI.h:51:
../../../source/gui/IGUITextOwner.h:72:15: warning: 'UpdateCachedSize' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual void UpdateCachedSize();
                     ^
../../../source/gui/IGUIObject.h:207:15: note: overridden virtual function is here
        virtual void UpdateCachedSize();
                     ^
In file included from ../../../source/pch/gui/precompiled.h:28:
In file included from ../../../source/gui/GUI.h:51:
../../../source/gui/IGUITextOwner.h:89:15: warning: 'MouseOverIcon' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
        virtual bool MouseOverIcon();
                     ^
../../../source/gui/IGUIObject.h:129:15: note: overridden virtual function is here
        virtual bool MouseOverIcon();
                     ^

==== Building lowlevel (release) ====
../../../source/lib/res/h_mgr.cpp:99:18: warning: unused variable 'TAG_MASK' [-Wunused-const-variable]
static const u64 TAG_MASK = 0xFFFFFFFF; // safer than (1 << 32) - 1
                 ^
../../../source/lib/res/h_mgr.cpp:114:19: warning: unused function 'h_tag' [-Wunused-function]
static inline Tag h_tag(Handle h)
                  ^
…

../../../source/lib/sysdep/os/osx/osx.cpp:91:7: warning: comparison of function 'CGDisplayCopyDisplayMode' not equal to a null pointer is always true [-Wtautological-pointer-compare]
                if (CGDisplayCopyDisplayMode != NULL)
                    ^~~~~~~~~~~~~~~~~~~~~~~~    ~~~~
../../../source/lib/sysdep/os/osx/osx.cpp:91:7: note: prefix with the address-of operator to silence this warning
                if (CGDisplayCopyDisplayMode != NULL)
                    ^
                    &
../../../source/lib/sysdep/os/osx/osx.cpp:122:7: warning: comparison of function 'CGDisplayCopyDisplayMode' not equal to a null pointer is always true
      [-Wtautological-pointer-compare]
                if (CGDisplayCopyDisplayMode != NULL)
                    ^~~~~~~~~~~~~~~~~~~~~~~~    ~~~~
../../../source/lib/sysdep/os/osx/osx.cpp:122:7: note: prefix with the address-of operator to silence this warning
                if (CGDisplayCopyDisplayMode != NULL)
                    ^
                    &
…
../../../source/lib/sysdep/os/unix/unix.cpp:66:67: warning: unused parameter 'text' [-Wunused-parameter]
static ErrorReactionInternal try_gui_display_error(const wchar_t* text, bool manual_break, bool allow_suppress, bool no_continue)
                                                                  ^
../../../source/lib/sysdep/os/unix/unix.cpp:66:78: warning: unused parameter 'manual_break' [-Wunused-parameter]
static ErrorReactionInternal try_gui_display_error(const wchar_t* text, bool manual_break, bool allow_suppress, bool no_continue)
                                                                             ^
../../../source/lib/sysdep/os/unix/unix.cpp:66:97: warning: unused parameter 'allow_suppress' [-Wunused-parameter]
static ErrorReactionInternal try_gui_display_error(const wchar_t* text, bool manual_break, bool allow_suppress, bool no_continue)
                                                                                                ^
../../../source/lib/sysdep/os/unix/unix.cpp:66:118: warning: unused parameter 'no_continue' [-Wunused-parameter]
static ErrorReactionInternal try_gui_display_error(const wchar_t* text, bool manual_break, bool allow_suppress, bool no_continue)
                                                                                                                     ^

Attachments (1)

errors.txt (988.3 KB ) - added by Stan 2 years ago.
Errors On Monterey

Download all attachments as: .zip

Change History (16)

comment:1 by Krinkle, 5 years ago

The IGUITextOwner warnings about overrides should be fixed as of r22602.

The glooxwrapper warnings about m_Owned were being worked on as part of r22514 (phab:D2093), but hasn't fixed this warning it seems. There is also phab:D2094 which hasn't landed yet but might fix it once it lands.

comment:2 by elexis, 5 years ago

In 22678:

Fix unreported glooxwrapper leaks following rP19703, refs #2305.

Fixes an occurring leak indicated by the reported clang unused variable compiler warning, refs #5294, #5550,
by adding the missing glooxwrapper::Jingle::Session::Session destructor .

Fix two leaks that would have occurred if the according code had been used:
Delete unused glooxwrapper::Jingle::ICEUDP::ICEUDP instead of adding the missing destructor.
Delete unused glooxwrapper::Jingle::Content::Content instead of adding the missing destructor.

Explain why glooxwrapper::Client::registerStanzaExtension doesn't leak the new StanzaExtensionWrapper.
Explain why glooxwrapper::Jingle::Session::sessionInitiate doesn't leak the new gloox::Jingle::Content, nor the new gloox::Jingle::ICEUDP.
Explain why glooxwrapper::SessionManager::registerPlugins doesn't leak the new gloox::Jingle::Content and new gloox::Jingle::ICEUDP.
Explain why glooxwrapper::SessionManager::createSession doesn't leak the gloox::Jingle::Session.

I will not leak memory in the glooxwrapper.
I will not leak memory in the glooxwrapper.
I will not leak memory in the glooxwrapper.

Use references in the StunClient and glooxwrapper to anticipate any confusion as to whose obligation it is to delete variables when they are passed around across several files.
Use static_cast and reinterpret_cast instead of C-style casts in the StunClient.

Differential Revision: https://code.wildfiregames.com/D2094
Refs D2093 for the reported leaks.
Reviewed By: Josh
Comments By: fcxSanya, Vladislav for D2094, and echotangoecho, leper in rP19703

comment:3 by elexis, 5 years ago

In 22764:

Fix unused glooxwrapper variable following rP19703, refs #2305, #5294, #5550.

The class didn't leak the m_Wrapped gloox Jingle for this program since it's not set to owned, and it's not set to owned because gloox deletes it.
It would have leaked if some other app would have used glooxwrapper with owned = true, if gloox has a situation for that.

Differential Revision: https://code.wildfiregames.com/D2090

comment:4 by Krinkle, 4 years ago

Summary: Compiler warnings from LLVM 10 on macOS as of r22600Compiler warnings as of Aug 2019 (macOS, LLVM 10)

comment:5 by Krinkle, 4 years ago

Most of these have been fixed. There's two errors from Aug 2019 that are still in the build for latest trunk today (r23566):

Short version

==== Building engine (release) ====
../../../source/ps/XML/XeroXMB.h:214:15: warning: private field 'm_Pointer' is not used [-Wunused-private-field]
                const char* m_Pointer;
                            ^
../../../source/ps/XML/XeroXMB.h:283:15: warning: private field 'm_Pointer' is not used [-Wunused-private-field]
                const char* m_Pointer;


==== Building lowlevel (release) ====

../../../source/lib/sysdep/os/osx/osx.cpp:91:7: warning: comparison of function 'CGDisplayCopyDisplayMode' not equal to a null pointer is always true
      [-Wtautological-pointer-compare]
                if (CGDisplayCopyDisplayMode != NULL)
                    ^~~~~~~~~~~~~~~~~~~~~~~~    ~~~~
../../../source/lib/sysdep/os/osx/osx.cpp:91:7: note: prefix with the address-of operator to silence this warning
                if (CGDisplayCopyDisplayMode != NULL)
                    ^
                    &
../../../source/lib/sysdep/os/osx/osx.cpp:122:7: warning: comparison of function 'CGDisplayCopyDisplayMode' not equal to a null pointer is always true
      [-Wtautological-pointer-compare]
                if (CGDisplayCopyDisplayMode != NULL)
                    ^~~~~~~~~~~~~~~~~~~~~~~~    ~~~~
../../../source/lib/sysdep/os/osx/osx.cpp:122:7: note: prefix with the address-of operator to silence this warning
                if (CGDisplayCopyDisplayMode != NULL)
                    ^
                    &

comment:6 by Stan, 3 years ago

Owner: set to Stan
Patch: Phab:D3177

comment:7 by Stan, 3 years ago

In 24487:

Fix most Clang 10 Warnings

Refs: #5550, #5294

Remove dead code from Phab:rP16704
Fix buggy code from Phab:rP15909
Comments by: @wraitii, @vladislavbelov

Differential Revision: https://code.wildfiregames.com/D3177

comment:8 by Stan, 3 years ago

Most of the warnings were fixed. I'm pushing it to A25 as a default ticket for all clang related warnings :)

comment:9 by Stan, 3 years ago

Milestone: Alpha 24Alpha 25

comment:10 by Stan, 3 years ago

../../../source/ps/XMB/XMBStorage.cpp:132:42: warning: loop variable 'n' has type 'const std::pair<std::string, int> &' (aka 'const pair<basic_string<char>, int> &') but is initialized with type 'const std::pair<const std::__cxx11::basic_string<char>, int>' resulting in a copy [-Wrange-loop-construct]
        for (const std::pair<std::string, int>& n : names)
                                                ^
../../../source/ps/XMB/XMBStorage.cpp:132:7: note: use non-reference type 'std::pair<std::string, int>' (aka 'pair<basic_string<char>, int>') to keep the copy or type 'const std::pair<const std::__cxx11::basic_string<char>, int> &' to prevent copying
        for (const std::pair<std::string, int>& n : names)
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../source/ps/XMB/XMBStorage.cpp:184:41: warning: loop variable 'attr' of type 'const std::pair<u32, std::string>' (aka 'const pair<unsigned int, basic_string<char> >') creates a copy from type 'const std::pair<u32, std::string>' [-Wrange-loop-construct]
        for (const std::pair<u32, std::string> attr : data.m_Attributes)
                                               ^
../../../source/ps/XMB/XMBStorage.cpp:184:7: note: use reference type 'const std::pair<u32, std::string> &' (aka 'const pair<unsigned int, basic_string<char> > &') to prevent copying
        for (const std::pair<u32, std::string> attr : data.m_Attributes)
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                               &
2 warnings generated.
../../../source/renderer/TerrainRenderer.cpp:396:4: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
                        m->fancyWaterShader = g_Renderer.GetShaderManager().LoadProgram("glsl/water_high", defines);
                        ^
../../../source/renderer/TerrainRenderer.cpp:389:3: note: previous statement is here
                if (WaterMgr->m_WaterReflection)
                ^
1 warning generated.
In file included from ../../../source/pch/gui/precompiled.h:27:
In file included from ../../../source/gui/ObjectBases/IGUIObject.h:29:
../../../source/gui/SettingTypes/CGUIHotkey.h:37:2: warning: explicitly defaulted move assignment operator is implicitly deleted [-Wdefaulted-function-deleted]
        MOVABLE(CGUIHotkey);
        ^
../../../source/lib/code_annotation.h:237:13: note: expanded from macro 'MOVABLE'
        className& operator=(className&&) = default
                   ^
../../../source/gui/SettingTypes/CGUIHotkey.h:31:20: note: move assignment operator of 'CGUIHotkey' is implicitly deleted because base class 'CGUISimpleSetting<CStr8>' has a deleted move assignment operator
class CGUIHotkey : public CGUISimpleSetting<CStr>
                   ^
../../../source/gui/CGUISetting.h:91:2: note: 'operator=' has been explicitly marked deleted here
        NONCOPYABLE(CGUISimpleSetting);
        ^
../../../source/lib/code_annotation.h:229:13: note: expanded from macro 'NONCOPYABLE'
        className& operator=(const className&) = delete
                   ^
1 warning generated.
In file included from ../../../source/gui/GUIObjectTypes.cpp:30:
../../../source/gui/ObjectTypes/COList.h:36:2: warning: explicitly defaulted move assignment operator is implicitly deleted [-Wdefaulted-function-deleted]
        MOVABLE(COListColumn);
        ^
../../../source/lib/code_annotation.h:237:13: note: expanded from macro 'MOVABLE'
        className& operator=(className&&) = default
                   ^
../../../source/gui/ObjectTypes/COList.h:41:30: note: move assignment operator of 'COListColumn' is implicitly deleted because field 'm_List' has a deleted move assignment operator
        CGUISimpleSetting<CGUIList> m_List;
                                    ^
../../../source/gui/CGUISetting.h:91:2: note: 'operator=' has been explicitly marked deleted here
        NONCOPYABLE(CGUISimpleSetting);
        ^
../../../source/lib/code_annotation.h:229:13: note: expanded from macro 'NONCOPYABLE'
        className& operator=(const className&) = delete
                   ^
1 warning generated.
In file included from ../../../source/gui/ObjectTypes/COList.cpp:20:
../../../source/gui/ObjectTypes/COList.h:36:2: warning: explicitly defaulted move assignment operator is implicitly deleted [-Wdefaulted-function-deleted]
        MOVABLE(COListColumn);
        ^
../../../source/lib/code_annotation.h:237:13: note: expanded from macro 'MOVABLE'
        className& operator=(className&&) = default
                   ^
../../../source/gui/ObjectTypes/COList.h:41:30: note: move assignment operator of 'COListColumn' is implicitly deleted because field 'm_List' has a deleted move assignment operator
        CGUISimpleSetting<CGUIList> m_List;
                                    ^
../../../source/gui/CGUISetting.h:91:2: note: 'operator=' has been explicitly marked deleted here
        NONCOPYABLE(CGUISimpleSetting);
        ^
../../../source/lib/code_annotation.h:229:13: note: expanded from macro 'NONCOPYABLE'
        className& operator=(const className&) = delete
                   ^

comment:11 by wraitii, 3 years ago

Milestone: Alpha 25Alpha 26

comment:12 by Stan, 2 years ago

In 26370:

Fixes two clang warnings.
Refs #5550 #5294

comment:13 by Freagarach, 2 years ago

Milestone: Alpha 26Alpha 27

comment:14 by Stan, 2 years ago

Summary: Compiler warnings as of Aug 2019 (macOS, LLVM 10)Compiler warnings as of May 2022 (macOS, LLVM 10)

by Stan, 2 years ago

Attachment: errors.txt added

Errors On Monterey

comment:15 by Freagarach, 16 months ago

Milestone: Alpha 27Backlog

Pushing back.

Note: See TracTickets for help on using tickets.