From eaf60c819dcf8930b7c478c81da5aa000400ec7b Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Sat, 21 Oct 2023 10:49:58 +0300 Subject: [PATCH] Drop C++03 support (#66) --- .github/workflows/ci.yml | 8 ++--- CMakeLists.txt | 1 - include/boost/dll/alias.hpp | 7 ++-- include/boost/dll/config.hpp | 18 ---------- .../boost/dll/detail/aggressive_ptr_cast.hpp | 23 ++++++------ include/boost/dll/runtime_symbol_info.hpp | 2 +- meta/libraries.json | 2 +- test/Jamfile.v2 | 5 ++- test/appveyor.yml | 8 ++--- test/structures_tests.cpp | 35 +++++++++---------- 10 files changed, 45 insertions(+), 64 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f9624009..3cf0d8f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: matrix: include: - toolset: gcc-12 - cxxstd: "03,11,14,17,2a" + cxxstd: "11,14,17,2a" os: ubuntu-22.04 # UBSAN complains on vtables and fails. No ',undefined -fno-sanitize-recover=undefined' flags! cxxflags: "cxxflags=--coverage -fsanitize=address,leak -DBOOST_TRAVISCI_BUILD" @@ -39,10 +39,10 @@ jobs: ignore_coverage: "*/detail/pe_info.hpp */detail/macho_info.hpp */filesystem/src/*" - toolset: clang compiler: clang++-10 - cxxstd: "03,11,14,17,2a" + cxxstd: "11,14,17,2a" os: ubuntu-20.04 #- toolset: clang - # cxxstd: "03,11,14,17,2a" + # cxxstd: "11,14,17,2a" # os: macos-10.15 # cxxflags: "cxxflags=--coverage -DBOOST_TRAVISCI_BUILD" # linkflags: "linkflags=--coverage" @@ -138,7 +138,7 @@ jobs: addrmd: 32,64 os: windows-2019 - toolset: gcc - cxxstd: "03,11,14,17,2a" + cxxstd: "11,14,17,2a" addrmd: 64 os: windows-2019 diff --git a/CMakeLists.txt b/CMakeLists.txt index e6a0a138..25d59ffe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,6 @@ target_link_libraries(boost_dll Boost::predef Boost::smart_ptr Boost::spirit - Boost::static_assert Boost::system Boost::throw_exception Boost::type_index diff --git a/include/boost/dll/alias.hpp b/include/boost/dll/alias.hpp index 2a8bd90c..63c90ab7 100644 --- a/include/boost/dll/alias.hpp +++ b/include/boost/dll/alias.hpp @@ -9,7 +9,6 @@ #define BOOST_DLL_ALIAS_HPP #include -#include #include #include #include @@ -45,7 +44,7 @@ namespace boost { namespace dll { #define BOOST_DLL_SELECTANY __declspec(selectany) #define BOOST_DLL_SECTION(SectionName, Permissions) \ - BOOST_STATIC_ASSERT_MSG( \ + static_assert( \ sizeof(#SectionName) < 10, \ "Some platforms require section names to be at most 8 bytes" \ ); \ @@ -84,7 +83,7 @@ namespace boost { namespace dll { * \param Permissions Can be "read" or "write" (without quotes!). */ #define BOOST_DLL_SECTION(SectionName, Permissions) \ - BOOST_STATIC_ASSERT_MSG( \ + static_assert( \ sizeof(#SectionName) < 10, \ "Some platforms require section names to be at most 8 bytes" \ ); \ @@ -93,7 +92,7 @@ namespace boost { namespace dll { #else // #if !BOOST_OS_MACOS && !BOOST_OS_IOS #define BOOST_DLL_SECTION(SectionName, Permissions) \ - BOOST_STATIC_ASSERT_MSG( \ + static_assert( \ sizeof(#SectionName) < 10, \ "Some platforms require section names to be at most 8 bytes" \ ); \ diff --git a/include/boost/dll/config.hpp b/include/boost/dll/config.hpp index cce90ed2..0f7f02df 100644 --- a/include/boost/dll/config.hpp +++ b/include/boost/dll/config.hpp @@ -15,24 +15,6 @@ # pragma once #endif -#include -#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \ - defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) || \ - defined(BOOST_NO_CXX11_CONSTEXPR) || \ - defined(BOOST_NO_CXX11_NULLPTR) || \ - defined(BOOST_NO_CXX11_NOEXCEPT) || \ - defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || \ - defined(BOOST_NO_CXX11_FINAL) || \ - defined(BOOST_NO_CXX11_ALIGNOF) || \ - defined(BOOST_NO_CXX11_STATIC_ASSERT) || \ - defined(BOOST_NO_CXX11_SMART_PTR) || \ - defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) || \ - defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) - -BOOST_PRAGMA_MESSAGE("C++03 support is deprecated in Boost.DLL 1.82 and will be removed in Boost.DLL 1.84.") - -#endif - #ifdef BOOST_DLL_DOXYGEN /// Define this macro to make Boost.DLL use C++17's std::filesystem::path, std::system_error and std::error_code. #define BOOST_DLL_USE_STD_FS BOOST_DLL_USE_STD_FS diff --git a/include/boost/dll/detail/aggressive_ptr_cast.hpp b/include/boost/dll/detail/aggressive_ptr_cast.hpp index 2386d5da..e7cff4d4 100644 --- a/include/boost/dll/detail/aggressive_ptr_cast.hpp +++ b/include/boost/dll/detail/aggressive_ptr_cast.hpp @@ -15,7 +15,6 @@ #include #include -#include #include #include #include @@ -36,18 +35,18 @@ template BOOST_FORCEINLINE typename boost::disable_if_c::value || boost::is_reference::value || boost::is_member_pointer::value, To>::type aggressive_ptr_cast(From v) BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT_MSG( + static_assert( boost::is_pointer::value && boost::is_pointer::value, "`agressive_ptr_cast` function must be used only for pointer casting." ); - BOOST_STATIC_ASSERT_MSG( + static_assert( boost::is_void< typename boost::remove_pointer::type >::value || boost::is_void< typename boost::remove_pointer::type >::value, "`agressive_ptr_cast` function must be used only for casting to or from void pointers." ); - BOOST_STATIC_ASSERT_MSG( + static_assert( sizeof(v) == sizeof(To), "Pointer to function and pointer to object differ in size on your platform." ); @@ -64,17 +63,17 @@ template BOOST_FORCEINLINE typename boost::disable_if_c::value || boost::is_member_pointer::value, To>::type aggressive_ptr_cast(From v) BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT_MSG( + static_assert( boost::is_pointer::value, "`agressive_ptr_cast` function must be used only for pointer casting." ); - BOOST_STATIC_ASSERT_MSG( + static_assert( boost::is_void< typename boost::remove_pointer::type >::value, "`agressive_ptr_cast` function must be used only for casting to or from void pointers." ); - BOOST_STATIC_ASSERT_MSG( + static_assert( sizeof(v) == sizeof(typename boost::remove_reference::type*), "Pointer to function and pointer to object differ in size on your platform." ); @@ -93,12 +92,12 @@ template BOOST_FORCEINLINE typename boost::disable_if_c::value || boost::is_member_pointer::value, To>::type aggressive_ptr_cast(From v) BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT_MSG( + static_assert( boost::is_pointer::value, "`agressive_ptr_cast` function must be used only for pointer casting." ); - BOOST_STATIC_ASSERT_MSG( + static_assert( boost::is_void< typename boost::remove_pointer::type >::value, "`agressive_ptr_cast` function must be used only for casting to or from void pointers." ); @@ -112,17 +111,17 @@ template BOOST_FORCEINLINE typename boost::disable_if_c::value || !boost::is_member_pointer::value, To>::type aggressive_ptr_cast(From /* v */) BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT_MSG( + static_assert( boost::is_pointer::value, "`agressive_ptr_cast` function must be used only for pointer casting." ); - BOOST_STATIC_ASSERT_MSG( + static_assert( boost::is_void< typename boost::remove_pointer::type >::value, "`agressive_ptr_cast` function must be used only for casting to or from void pointers." ); - BOOST_STATIC_ASSERT_MSG( + static_assert( !sizeof(From), "Casting from member pointers to void pointer is not implemnted in `agressive_ptr_cast`." ); diff --git a/include/boost/dll/runtime_symbol_info.hpp b/include/boost/dll/runtime_symbol_info.hpp index 36ccad5f..f6fc4c80 100644 --- a/include/boost/dll/runtime_symbol_info.hpp +++ b/include/boost/dll/runtime_symbol_info.hpp @@ -54,7 +54,7 @@ namespace detail { */ template inline boost::dll::fs::path symbol_location_ptr(T ptr_to_symbol, boost::dll::fs::error_code& ec) { - BOOST_STATIC_ASSERT_MSG(boost::is_pointer::value, "boost::dll::symbol_location_ptr works only with pointers! `ptr_to_symbol` must be a pointer"); + static_assert(boost::is_pointer::value, "boost::dll::symbol_location_ptr works only with pointers! `ptr_to_symbol` must be a pointer"); boost::dll::fs::path ret; if (!ptr_to_symbol) { ec = boost::dll::fs::make_error_code( diff --git a/meta/libraries.json b/meta/libraries.json index 0c5202b9..58565012 100644 --- a/meta/libraries.json +++ b/meta/libraries.json @@ -12,5 +12,5 @@ "category": [ "System" ], - "cxxstd": "03" + "cxxstd": "11" } diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index d4229406..37897590 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -11,6 +11,8 @@ import testing ; import path ; +import ../../config/checks/config : requires ; + local RDYNAMIC = freebsd:"-rdynamic" solaris:"-Bdynamic" aix:"-rdynamic" qnxnto,qcc:"-Bdynamic" qnxnto,gcc:"-rdynamic" android:"-rdynamic" linux:"-rdynamic" darwin,gcc:"-dynamic" @@ -25,7 +27,8 @@ lib static_refcounting_plugin : ../example/tutorial8/refcounting_plugin.cpp : linux:"-ldl" gcc:"-Wall -Wextra -pedantic -Wno-long-long" diff --git a/test/appveyor.yml b/test/appveyor.yml index 736a2289..5a7b7492 100644 --- a/test/appveyor.yml +++ b/test/appveyor.yml @@ -61,19 +61,19 @@ environment: #- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 # ADDPATH: C:\cygwin\bin; # TOOLSET: gcc - # CXXSTD: 03,11,14,1z + # CXXSTD: 11,14,1z #- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 # ADDPATH: C:\cygwin64\bin; # TOOLSET: gcc - # CXXSTD: 03,11,14,1z + # CXXSTD: 11,14,1z - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 ADDPATH: C:\mingw\bin; TOOLSET: gcc - CXXSTD: 03,11,14,1z + CXXSTD: 11,14,1z - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 ADDPATH: C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin; TOOLSET: gcc - CXXSTD: 03,11,14,1z + CXXSTD: 11,14,1z before_build: - set BOOST_BRANCH=develop diff --git a/test/structures_tests.cpp b/test/structures_tests.cpp index 6cebf478..8b41580f 100644 --- a/test/structures_tests.cpp +++ b/test/structures_tests.cpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include @@ -41,7 +40,7 @@ inline std::size_t get_offset(const T1& v1, const T2& v2) { } #define CHECK_FIELD(Field) \ - BOOST_STATIC_ASSERT(sizeof(v1.Field) == sizeof(v2.Field)); \ + static_assert(sizeof(v1.Field) == sizeof(v2.Field), ""); \ BOOST_TEST(get_offset(v1, v1.Field) == get_offset(v2, v2.Field)) \ /**/ @@ -49,7 +48,7 @@ inline std::size_t get_offset(const T1& v1, const T2& v2) { // ELF structures template void elf_header_checks(const T1& v1, const T2& v2) { - BOOST_STATIC_ASSERT(sizeof(T1) == sizeof(T2)); + static_assert(sizeof(T1) == sizeof(T2), ""); CHECK_FIELD(e_ident); CHECK_FIELD(e_type); @@ -69,7 +68,7 @@ void elf_header_checks(const T1& v1, const T2& v2) { template void elf_sheader_checks(const T1& v1, const T2& v2) { - BOOST_STATIC_ASSERT(sizeof(T1) == sizeof(T2)); + static_assert(sizeof(T1) == sizeof(T2), ""); CHECK_FIELD(sh_name); CHECK_FIELD(sh_type); @@ -85,7 +84,7 @@ void elf_sheader_checks(const T1& v1, const T2& v2) { template void elf_sym_header_checks(const T1& v1, const T2& v2) { - BOOST_STATIC_ASSERT(sizeof(T1) == sizeof(T2)); + static_assert(sizeof(T1) == sizeof(T2), ""); CHECK_FIELD(st_name); CHECK_FIELD(st_value); @@ -99,7 +98,7 @@ void elf_sym_header_checks(const T1& v1, const T2& v2) { // PE structures template void generic_header_check(const T& v1, const dd::IMAGE_DOS_HEADER_& v2) { - BOOST_STATIC_ASSERT(sizeof(v1) == sizeof(v2)); + static_assert(sizeof(v1) == sizeof(v2), ""); CHECK_FIELD(e_magic); CHECK_FIELD(e_cblp); @@ -124,7 +123,7 @@ void generic_header_check(const T& v1, const dd::IMAGE_DOS_HEADER_& v2) { template void generic_header_check(const T& v1, const dd::IMAGE_FILE_HEADER_& v2) { - BOOST_STATIC_ASSERT(sizeof(v1) == sizeof(v2)); + static_assert(sizeof(v1) == sizeof(v2), ""); CHECK_FIELD(Machine); CHECK_FIELD(NumberOfSections); @@ -137,7 +136,7 @@ void generic_header_check(const T& v1, const dd::IMAGE_FILE_HEADER_& v2) { template void generic_header_check(const T& v1, const dd::IMAGE_DATA_DIRECTORY_& v2) { - BOOST_STATIC_ASSERT(sizeof(v1) == sizeof(v2)); + static_assert(sizeof(v1) == sizeof(v2), ""); CHECK_FIELD(VirtualAddress); CHECK_FIELD(Size); @@ -145,7 +144,7 @@ void generic_header_check(const T& v1, const dd::IMAGE_DATA_DIRECTORY_& v2) { template void generic_header_check(const T& v1, const dd::IMAGE_EXPORT_DIRECTORY_& v2) { - BOOST_STATIC_ASSERT(sizeof(v1) == sizeof(v2)); + static_assert(sizeof(v1) == sizeof(v2), ""); CHECK_FIELD(Characteristics); CHECK_FIELD(TimeDateStamp); @@ -163,7 +162,7 @@ void generic_header_check(const T& v1, const dd::IMAGE_EXPORT_DIRECTORY_& v2) { template void generic_header_check(const T& v1, const dd::IMAGE_SECTION_HEADER_& v2) { - BOOST_STATIC_ASSERT(sizeof(v1) == sizeof(v2)); + static_assert(sizeof(v1) == sizeof(v2), ""); CHECK_FIELD(Name); CHECK_FIELD(VirtualAddress); @@ -178,7 +177,7 @@ void generic_header_check(const T& v1, const dd::IMAGE_SECTION_HEADER_& v2) { template void generic_header_check(const T& v1, const dd::IMAGE_OPTIONAL_HEADER_template& v2) { - BOOST_STATIC_ASSERT(sizeof(v1) == sizeof(v2)); + static_assert(sizeof(v1) == sizeof(v2), ""); CHECK_FIELD(Magic); CHECK_FIELD(MajorLinkerVersion); @@ -213,7 +212,7 @@ void generic_header_check(const T& v1, const dd::IMAGE_OPTIONAL_HEADER_template< template void generic_header_check(const T& v1, const dd::IMAGE_NT_HEADERS_template& v2) { - BOOST_STATIC_ASSERT(sizeof(v1) == sizeof(v2)); + static_assert(sizeof(v1) == sizeof(v2), ""); CHECK_FIELD(Signature); CHECK_FIELD(FileHeader); @@ -221,7 +220,7 @@ void generic_header_check(const T& v1, const dd::IMAGE_NT_HEADERS_template void generic_header_check(const T& v1, const dd::mach_header_template& v2) { - BOOST_STATIC_ASSERT(sizeof(v1) == sizeof(v2)); + static_assert(sizeof(v1) == sizeof(v2), ""); CHECK_FIELD(magic); CHECK_FIELD(cputype); @@ -234,7 +233,7 @@ void generic_header_check(const T& v1, const dd::mach_header_template& v2 template void generic_header_check(const T& v1, const dd::segment_command_template& v2) { - BOOST_STATIC_ASSERT(sizeof(v1) == sizeof(v2)); + static_assert(sizeof(v1) == sizeof(v2), ""); CHECK_FIELD(cmd); CHECK_FIELD(cmdsize); @@ -251,7 +250,7 @@ void generic_header_check(const T& v1, const dd::segment_command_template template void generic_header_check(const T& v1, const dd::section_template& v2) { - BOOST_STATIC_ASSERT(sizeof(v1) == sizeof(v2)); + static_assert(sizeof(v1) == sizeof(v2), ""); CHECK_FIELD(sectname); CHECK_FIELD(segname); @@ -267,7 +266,7 @@ void generic_header_check(const T& v1, const dd::section_template& v2) { template void generic_header_check(const T& v1, const dd::symtab_command_& v2) { - BOOST_STATIC_ASSERT(sizeof(v1) == sizeof(v2)); + static_assert(sizeof(v1) == sizeof(v2), ""); CHECK_FIELD(cmd); CHECK_FIELD(cmdsize); @@ -279,7 +278,7 @@ void generic_header_check(const T& v1, const dd::symtab_command_& v2) { template void generic_header_check(const T& v1, const dd::nlist_template& v2) { - BOOST_STATIC_ASSERT(sizeof(v1) == sizeof(v2)); + static_assert(sizeof(v1) == sizeof(v2), ""); //CHECK_FIELD(n_strx); CHECK_FIELD(n_type); @@ -290,7 +289,7 @@ void generic_header_check(const T& v1, const dd::nlist_template& v2) { template void generic_header_check(const T& v1, const dd::load_command_& v2) { - BOOST_STATIC_ASSERT(sizeof(v1) == sizeof(v2)); + static_assert(sizeof(v1) == sizeof(v2), ""); CHECK_FIELD(cmd); CHECK_FIELD(cmdsize);