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

Port to C++11/C++14 removing superflous Boost facilities #88

Merged
merged 45 commits into from
Jan 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
9e664b5
Replace Boost.Move by std equivalents
Flamefire Jul 5, 2020
df5b77a
Replace Boost.TypeTraits by std equivalents
Flamefire Jul 5, 2020
cf330e8
Remove usage of Boost.MPL and reduce Boost.FunctionTypes usage
Flamefire Jul 5, 2020
f678f4d
Assume nullptr existance
Flamefire Jul 9, 2020
3b3700f
Assume support for variadic macros
Flamefire Jul 9, 2020
f154a1a
Assume existance of smart pointers
Flamefire Jul 9, 2020
9faab77
Assume existance of <functional>
Flamefire Jul 9, 2020
2f72d56
Assume existance of lambdas
Flamefire Jul 9, 2020
35fa6e6
Use std smart pointers in code
Flamefire Jul 9, 2020
353849e
Use default/delete for ctor/dtor
Flamefire Jul 9, 2020
35e43d5
Use std::reference_wrapper instead of boost
Flamefire Jul 9, 2020
a426e02
Replace Boost.Bind by std::bind and lambdas
Flamefire Jul 9, 2020
52d21a8
Get rid of BOOST_IDENTITY_TYPE
Flamefire Jul 9, 2020
908ca38
Add docstrings to mock.hpp
Flamefire Jul 10, 2020
ed8c58d
Remove Boost.Typeof
Flamefire Jul 10, 2020
a6aa140
Remove superflous test instantiations
Flamefire Jul 10, 2020
5ef17d0
Include examples in CI tests
Flamefire Jul 11, 2020
6702d68
Use range-based for-loops
Flamefire Jul 11, 2020
9af9f0e
Replace Boost.TypeInfo
Flamefire Jul 11, 2020
446e70b
Remove boost::result_of
Flamefire Jul 12, 2020
898a5a4
Document and improve is_functor
Flamefire Jul 12, 2020
04dff97
Use explicit streaming ops instead of Boost.LexicalCast
Flamefire Jul 12, 2020
823fd99
Remove some Boost.PP stuff
Flamefire Jul 12, 2020
d9a10af
Include definition for void_t to avoid dependency on Boost 1.64+
Flamefire Jul 12, 2020
c2617ba
Update from deprecated unit test header inclusion
Flamefire Jul 12, 2020
91b738d
Avoid Boost.Bind deprecation warning
Flamefire Jul 12, 2020
492e628
Avoid unused paramter warning in example
Flamefire Jul 12, 2020
558e1ca
Don't error when TURTLE_AUTO_PTR=ON
Flamefire Jul 14, 2020
f3d6564
Use make_* functions instead of new
Flamefire Jul 14, 2020
d9f9fce
Make action classes non-relocatable
Flamefire Jul 14, 2020
476c1a7
Remove some superflous typedefs and default impls
Flamefire Jul 14, 2020
d21f78e
Remove "using namespace mock_test" from patterns_retrieve_cref.cpp
Flamefire Sep 5, 2020
66a0464
"notok" -> "not ok"
Flamefire Sep 5, 2020
279bb2c
Fix memory include
Flamefire Sep 5, 2020
c7873cd
Adress review comments
Flamefire Sep 24, 2020
cf5ac87
Remove support for auto_ptr
Flamefire Sep 24, 2020
40a4b3c
Add documentation about unwrap_ref back and add example
Flamefire Sep 24, 2020
728dfd0
Remove user(doc) visible change to zero_plus_zero_is_zero_with_action
Flamefire Jan 6, 2022
e430594
Remove test-artifact from user visible part of how_to_invoke_a_functo…
Flamefire Jan 6, 2022
e266016
Remove ASSERT_VERIFY_FAIL macro from static_objects_problem
Flamefire Jan 6, 2022
98541eb
Change the threshold param of `near` to be inclusive
Flamefire Jan 6, 2022
78fa67e
Remove test checking for failure when NOT using "typename"/TPL macro
Flamefire Jan 7, 2022
f4c7401
Rename class `concept` to avoid name clash with C++20 `concept` keyword
Flamefire Jan 7, 2022
2dede83
Avoid unused function warnings in compile fail tests
Flamefire Jan 7, 2022
23ed958
Update CI
Flamefire Jan 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 160 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Copyright 2022 Alexander Grund
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)

name: CI

