Skip to content

Commit

Permalink
Removed BOOST_BEAST_USE_STD_STRING_VIEW (#2451)
Browse files Browse the repository at this point in the history
Fixes #2363
  • Loading branch information
sehe authored Oct 3, 2022
1 parent 12c2d14 commit 7300ef4
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 35 deletions.
6 changes: 3 additions & 3 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ def main(ctx):
linux_cxx("clang 6.0 libc++", "clang++-6.0", packages="clang-6.0 libc6-dbg libc++-dev libstdc++-8-dev libc++abi-dev", llvm_os="bionic", llvm_ver="6.0", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang', 'COMPILER': 'clang++-6.0', 'B2_CXXSTD': '11,14', 'B2_STDLIB': 'libc++', 'DRONE_JOB_UUID': 'b3f0c7f6bb'}, globalenv=globalenv),
osx_cxx("clang", "g++", packages="", buildtype="boost", buildscript="drone", environment={'B2_TOOLSET': 'clang', 'B2_CXXSTD': '11,17', 'DRONE_JOB_UUID': '91032ad7bb'}, globalenv=globalenv),
linux_cxx("coverity", "g++", packages="", buildtype="coverity", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'Coverity Scan', 'B2_TOOLSET': 'clang', 'DRONE_JOB_UUID': '472b07b9fc'}, globalenv=globalenv),
windows_cxx("msvc-14.1", "", image="cppalliance/dronevs2017", buildtype="boost", buildscript="drone", environment={ "VARIANT": "release", "TOOLSET": "msvc-14.1", "CXXSTD": "17", "DEFINE" : "BOOST_BEAST_USE_STD_STRING_VIEW", "ADDRESS_MODEL": "64"}),
windows_cxx("msvc-14.2", "", image="cppalliance/dronevs2019", buildtype="boost", buildscript="drone", environment={ "VARIANT": "release", "TOOLSET": "msvc-14.2", "CXXSTD": "17", "DEFINE" : "BOOST_BEAST_USE_STD_STRING_VIEW", "ADDRESS_MODEL": "64"}),
windows_cxx("msvc-14.3", "", image="cppalliance/dronevs2022:1", buildtype="boost", buildscript="drone", environment={ "VARIANT": "release", "TOOLSET": "msvc-14.3", "CXXSTD": "20", "DEFINE" : "BOOST_BEAST_USE_STD_STRING_VIEW", "ADDRESS_MODEL": "64"}),
windows_cxx("msvc-14.1", "", image="cppalliance/dronevs2017", buildtype="boost", buildscript="drone", environment={ "VARIANT": "release", "TOOLSET": "msvc-14.1", "CXXSTD": "17", "ADDRESS_MODEL": "64"}),
windows_cxx("msvc-14.2", "", image="cppalliance/dronevs2019", buildtype="boost", buildscript="drone", environment={ "VARIANT": "release", "TOOLSET": "msvc-14.2", "CXXSTD": "17", "ADDRESS_MODEL": "64"}),
windows_cxx("msvc-14.3", "", image="cppalliance/dronevs2022:1", buildtype="boost", buildscript="drone", environment={ "VARIANT": "release", "TOOLSET": "msvc-14.3", "CXXSTD": "20", "ADDRESS_MODEL": "64"}),
]

# from https://github.com/boostorg/boost-ci
Expand Down
8 changes: 5 additions & 3 deletions .drone/drone.bat
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@ b2 headers

echo "============> SCRIPT"

IF DEFINED DEFINE SET B2_DEFINE="define=%DEFINE%"

echo "Running tests"
b2 --debug-configuration variant=%VARIANT% cxxstd=%CXXSTD% define=%DEFINE% address-model=%ADDRESS_MODEL% toolset=%TOOLSET% --verbose-test libs/beast/test -j3
b2 --debug-configuration variant=%VARIANT% cxxstd=%CXXSTD% %B2_DEFINE% address-model=%ADDRESS_MODEL% toolset=%TOOLSET% --verbose-test libs/beast/test -j3
if !errorlevel! neq 0 exit /b !errorlevel!

echo "Running libs/beast/example"
b2 --debug-configuration variant=%VARIANT% cxxstd=%CXXSTD% define=%DEFINE% address-model=%ADDRESS_MODEL% toolset=%TOOLSET% libs/beast/example -j3
b2 --debug-configuration variant=%VARIANT% cxxstd=%CXXSTD% %B2_DEFINE% address-model=%ADDRESS_MODEL% toolset=%TOOLSET% libs/beast/example -j3
if !errorlevel! neq 0 exit /b !errorlevel!

echo "Running run-fat-tests"
b2 --debug-configuration variant=%VARIANT% cxxstd=%CXXSTD% define=%DEFINE% address-model=%ADDRESS_MODEL% toolset=%TOOLSET% --verbose-test libs/beast/test//run-fat-tests -j3
b2 --debug-configuration variant=%VARIANT% cxxstd=%CXXSTD% %B2_DEFINE% address-model=%ADDRESS_MODEL% toolset=%TOOLSET% --verbose-test libs/beast/test//run-fat-tests -j3
if !errorlevel! neq 0 exit /b !errorlevel!

echo "============> COMPLETED"
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Version 339:

