Skip to content

Modify deprecation macro - #2429

Open
shariarriday wants to merge 3 commits into
mainfrom
topic/shariarriday/io-deprecation-fix
Open

Modify deprecation macro#2429
shariarriday wants to merge 3 commits into
mainfrom
topic/shariarriday/io-deprecation-fix

Conversation

@shariarriday

@shariarriday shariarriday commented Jun 19, 2026

Copy link
Copy Markdown
Member

Closes #2258.

@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.30%. Comparing base (5c29187) to head (2201035).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
libcaf_io/caf/io/network/multiplexer_base.cpp 44.44% 5 Missing ⚠️
libcaf_io/caf/io/network/multiplexer_base.hpp 73.68% 4 Missing and 1 partial ⚠️
libcaf_io/caf/io/abstract_broker.hpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2429      +/-   ##
==========================================
+ Coverage   73.29%   73.30%   +0.01%     
==========================================
  Files         645      645              
  Lines       30801    30839      +38     
  Branches     3381     3384       +3     
==========================================
+ Hits        22575    22608      +33     
- Misses       6315     6318       +3     
- Partials     1911     1913       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shariarriday
shariarriday marked this pull request as ready for review June 26, 2026 16:24
Copilot AI review requested due to automatic review settings June 26, 2026 16:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates CAF’s IO-network deprecation plumbing and related declarations to improve compatibility across compilers (notably MSVC) while also applying minor formatting and typo fixes.

Changes:

  • Adjust CAF_IO_NETWORK_DEPRECATED to use MSVC-specific deprecation syntax and reflow its comment.
  • Reformat several deprecated class declarations and split CAF_DEPRECATED annotations onto separate lines for inspect templates.
  • Minor maintenance: include reordering in some headers, fix a typo in a test comment, and extend typos config.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
libcaf_io/caf/io/network/stream.hpp Reformat deprecated class declaration to a single line.
libcaf_io/caf/io/network/stream_manager.hpp Reorder includes; reformat deprecated class declaration.
libcaf_io/caf/io/network/stream_impl.hpp Reorder includes (moves caf_deprecated.hpp below stream include).
libcaf_io/caf/io/network/scribe_impl.hpp Reformat deprecated class declaration to a single line.
libcaf_io/caf/io/network/operation.hpp Split CAF_DEPRECATED attribute from function signature for inspect.
libcaf_io/caf/io/network/native_socket.hpp Reformat invalid_native_socket constant to a single line.
libcaf_io/caf/io/network/multiplexer.hpp Reformat deprecated class declarations (including nested runnable).
libcaf_io/caf/io/network/manager.hpp Reformat deprecated class declaration to a single line.
libcaf_io/caf/io/network/ip_endpoint.hpp Split CAF_DEPRECATED attribute from function signature for inspect.
libcaf_io/caf/io/network/interfaces.hpp Reorder includes (moves caf_deprecated.hpp below other includes).
libcaf_io/caf/io/network/doorman_impl.hpp Reformat deprecated class declaration to a single line.
libcaf_io/caf/io/network/datagram_manager.hpp Reorder includes (moves caf_deprecated.hpp below other includes).
libcaf_io/caf/io/network/datagram_handler_impl.hpp Reorder includes (moves caf_deprecated.hpp below other includes).
libcaf_io/caf/io/network/acceptor.hpp Reformat deprecated class declaration to a single line.
libcaf_io/caf/io/network/acceptor_manager.hpp Reorder includes (moves caf_deprecated.hpp below other includes).
libcaf_io/caf/io/network/acceptor_impl.hpp Reorder includes (moves caf_deprecated.hpp below other includes).
libcaf_io/caf/detail/io_network_deprecated.hpp Add MSVC-specific deprecation attribute branch for CAF_IO_NETWORK_DEPRECATED.
libcaf_core/caf/metaprogramming.test.cpp Fix spelling in a comment (“incompatible”).
.typos-config.toml Add cpy to typos dictionary mappings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread libcaf_io/caf/detail/io_network_deprecated.hpp Outdated
@shariarriday
shariarriday requested a review from Neverlord June 26, 2026 16:34

@Neverlord Neverlord left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase/squash and file to main.

@shariarriday
shariarriday changed the base branch from issue/2258-deprecate-io-network to main July 6, 2026 17:01
@shariarriday
shariarriday force-pushed the topic/shariarriday/io-deprecation-fix branch 2 times, most recently from a7c6552 to 7e6e278 Compare July 6, 2026 17:50
@shariarriday
shariarriday requested a review from Neverlord July 7, 2026 14:16
Comment thread libcaf_io/caf/io/network/acceptor.cpp Outdated

