[CODE HEALTH] Fix remaining misc-override-with-different-visibility warnings#4280
Merged
marcalff merged 3 commits intoJul 24, 2026
Merged
Conversation
thc1006
force-pushed
the
codehealth/override-visibility-4195-part2
branch
2 times, most recently
from
July 23, 2026 19:59
3ad6530 to
1fa7c53
Compare
…arnings Align the visibility of the SocketCallback and Thread virtual overrides in the ext/http embedded server to match their inheritance-adjusted base visibility, resolving the 5 misc-override-with-different-visibility warnings that open-telemetry#4215 deferred: - HttpServer privately inherits SocketCallback (an implementation-detail base), so its onSocketAcceptable, onSocketReadable, onSocketWritable and onSocketClosed overrides move from protected to private. - Reactor inherits Thread as protected, so its onThread override moves from public to protected. These overrides are dispatched only through their base interfaces (SocketCallback& and Thread::onThread), so no dynamic-dispatch call path changes. The change does narrow the source-level surface a derived class could reach (for example calling the base implementation), but HttpServer is extended through its public request-handler API rather than by overriding the reactor callbacks, so this is consistent with the deliberate private inheritance. The unrelated protected sendMore() helper keeps its visibility. Lower the clang-tidy warning_limit to 158/168 accordingly. Fixes open-telemetry#4195. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
thc1006
force-pushed
the
codehealth/override-visibility-4195-part2
branch
from
July 23, 2026 20:17
1fa7c53 to
8c52d30
Compare
This was referenced Jul 23, 2026
Open
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4280 +/- ##
=======================================
Coverage 81.31% 81.31%
=======================================
Files 445 445
Lines 18859 18859
=======================================
Hits 15333 15333
Misses 3526 3526
🚀 New features to boost your workflow:
|
marcalff
approved these changes
Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Completes #4195 by resolving the 5
misc-override-with-different-visibilitywarnings that #4215 deferred, all in theext/httpembedded server. Each override had wider visibility than its inheritance-adjusted base:HttpServerprivately inheritsSocketCallback, so itsonSocketAcceptable,onSocketReadable,onSocketWritableandonSocketClosedoverrides are aligned fromprotectedtoprivate.ReactorinheritsThreadasprotected, so itsonThreadoverride is aligned frompublictoprotected.Scope and compatibility
These overrides are dispatched only through their base interfaces (
SocketCallback&andThread::onThread), so no dynamic-dispatch call path changes. The change does narrow the source-level surface a derived class could reach (for example, calling the base implementation from a subclass) in these installed headers.I chose this direction because the private inheritance of
SocketCallbacklooks deliberate (the callbacks are HttpServer's internal reactor plumbing) and HttpServer is extended through its public request-handler API (e.g.operator[],setServerName) rather than by overriding the reactor callbacks;FileHttpServeris such a subclass and does not touch them. If maintainers would rather preserve that extension surface, two alternatives are: switchHttpServertoprotectedinheritance ofSocketCallback(keeps the callbacks protected but widens the base-conversion surface), orNOLINTthe four overrides. I am happy to take whichever direction you prefer.The unrelated
sendMore()helper keeps itsprotectedvisibility (an earlier revision narrowed it along with the section; that has been reverted).Verification
file_http_server.h, which pulls inhttp_server.handsocket_tools.h, theFileHttpServersubclass, and anHttpServerinstantiation, compiles cleanly.warning_limitlowered from 163/173 to 158/168. I will confirm from the clang-tidy report artifacts thatmisc-override-with-different-visibilityreaches 0 and the totals match before treating this as ready.