* BOOST_BEAST_USE_STD_STRING_VIEW is replaced by boost/core string_view.
* defining BOOST_BEAST_USE_STD_STRING_VIEW yields a deprecation warning

--------------------------------------------------------------------------------


Version 338:

* Added per message compression options.
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ build: off
test_script:
- b2 --debug-configuration variant=release cxxstd=14 address-model=64 toolset=msvc-14.0 libs/beast/example -j3
- b2 --debug-configuration variant=release cxxstd=14 address-model=64 toolset=msvc-14.0 --verbose-test libs/beast/test//run-fat-tests -j3
- b2 --debug-configuration variant=release cxxstd=17 define="BOOST_BEAST_USE_STD_STRING_VIEW" address-model=64 toolset=msvc-14.1 libs/beast/example -j3
- b2 --debug-configuration variant=release cxxstd=17 define="BOOST_BEAST_USE_STD_STRING_VIEW" address-model=64 toolset=msvc-14.1 --verbose-test libs/beast/test//run-fat-tests -j3
- b2 --debug-configuration variant=release cxxstd=17 address-model=64 toolset=msvc-14.1 libs/beast/example -j3
- b2 --debug-configuration variant=release cxxstd=17 address-model=64 toolset=msvc-14.1 --verbose-test libs/beast/test//run-fat-tests -j3

cache:
- c:\tools\vcpkg\installed\
4 changes: 0 additions & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ jobs:
CXX: g++-9
PACKAGES: g++-9
VARIANT: release
B2_FLAGS: <define>BOOST_BEAST_USE_STD_STRING_VIEW
CXXSTD: 17
B2_TARGETS: libs/beast/test//run-fat-tests libs/beast/example
GCC 9 C++11 HEADER_ONLY NO_DEPRECATED:
Expand Down Expand Up @@ -86,7 +85,6 @@ jobs:
CXX: g++-8
PACKAGES: g++-8
VARIANT: release
B2_FLAGS: <define>BOOST_BEAST_USE_STD_STRING_VIEW
CXXSTD: 17
B2_TARGETS: libs/beast/test//run-fat-tests libs/beast/example
GCC 8 C++11 HEADER_ONLY NO_DEPRECATED:
Expand Down Expand Up @@ -303,13 +301,11 @@ jobs:
MSVC14.2 C++17 x64:
VM_IMAGE: 'windows-2019'
TOOLSET: msvc-14.2
B2_FLAGS: define=BOOST_BEAST_USE_STD_STRING_VIEW
CXXSTD: 17
ADDRMODEL: 64
MSVC14.1 C++17 x64:
VM_IMAGE: 'vs2017-win2016'
TOOLSET: msvc-14.1
B2_FLAGS: define=BOOST_BEAST_USE_STD_STRING_VIEW
CXXSTD: 17
ADDRMODEL: 64
MSVC14.0 C++11 x64:
Expand Down
8 changes: 0 additions & 8 deletions doc/qbk/03_core/8_conf_macros.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ failure to do so may result in violations of ODR (One Definition Rule).

[table Special Fields
[[Definition][Description]]
[
[
BOOST_BEAST_USE_STD_STRING_VIEW
][
Causes Beast to use std::string_view instead of boost::string_view.
Requires C++17.
]
]
[
[
BOOST_BEAST_SEPARATE_COMPILATION
Expand Down
1 change: 1 addition & 0 deletions doc/qbk/release_notes.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

[*Miscellaneous]

* [issue 2363] Remove `BOOST_BEAST_USE_STD_STRING_VIEW`
* [issue 2417] use boost::core::string_view. This improves inter-conversion between string_view implementations. Some observable differences for users:
* `core::string_view` no longer supports the `.to_string()` or `.clear()` extensions from Utility
* code that relied on `.max_size()` returning `.size(),` needs to be fixed to use `.size()` instead
Expand Down
20 changes: 5 additions & 15 deletions include/boost/beast/core/string_type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,22 @@

#include <boost/beast/core/detail/config.hpp>

#if defined(BOOST_BEAST_USE_STD_STRING_VIEW)
#include <string_view>
#else
#include <boost/core/detail/string_view.hpp>
#if defined(BOOST_BEAST_USE_STD_STRING_VIEW)
#include <boost/config/pragma_message.hpp>
BOOST_PRAGMA_MESSAGE("BOOST_BEAST_USE_STD_STRING_VIEW is deprecated, use BOOST_NO_CXX17_HDR_STRING_VIEW instead");
#endif

namespace boost {
namespace beast {

#if BOOST_BEAST_DOXYGEN || ! defined(BOOST_BEAST_USE_STD_STRING_VIEW)
/// The type of string view used by the library
using string_view = boost::core::string_view;

/// The type of `basic_string_view` used by the library
template<class CharT, class Traits>
template<class CharT>
using basic_string_view =
boost::basic_string_view<CharT, Traits>;

#else
using string_view = std::string_view;

template<class CharT, class Traits>
using basic_string_view =
std::basic_string_view<CharT, Traits>;

#endif
boost::core::basic_string_view<CharT>;

template<class S>
inline string_view
Expand Down

0 comments on commit 7300ef4

Please sign in to comment.