@Neverlord Neverlord left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have dozens of repeated CAF_DEPRECATED("use caf.net instead") now. Since we are already introducing custom macros, why not have:

  • CAF_IO_NETWORK_DEPRECATED as alias for CAF_DEPRECATED("use caf.net instead")
  • CAF_IO_NETWORK_DEPRECATED_CLASS for the current implementation

Further, please find a better way than sprinkling #define CAF_SUPPRESS_DEPRECATION_WARNINGS across the code base. We already pass libcaf_${name}_EXPORTS to our targets to make the export macros work. Why not pass a flag at the target level for our unit tests plus libcaf_io and libcaf_openssl?

Suppressing deprecation warnings on all of our unit tests seems to be a good idea anyway.

Comment thread libcaf_io/caf/io/network/acceptor_impl.hpp Outdated
Comment thread libcaf_io/caf/io/network/acceptor.hpp Outdated
Comment thread libcaf_io/caf/io/network/acceptor_impl.hpp Outdated
Comment thread libcaf_io/caf/io/network/acceptor_manager.hpp Outdated
Comment thread libcaf_io/caf/io/network/datagram_handler.hpp Outdated
Comment thread libcaf_io/caf/io/network/stream.hpp Outdated
Comment thread libcaf_io/caf/io/network/stream_impl.hpp Outdated
Comment thread libcaf_io/caf/io/network/stream_impl.hpp Outdated
Comment thread libcaf_io/caf/io/network/stream_manager.hpp Outdated
Comment thread CHANGELOG.md
@shariarriday
shariarriday force-pushed the topic/shariarriday/io-deprecation-fix branch 3 times, most recently from fbfaaf3 to 6712c97 Compare August 1, 2026 12:54
# define CAF_PUSH_DEPRECATED_WARNING \
__pragma(warning(push))
__pragma(warning(push)) \
__pragma(warning(disable: 4996))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not related to deprecation, but it disables MSVC deprecation warning. Previously, it was missing.

@shariarriday
shariarriday force-pushed the topic/shariarriday/io-deprecation-fix branch 2 times, most recently from 3ec8e43 to 3c44be9 Compare August 1, 2026 14:41
@shariarriday
shariarriday requested a review from Neverlord August 1, 2026 15:01
Comment thread examples/CMakeLists.txt Outdated
Comment on lines +65 to +67
# The legacy I/O module is deprecated as a whole, so its examples cannot
# avoid naming deprecated APIs.
caf_silence_deprecation_warnings(${name})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not true, the I/O module is not deprecated. We are deprecating things inside caf::io::network, not the entire module.

Suggested change
# The legacy I/O module is deprecated as a whole, so its examples cannot
# avoid naming deprecated APIs.
caf_silence_deprecation_warnings(${name})

The examples have to pass without any warnings. The namespace caf::io::network only contains utilities that are mostly intended for internal use. This set of utilities is now covered (better) by things in caf::net, that's the intend of the deprecation. There's probably very few (if any) users depending on caf::io::network directly. Existing code just using the regular caf/io/... headers must not suddenly start raising deprecation warnings.

After a quick glance, it looks like we need to un-deprecate these three classes:

  • caf::io::network::address_listing
  • caf::io::network::protocol
  • caf::io::network::receive_buffer

We pass them to CAF_ADD_TYPE_ID in caf/io/fwd.hpp, so we can't really avoid users pulling that in when using the I/O module. The examples run into deprecations warnings via caf/io/middleman.hpp pulling in caf/io/network/multiplexer.hpp.

See if you can hide the multiplexer (i.e., not include its header from the middleman). The supervisor could just go into its own header instead of being a nested type. The tricky part is probably spawn_client_impl and spawn_server_impl because they access backend(). Maybe we can add a new interface with the bare minimum needed by the middleman and then have the multiplexer inherit from that?

If there's no reasonable way to avoid pulling in the multiplexer header then we'll need to un-deprecate as much as necessary to get the public API headers building again without warnings.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made some changes in an attempt to deprecate the classes properly. It should not throw any deprecation warning if "caf/io/all.hpp" is called. But, warning will be thrown for io::network classes (Which are deprecated currently).

@shariarriday
shariarriday force-pushed the topic/shariarriday/io-deprecation-fix branch 2 times, most recently from 07a91dc to ec026af Compare August 12, 2026 20:07
@shariarriday
shariarriday force-pushed the topic/shariarriday/io-deprecation-fix branch from ec026af to 2201035 Compare August 12, 2026 20:34
@shariarriday
shariarriday requested a review from Neverlord August 13, 2026 16:38
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.

Deprecate caf::io::network utilities

3 participants