Skip to content

sockets: add missing override keywords on CEMSocket-derived classes - #625

Merged
mrjimenez merged 1 commit into
amule-project:masterfrom
got3nks:fix/socket-classes-missing-override
May 15, 2026
Merged

sockets: add missing override keywords on CEMSocket-derived classes#625
mrjimenez merged 1 commit into
amule-project:masterfrom
got3nks:fix/socket-classes-missing-override

Conversation

@got3nks

@got3nks got3nks commented May 15, 2026

Copy link
Copy Markdown
Contributor

Summary

PR #615 added IsDownloadThrottled() override to CServerSocket. Clang's -Winconsistent-missing-override (enabled by default in -Wall on recent Clang) fires the moment any one method in a class uses override and others in the same class don't, so the older overrides in the class now produce warnings:

amule/src/ServerSocket.h:54-65: overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
amule/src/EMSocket.h:95:15: note: overridden virtual function is here

Reported by @Stoatwblr in #622 while compiling against libwx_gtk3u-3.2.so.0 on Ubuntu.

Fix

Add override to the six existing overrides in CServerSocket (OnClose, OnConnect, OnReceive, OnError, PacketReceived, SendPacket) and to the nine overrides in the structurally identical CClientTCPSocket (same CEMSocket parent, same set of virtuals plus OnSend, SendControlData, SendFileAndControlData).

Also drop the redundant virtual keyword on the derived SendPacket / SendControlData / SendFileAndControlData / PacketReceived in CClientTCPSocketoverride implies virtual, and keeping both is redundant.

Validation

macOS arm64 with Apple Clang: rebuilt amule target — -Winconsistent-missing-override no longer fires in either header. No behaviour change; this is purely a compiler-hint cleanup.

PR amule-project#615 added IsDownloadThrottled() with the override keyword on
CServerSocket. That made Clang's -Winconsistent-missing-override fire
on the existing CServerSocket overrides (OnClose / OnConnect /
OnReceive / OnError / PacketReceived / SendPacket) that were missing
the keyword. Reported by Stoatwblr on amule-project#622.

Add override to the affected six methods in CServerSocket, and apply
the same cleanup to CClientTCPSocket -- which has the identical
inheritance shape from CEMSocket and was one stray override keyword
away from triggering the same warning. Also drop the redundant
virtual keyword on the derived overrides (override implies virtual).

Build clean on macOS arm64; warning gone on the Linux build path
Stoatwblr was using.
@got3nks got3nks mentioned this pull request May 15, 2026
@Stoatwblr

Copy link
Copy Markdown

warnings gone, thanks

@mrjimenez
mrjimenez merged commit 3cb1953 into amule-project:master May 15, 2026
12 checks passed
@got3nks
got3nks deleted the fix/socket-classes-missing-override branch May 15, 2026 19:16
mrjimenez pushed a commit that referenced this pull request May 20, 2026
Both methods in UnitTestApp override virtuals on wxAppConsole / wxApp
(wx/app.h:103 and :303). Clang -Winconsistent-missing-override fires
because the sibling OnInit in the same class already has override.
Same pattern as #625 (ServerSocket.h / ClientTCPSocket.h cleanup):
just add override to the two declarations.

Reported by @Stoatwblr in #663.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants