Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
2275d7f
Refactor: Simplify range type constraints in pipelines
beached Mar 19, 2025
3b0abb9
Add contract validation utility with corresponding tests
beached Mar 22, 2025
69099dd
Refactor contract tests to handle exceptions conditionally.
beached Mar 22, 2025
5b7090b
Merge pull request #548 from beached/master
beached Apr 11, 2025
924d673
Add support for counting leading zeros in uint128_t
beached Apr 19, 2025
e1302c5
Refactor `count_leading_zeroes` handling for better builtin usage
beached Apr 19, 2025
cccf656
Fix count_leading_zeroes for zero input handling
beached Apr 19, 2025
9e9abe4
Update LLVM repo URLs in CI for Ubuntu 24.04 workflows
beached Apr 19, 2025
af59e79
Added missing conditional for `daw::uint128` with `DAW_HAS_INT128`.
beached Apr 19, 2025
01b400f
Streamline CI by removing outdated compiler toolsets
beached Apr 19, 2025
a19d53c
Fix incorrect handling of zero in count_leading_zeroes.
beached Apr 19, 2025
884d121
Update macro check for built-in function in count_leading_zeroes.
beached Apr 21, 2025
c8fc18b
Add ASCII utilities and corresponding tests
beached May 13, 2025
4f3c3be
Fix ASCII printable check to include space character
beached May 13, 2025
cb1e9c7
Add utility to convert enums to their underlying type
beached May 19, 2025
b6facb8
Rename `to_underlying_type` to `to_underlying`
beached May 19, 2025
0bf2389
Refactor `function_ref` to handle null-thunk pointers as it isn't nee…
beached May 22, 2025
807fb98
Fix type handling and formatting in `count_digits` and `count_leading…
beached Jun 26, 2025
895ca55
Fix formatting in `basic_string_view` and adjust logic for conditiona…
beached Jul 3, 2025
ea8b432
Update CI for Windows to use Visual Studio 2022 toolset
beached Jul 3, 2025
3e970a0
Refactor Windows CI workflows: merge `ci_windows_clangcl.yml` into `c…
beached Jul 3, 2025
ccc8a3b
Update Windows CI workflow to build `daw-header-libraries_full` targe…
beached Jul 3, 2025
3391ca1
Simplify `append_hash` logic in `daw_fnv1a_hash.h` by extracting `cur…
beached Jul 4, 2025
21012c6
Undid change to string_view
beached Jul 4, 2025
5df2ddc
Ensuring msvc::no_unique_address is used for clang-cl
beached Jul 4, 2025
59fbd99
Add `-Wno-missing-braces` compiler option to suppress warnings
beached Jul 4, 2025
1e6f467
Remove unnecessary `constexpr` in `formatter::parse` signature
beached Jul 4, 2025
8931321
Refactor `append_hash` to use `array_t` for byte extraction, simplify…
beached Jul 4, 2025
8d3ddda
Change `operator""` return type from `size_t` to `unsigned long long`…
beached Jul 4, 2025
4f5ace0
Refine aggregate initialization in `daw_uninitialized_storage` by che…
beached Jul 4, 2025
b7a1dac
- Move `daw_contract_test.cpp` to `CPP20_NOT_MSVC_TEST_SOURCES` in CM…
beached Jul 4, 2025
ced571d
Merge pull request #550 from beached/master
beached Jul 4, 2025
4b11ef7
Remove redundant macOS CI scripts and modernize workflows with matrix…
beached Jul 5, 2025
5ddaf84
Update CI workflows to use `master` and `v2` branches, adjust ignored…
beached Jul 5, 2025
0d07c0d
Remove redundant Ubuntu CI scripts and clean up macOS workflow config…
beached Jul 5, 2025
c2ba2e9
Enable stricter compiler warnings and update CI configurations
beached Jul 6, 2025
5def6b9
Update CI workflows with new macOS and Ubuntu configurations
beached Jul 6, 2025
e1bc445
Fix typo in Ubuntu CI toolset and simplify compiler options handling
beached Jul 6, 2025
d0ad53a
Remove g++-15 from Ubuntu CI toolset and add warning 2220 suppression…
beached Jul 6, 2025
35cc011
Update minimum required C++ compiler version to 14 for debug flag con…
beached Jul 7, 2025
2fbc115
Suppress MSVC warning 4305 in test compiler options configuration.
beached Jul 11, 2025
64d7247
Refactor: replace `size_t` with `std::uint64_t` in `daw_hash_set` to …
beached Jul 11, 2025
ed24d5b
Suppress MSVC warning 4296 and update test compiler options configura…
beached Jul 11, 2025
dc84d53
Flush output stream in `output_expected_error`, fix `else` consistenc…
beached Jul 11, 2025
2082276
Flush `std::cerr` output before calling `std::terminate` in benchmark…
beached Jul 11, 2025
a0e72ff
Refactor `daw_hash_set` to use `not` instead of `!` and adjust logic …
beached Jul 12, 2025
66e5722
Update includes in `daw_hash_set` and `daw_cpp_feature_check`, suppre…
beached Jul 12, 2025
2b56629
Add `daw_cxmath::cmp_equal`, refactored `exists` to simplify MSVC-spe…
beached Jul 12, 2025
46a3929
Fixed typo
beached Jul 12, 2025
18edc16
- Add MSVC-specific warnings handling in `cmp_equal` for better compa…
beached Jul 12, 2025
e197d10
Replace `std::uint64_t` with `std::size_t` in `daw_hash_set` for bett…
beached Jul 12, 2025
b188881
Replace `std::uint64_t` with `std::size_t` in tests for consistency w…
beached Jul 12, 2025
e7e45bd
Refactor tests: replace explicit `std::vector<T>` declarations with `…
beached Jul 12, 2025
5fdc7bc
Expand `daw_cxmath` with additional comparison utilities (`cmp_not_eq…
beached Jul 12, 2025
d787bc0
Refactor tests: removed potential narrowing conversion
beached Jul 12, 2025
eb13fe0
Refactor tests: cast RNG result to `std::uint64_t` to prevent potenti…
beached Jul 12, 2025
c54433d
Refactor tests: add exception handling in main functions on some fail…
beached Jul 12, 2025
f498dc5
Refactor tests: add `return 1` for exception handling and replace `st…
beached Jul 12, 2025
8ecc679
Refactor `daw_traits`: improve type traits utilities with consistent …
beached Jul 12, 2025
ea389ba
Refactor tests: replace `max_sizeof` with `max_sizeof_v` and update l…
beached Jul 12, 2025
0dcd2d3
Standardize `std::size_t` usage and improve type consistency in stati…
beached Jul 12, 2025
8dfad59
Ensured NDEBUG is not set for string_view2 test
beached Jul 12, 2025
de0dc6d
- Addressed potential compiler warnings and compatibility issues for …
beached Jul 12, 2025
ccbc25a
Add `expected_failure` type and exception handling for `expecting` fu…
beached Jul 12, 2025
4268e12
Add `expected_failure` handling to benchmark functions, enabling cond…
beached Jul 12, 2025
5f5645e
Remove `noexcept` specifier from benchmark templates for broader use …
beached Jul 12, 2025
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
67 changes: 56 additions & 11 deletions .github/workflows/ci_macos.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,64 @@
name: MacOS

on:
schedule:
- cron: '0 5 * * *'
push:
branches-ignore: dev
branches: [ master, v2 ]
pull_request:
branches-ignore: dev
push:
branches-ignore: dev, v2
pull_request:
branches-ignore: dev, v2

jobs:
build:
runs-on: [macOS-latest]
CI_Tests:
permissions:
actions: none
checks: none
contents: none
deployments: none
issues: none
packages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none
strategy:
fail-fast: false
matrix:
cpp_version: [ 17, 20 ]
build_type: [ Debug, Release ]
os: [ macos-15, macos-14 ]
toolset: [ clang++ ]
runs-on: ${{ matrix.os }}
name: "${{ matrix.os }} ${{ matrix.toolset }} ${{ matrix.cpp_version }} ${{ matrix.build_type }}"
steps:
- uses: actions/checkout@v1
- name: Build
run: ./ci_scripts/ci_macos_build.sh
- name: Test
run: ./ci_scripts/ci_macos_test.sh
- name: InstallTest
run: ./ci_scripts/ci_macos_install_test.sh
- uses: actions/checkout@v1
- name: Create Build
run: |
mkdir build && \
brew install ninja
- name: Build Dependencies
env:
CXX: ${{ matrix.toolset }}
run: cmake -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DDAW_ENABLE_TESTING=ON -DDAW_WERROR=ON -DCMAKE_CXX_STANDARD=${{ matrix.cpp_version }} -Bbuild/ .
- name: Build
run: cmake --build build/ --target daw-header-libraries_full -- -k 0
continue-on-error: true
- name: Test
run: |
ulimit -c unlimited
ulimit -c
ctest -C ${{ matrix.build_type }} -j2 -VV --timeout 1200 --test-dir build/
- name: Archive any crashes as an artifact
uses: actions/upload-artifact@v4
if: always( )
with:
name: crashes
path: |
crash-*
leak-*
timeout-*
/cores/**
if-no-files-found: ignore
6 changes: 3 additions & 3 deletions .github/workflows/ci_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Ubuntu

on:
push:
branches-ignore: develop
branches-ignore: dev
pull_request:
branches-ignore: develop
branches-ignore: dev, v2

jobs:
CI_Tests:
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
run: |
mkdir build
- name: Build Dependencies
run: cmake -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DDAW_ENABLE_TESTING=ON -DCMAKE_CXX_STANDARD=${{ matrix.cpp_version }} -Bbuild/ .
run: cmake -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DDAW_ENABLE_TESTING=ON -DDAW_WERROR=ON -DCMAKE_CXX_STANDARD=${{ matrix.cpp_version }} -Bbuild/ .
- name: Build
run: cmake --build build/ --target daw-header-libraries_full -- -k 0
continue-on-error: true
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ on:
schedule:
- cron: '10 5 * * *'
push:
branches: [ release, develop ]
branches: [ master, v2 ]
pull_request:
push:
branches-ignore: develop
branches-ignore: dev, v2
pull_request:
branches-ignore: develop
branches-ignore: dev, v2

jobs:
Windows:
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Setup Build Environment
run: md ${{ env.DAW_BUILD_DIR }}
- name: CMake Config
run: cmake.exe ${{ matrix.config.cmake_flags }} -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DCMAKE_CXX_STANDARD=${{ matrix.config.cpp_version }} -DDAW_ENABLE_TESTING=On -B${{ env.DAW_BUILD_DIR }}/ .
run: cmake.exe ${{ matrix.config.cmake_flags }} -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DCMAKE_CXX_STANDARD=${{ matrix.config.cpp_version }} -DDAW_ENABLE_TESTING=ON -DDAW_WERROR=ON -B${{ env.DAW_BUILD_DIR }}/ .
- name: Build
run: cmake.exe --build ${{ env.DAW_BUILD_DIR }}/ --target daw-header-libraries_full --config ${{ matrix.config.build_type }}
continue-on-error: true
Expand Down
7 changes: 0 additions & 7 deletions ci_scripts/ci_add_llvm_apt_ubuntu.sh

This file was deleted.

18 changes: 0 additions & 18 deletions ci_scripts/ci_macos_build.sh

This file was deleted.

15 changes: 0 additions & 15 deletions ci_scripts/ci_macos_install_test.sh

This file was deleted.

7 changes: 0 additions & 7 deletions ci_scripts/ci_macos_test.sh

This file was deleted.

15 changes: 0 additions & 15 deletions ci_scripts/ci_ubuntu_build.sh

This file was deleted.

15 changes: 0 additions & 15 deletions ci_scripts/ci_ubuntu_install_test.sh

This file was deleted.

7 changes: 0 additions & 7 deletions ci_scripts/ci_ubuntu_test.sh

This file was deleted.

61 changes: 47 additions & 14 deletions include/daw/daw_benchmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#include "daw/ciso646.h"
#include "daw/daw_arith_traits.h"
#include "daw/daw_check_exceptions.h"
#include "daw/daw_cxmath.h"
#include "daw/daw_do_not_optimize.h"
#include "daw/daw_expected.h"
#include "daw/daw_move.h"
Expand All @@ -27,6 +29,12 @@
#include <vector>

namespace daw {
#if defined( DAW_USE_EXCEPTIONS )
struct expected_failure {
expected_failure( ) = default;
};
#endif

namespace benchmark_impl {
using second_duration = std::chrono::duration<double>;
} // namespace benchmark_impl
Expand Down Expand Up @@ -205,7 +213,7 @@ namespace daw {
template<size_t Runs, char delem = '\n', typename Test, typename... Args>
DAW_ATTRIB_NOINLINE auto bench_n_test( std::string const &title,
Test &&test_callable,
Args const &...args ) noexcept {
Args const &...args ) {
static_assert( Runs > 0 );
static_assert( std::is_invocable_v<Test, Args...>,
"Unable to call Test with provided Args" );
Expand Down Expand Up @@ -313,7 +321,7 @@ namespace daw {
typename Function, typename... Args>
[[nodiscard]] DAW_ATTRIB_NOINLINE std::array<double, Runs>
bench_n_test_mbs2( std::string const &, size_t, Validator &&validator,
Function &&func, Args const &...args ) noexcept {
Function &&func, Args const &...args ) {
static_assert( Runs > 0 );
static_assert( std::is_invocable_v<Function, Args...>,
"Unable to call Function with provided Args" );
Expand Down Expand Up @@ -352,8 +360,12 @@ namespace daw {
daw::do_not_optimize( result );
auto const valid_start = std::chrono::steady_clock::now( );
if( DAW_UNLIKELY( not validator( result ) ) ) {
std::cerr << "Error validating result\n";
std::cerr << "Error validating result\n" << std::flush;
#if defined( DAW_USE_EXCEPTIONS )
throw expected_failure( );
#else
std::terminate( );
#endif
}
valid_time += benchmark_impl::second_duration(
std::chrono::steady_clock::now( ) - valid_start );
Expand All @@ -368,7 +380,7 @@ namespace daw {
template<size_t Runs, char delem = '\n', typename Test, typename... Args>
[[nodiscard]] DAW_ATTRIB_NOINLINE auto
bench_n_test_mbs( std::string const &title, size_t bytes,
Test &&test_callable, Args const &...args ) noexcept {
Test &&test_callable, Args const &...args ) {
static_assert( Runs > 0 );
static_assert( std::is_invocable_v<Test, Args...>,
"Unable to call Test with provided Args" );
Expand Down Expand Up @@ -477,7 +489,7 @@ namespace daw {
/// @return last result timing counts of runs
template<size_t Runs, typename Function, typename... Args>
[[nodiscard]] DAW_ATTRIB_NOINLINE std::vector<std::chrono::nanoseconds>
bench_n_test_json( Function &&func, Args &&...args ) noexcept {
bench_n_test_json( Function &&func, Args &&...args ) {
static_assert( Runs > 0 );
static_assert( std::is_invocable_v<Function, Args...>,
"Unable to call Test with provided Args" );
Expand Down Expand Up @@ -530,7 +542,7 @@ namespace daw {
template<size_t Runs, typename Validator, typename Function, typename... Args>
DAW_ATTRIB_NOINLINE std::vector<std::chrono::nanoseconds>
bench_n_test_json_val( Validator &&validator, Function &&func,
Args &&...args ) noexcept {
Args &&...args ) {
static_assert( Runs > 0 );
static_assert( std::is_invocable_v<Function, Args...>,
"Unable to call Test with provided Args" );
Expand Down Expand Up @@ -568,8 +580,12 @@ namespace daw {
auto const finish = std::chrono::steady_clock::now( );
daw::do_not_optimize( result );
if( DAW_UNLIKELY( not validator( std::move( result ) ) ) ) {
std::cerr << "Error validating result\n";
std::cerr << "Error validating result\n" << std::flush;
#if defined( DAW_USE_EXCEPTIONS )
throw expected_failure( );
#else
std::terminate( );
#endif
}

auto const duration =
Expand All @@ -594,38 +610,47 @@ namespace daw {
DAW_ATTRIB_NOINLINE void output_expected_error( T &&expected_result,
U &&result ) {
std::cerr << "Invalid result. Expecting '" << expected_result
<< "' but got '" << result << "'\n";
<< "' but got '" << result << "'\n"
<< std::flush;
}

template<
typename T, typename U,
std::enable_if_t<(not is_streamable_v<T> and not is_streamable_v<U>),
std::nullptr_t> = nullptr>
DAW_ATTRIB_NOINLINE constexpr void output_expected_error( T &&, U && ) {
std::cerr << "Invalid or unexpected result\n";
std::cerr << "Invalid or unexpected result\n" << std::flush;
}
} // namespace benchmark_impl

template<typename T, typename U>
DAW_ATTRIB_NOINLINE constexpr void expecting( T &&expected_result,
U &&result ) {
if( not( expected_result == result ) ) {
if( not( daw::cxmath::cmp_equal( expected_result, result ) ) ) {
#ifdef __VERSION__
if constexpr( not daw::string_view( __VERSION__ )
.starts_with( daw::string_view(
"4.2.1 Compatible Apple LLVM" ) ) ) {
benchmark_impl::output_expected_error( expected_result, result );
}
#endif
#if defined( DAW_USE_EXCEPTIONS )
throw expected_failure( );
#else
std::terminate( );
#endif
}
}

template<typename Bool>
DAW_ATTRIB_NOINLINE constexpr void expecting( Bool const &expected_result ) {
if( not static_cast<bool>( expected_result ) ) {
std::cerr << "Invalid result. Expecting true\n";
std::cerr << "Invalid result. Expecting true\n" << std::flush;
#if defined( DAW_USE_EXCEPTIONS )
throw expected_failure( );
#else
std::terminate( );
#endif
}
}

Expand All @@ -634,8 +659,12 @@ namespace daw {
String &&message ) {
do_not_optimize( expected_result );
if( DAW_UNLIKELY( not( expected_result ) ) ) {
std::cerr << message << '\n';
std::cerr << message << '\n' << std::flush;
#if defined( DAW_USE_EXCEPTIONS )
throw expected_failure( );
#else
std::terminate( );
#endif
}
(void)message;
}
Expand Down Expand Up @@ -667,12 +696,16 @@ namespace daw {
if( DAW_FWD( pred )( ex ) ) {
return;
}
std::cerr << "Failed predicate\n";
std::cerr << "Failed predicate\n" << std::flush;
} catch( ... ) {
std::cerr << "Unexpected exception\n";
std::cerr << "Unexpected exception\n" << std::flush;
throw;
}
#if defined( DAW_USE_EXCEPTIONS )
throw expected_failure( );
#else
std::terminate( );
#endif
#endif
}
} // namespace daw
Loading
Loading