Implementation of ValueOrError concept.
For details check:
- Outcome documentation
- ValueOrError proposal
- LLVM ErrorOr
- About std::variant
- Optional-Expected: "and_then" and "map"
- CppCon 2018: Brand & Nash “What Could Possibly Go Wrong?: A Tale of Expectations and Exceptions”
Ubuntu 19.10: Clang 9, GCC 9, Cmake 3.13, Conan
C++14 Standard is used.
Google style is used.
See tools/Dockerfile
for details how to setup development environment
Submodules are used. Initial command after clone is git submodule update --init --recursive
.
Assuming all further commands are executed from project root.
Run tools/install_hooks.py
This will allow to perform some code checks locally before posting changes to server.
Libs: Boost 1.69, Catch2
Project uses Conan Package Manager
Install conan with
sudo -H pip install conan
CMake will try to automatically setup dependencies.
Cmake will automatically check required dependencies and setup them taking into account current compiler (clang or gcc).
cmake --graphviz=graph ..
dot graph -T png -o graph.png
sudo apt install -y doxygen graphviz
By default used clang compiler and debug mode.
Run in project root to build debug version with clang
mkdir build-clang-debug && cd build-clang-debug && cmake .. && make -j$(nproc)
To build release version with gcc run the following command
RUN mkdir build-gcc-release && cd build-gcc-release && CXX=g++ cmake -DCMAKE_BUILD_TYPE=Release .. && make -j$(nproc)
You can enable sanitizers with SANITIZE_ADDRESS
, SANITIZE_MEMORY
, SANITIZE_THREAD
or SANITIZE_UNDEFINED
options in your CMake configuration. You can do this by passing e.g. -DSANITIZE_ADDRESS=On
in your command line.
Run from build directory
ctest
or
build/testrunner
To enable coverage support in general, you have to enable ENABLE_COVERAGE
option in your CMake configuration. You can do this by passing -DENABLE_COVERAGE=On
on your command line or with your graphical interface.
If coverage is supported by your compiler, the specified targets will be build with coverage support. If your compiler has no coverage capabilities (I assume Intel compiler doesn't) you'll get a warning but CMake will continue processing and coverage will simply just be ignored.
Collect coverage in Debug mode. Tested with gcc 8 and clang 7 compiler.
CXX=g++ cmake -DENABLE_COVERAGE=On -DCMAKE_BUILD_TYPE=Debug ..
make -j$(nproc)
make test
make lcov-capture
make lcov-genhtml
xdg-open lcov/html/selected_targets/index.html
Dockerfile: image, which contains basic environment setup (compiler, build tools)
docker build -t value-or-error -f tools/Dockerfile .
Sample command to run analyzer. By default report is stored in /tmp/scan-build*
mkdir build-debug
cd build-debug
scan-build --use-analyzer=/usr/bin/clang++ cmake ..
scan-build --use-analyzer=/usr/bin/clang++ make -j$(nproc)
or
cmake ..
make clang-static-analyzer
Setting are stored in .clang-tidy
.
Run
mkdir build
cd build
cmake ..
make clang-tidy
Code contains doxygen. To generate html documentation run command make doc
. Output will be in `\doc\html