Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce <botan/boost_compat.h> as feature flag #3765

Merged
merged 2 commits into from
Oct 26, 2023
Merged

Conversation

reneme
Copy link
Collaborator

@reneme reneme commented Oct 18, 2023

This introduces #include <botan/boost_compat.h> that defines BOTAN_MINIMUM_SUPPORTED_BOOST_VERSION as the minimum version of boost to be usable by this version of Botan. If the available boost headers are new enough, BOTAN_FOUND_COMPATIBLE_BOOST_VERSION is defined as well. In this case, it is safe to #include <botan/asio_stream.h>, otherwise a macro-error would be generated.

Usage example:

#include <botan/boost_compat.h>

#if defined(BOTAN_FOUND_COMPATIBLE_BOOST_VERSION)
#include <botan/asio_stream.h>
// profit...
#else
// fallback...
#endif

@coveralls
Copy link

Coverage Status

coverage: 91.718%. remained the same when pulling 8eaa184 on fix/asio_compat into 0981814 on master.

@reneme reneme requested review from randombit and lieser October 24, 2023 08:51
src/tests/unit_asio_stream.cpp Outdated Show resolved Hide resolved
src/lib/utils/boost/boost_compat.h Outdated Show resolved Hide resolved
@lieser lieser added the enhancement Enhancement or new feature label Oct 24, 2023
@lieser lieser added this to the Botan 3.3.0 milestone Oct 24, 2023
Copy link
Owner

@randombit randombit left a comment

Choose a reason for hiding this comment

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

Left a couple of minor comments (and I concur on the comments @lieser left) but basically LGTM.

Can you please amend the relevant docs/examples?

* as of Botan 3.3.0
* 1.73.0 - first version supporting the C++20 concepts syntax
*/
#define BOTAN_MINIMUM_SUPPORTED_BOOST_VERSION 107300
Copy link
Owner

Choose a reason for hiding this comment

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

This comment should be clarified that it only applies to the asio integrations; we can still use older Boost for eg socket wrappers.

@reneme
Copy link
Collaborator Author

reneme commented Oct 25, 2023

I applied the suggestions, extended src/examples/tls_stream_client.cpp and added a note about BOTAN_FOUND_COMPATIBLE_BOOST_VERSION in the documentation.

@reneme reneme merged commit fa143ad into master Oct 26, 2023
@reneme reneme deleted the fix/asio_compat branch October 26, 2023 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants