Skip to content

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

Merged
reneme merged 2 commits intomasterfrom
fix/asio_compat
Oct 26, 2023
Merged

Introduce <botan/boost_compat.h> as feature flag#3765
reneme merged 2 commits intomasterfrom
fix/asio_compat

Conversation

@reneme
Copy link
Copy Markdown
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
Copy Markdown

Coverage Status

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

@reneme reneme requested review from lieser and randombit October 24, 2023 08:51
@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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