on:
pull_request:
push:
branches:
- master
- develop
- feature/**

concurrency:
group: ${{format('{0}:{1}', github.repository, github.ref)}}
cancel-in-progress: true

env:
NET_RETRY_COUNT: 5
DOCBOOK_XSL_DIR: /usr/share/xml/docbook/stylesheet/docbook-xsl
DOCBOOK_DTD_DIR: /usr/share/xml/docbook/schema/dtd/4.2

jobs:
posix:
defaults:
run:
shell: bash

strategy:
fail-fast: false
matrix:
include:
# Linux, gcc
- { compiler: gcc-5, cxxstd: '14', boostBranch: boost-1.65.0, os: ubuntu-18.04 }
- { compiler: gcc-5, cxxstd: '14', boostBranch: boost-1.77.0, os: ubuntu-18.04 }
- { compiler: gcc-5, cxxstd: '14,1z', boostBranch: master, os: ubuntu-18.04 }
- { compiler: gcc-11,cxxstd: '14,17,20', boostBranch: master, os: ubuntu-20.04 }

# Linux, clang
- { compiler: clang-5.0, cxxstd: '14', boostBranch: boost-1.65.0, os: ubuntu-18.04 }
- { compiler: clang-5.0, cxxstd: '14', boostBranch: boost-1.77.0, os: ubuntu-18.04 }
- { compiler: clang-5.0, cxxstd: '14,1z', boostBranch: master, os: ubuntu-18.04 }
- { compiler: clang-12, cxxstd: '14,17,20', boostBranch: master, os: ubuntu-20.04 }

- { name: Collect coverage, coverage: yes,
compiler: gcc-8, cxxstd: '14', boostBranch: master, os: ubuntu-20.04 }

timeout-minutes: 120
runs-on: ${{matrix.os}}
env:
BOOST_ROOT: ${{github.workspace}}/boost-root
PROJECT_DIR: ${{github.workspace}}/repo

steps:
- uses: actions/checkout@v2
if: '!matrix.coverage'
with:
path: ${{env.PROJECT_DIR}}
- uses: actions/checkout@v2
if: 'matrix.coverage'
with:
path: ${{env.PROJECT_DIR}}
fetch-depth: 0
# Checking out Boost and all its submodules takes ages...
- name: Cache Boost
uses: actions/cache@v2
with:
path: boost-root
key: boost-${{matrix.boostBranch}}
- name: Checkout Boost
uses: actions/checkout@v2
with:
repository: boostorg/boost
ref: ${{matrix.boostBranch}}
submodules: true
path: boost-root
persist-credentials: false

- name: Install packages and setup env
run: |
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
CXX=${{matrix.compiler}}
CXX="${CXX/gcc-/g++-}"
# Package names are g++-* and clang-*, so set this before correcting CXX for Clang
pkgs="$CXX xsltproc docbook-xsl docbook-xml lcov ccache"
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs
CXX="ccache ${CXX/clang-/clang++-}"
echo "CXX=$CXX" >> $GITHUB_ENV
echo "CC=${{matrix.compiler}}" >> $GITHUB_ENV
if [[ "$CXX" =~ clang ]]; then
B2_TOOLSET=clang
else
B2_TOOLSET=gcc
fi
echo "B2_TOOLSET=$B2_TOOLSET" >> $GITHUB_ENV
echo "using $B2_TOOLSET : : $CXX ;" > ~/user-config.jam

- name: Cache ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{matrix.os}}-${{matrix.compiler}}-${{matrix.boostBranch}}

- name: Prepare boost
working-directory: boost-root
run: ./bootstrap.sh && ./b2 headers

- name: Boost build
working-directory: ${{env.PROJECT_DIR}}
run: |
if [[ "${{matrix.boostBranch}}" == "master" ]]; then
B2_FLAGS="cxxstd=${{matrix.cxxstd}}"
else
B2_FLAGS="cxxflags=-std=c++${{matrix.cxxstd}}"
fi
if [[ "${{matrix.coverage}}" == "yes" ]]; then
B2_FLAGS="$B2_FLAGS cxxflags=--coverage linkflags=--coverage"
fi
scripts/build.sh --toolset=$B2_TOOLSET $B2_FLAGS -j3

- name: Collect coverage
if: matrix.coverage
working-directory: ${{env.PROJECT_DIR}}
run: |
lcov --version
lcov --gcov-tool=gcov-8 --directory "$PROJECT_DIR/test" --base-directory "$BOOST_ROOT" --capture --output-file all.info
# dump a summary on the console
lcov --list all.info
# Limit to our files (header-only in this case)
lcov --extract all.info "$PROJECT_DIR/include/*" --output-file coverage.info
# Output what was collected
lcov --list coverage.info
- name: Upload coverage
if: matrix.coverage
uses: coverallsapp/github-action@master
with:
path-to-lcov: ${{env.PROJECT_DIR}}/coverage.info
github-token: ${{secrets.GITHUB_TOKEN}}

- name: Build required boost libs
working-directory: boost-root
run: |
./b2 --toolset=$B2_TOOLSET --with-test --with-thread --with-chrono --with-system --with-atomic --with-date_time -a -j3
# Add lib folder to LD_LIBRARY_PATH, so the tests can load them
echo "LD_LIBRARY_PATH=$PWD/stage/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV

- name: CMake build
working-directory: ${{env.PROJECT_DIR}}
run: |
mkdir build && cd build
CXX_STANDARD="${{matrix.cxxstd}}"
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-std=c++${CXX_STANDARD##*,}" -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build . --config Debug -- -j3
ctest --output-on-failure --build-config Debug -j3

- name: Cleanup Boost folder
if: ${{ always() }}
working-directory: boost-root
run: git clean -fxd
85 changes: 0 additions & 85 deletions .travis.yml

This file was deleted.

6 changes: 2 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ else()
endif()

option(TURTLE_INSTALL "Enable to add install target" ${IS_ROOT_PROJECT})
option(TURTLE_AUTO_PTR "Enable support for auto_ptr" OFF)

# Default boost libs are static on windows and dynamic on linux
if(WIN32 AND NOT DEFINED Boost_USE_STATIC_LIBS)
Expand All @@ -27,10 +26,9 @@ configure_file(version.hpp.cmake ${CMAKE_CURRENT_BINARY_DIR}/include/turtle/vers
add_library(turtle INTERFACE)
add_library(turtle::turtle ALIAS turtle)
target_include_directories(turtle INTERFACE $<BUILD_INTERFACE:include;${CMAKE_CURRENT_BINARY_DIR}/include>)
target_compile_features(turtle INTERFACE cxx_std_14)

target_link_libraries(turtle INTERFACE Boost::boost Boost::disable_autolinking)
if(NOT TURTLE_AUTO_PTR)
target_compile_definitions(turtle INTERFACE MOCK_NO_AUTO_PTR)
endif()

if(BUILD_TESTING)
add_subdirectory(test)
Expand Down
6 changes: 3 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ branches:
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
BOOST: 1_60_0
BOOST: 1_65_1
TOOLSET: msvc-14.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
BOOST: 1_65_1
Expand All @@ -26,10 +26,10 @@ environment:
CXX_STANDARD: 14
# CXX_STANDARD: 17
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
BOOST: 1_60_0
BOOST: 1_65_1
CMAKE: true
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
BOOST: 1_71_0
BOOST: 1_77_0
CMAKE: true

install:
Expand Down
3 changes: 3 additions & 0 deletions doc/changelog.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
Released -

* Allow auto-deducing signature in `MOCK_METHOD_(NON_)CONST`
* Replaced Boost facilities with std:: equivalents where existing in C++14
* Deprecated MOCK_FUNCTOR_TPL as no longer required, use the non _TPL variant even for templates
* Added MOCK_PROTECT_FUNCTION_SIG to pass function signatures with commas in the return type

[endsect]

Expand Down
2 changes: 1 addition & 1 deletion doc/customization.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ The purpose of the 'near' template function is to :
* remove the burden of specifying the template parameter when instantiating near_constraint
* wrap the constraint in a mock::constraint so that it plays nicely with !, && and ||.

The use of boost::unwrap_ref provides support for passing arguments as references with boost::ref and boost::cref and delaying their initialization, for instance :
The use of mock::unwrap_ref provides support for passing arguments as references with std::ref and std::cref and delaying their initialization, for instance :

[near_constraint_cref_test]

Expand Down
7 changes: 4 additions & 3 deletions doc/example/calculator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@
#ifndef CALCULATOR
#define CALCULATOR

class view;
#include "view.hpp"

//[ calculator
class calculator
{
view& v;
public:
mat007 marked this conversation as resolved.
Show resolved Hide resolved
calculator( view& v );
calculator( view& v ): v(v){}
mat007 marked this conversation as resolved.
Show resolved Hide resolved

void add( int a, int b ); // the result will be sent to the view 'v'
void add( int a, int b ){ v.display(a + b); } // the result will be sent to the view 'v'
};
//]

Expand Down
Loading