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

Code safety/modernization #234

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Code safety/modernization #234

wants to merge 5 commits into from

Commits on Aug 28, 2024

  1. Configuration menu
    Copy the full SHA
    c6978bd View commit details
    Browse the repository at this point in the history
  2. CompilerSupport / PlatformCompat overhaul

    - Removed obsolete/unused MUST_USE_RESULT
    - Changed LITECORE_UNUSED to be the standard C++17 [[maybe_unused]]
      and commented that we should stop using the macro
    - Added LIFETIMEBOUND
    
    Removed LITECORE_UNUSED, FLEECE_UNUSED
    
    Replaced with standard [[maybe_unused]]
    snej committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    c0ae22c View commit details
    Browse the repository at this point in the history
  3. Use LIFETIMEBOUND in API

    Some slice code cleanup, removing C++11/C++14 shims
    
    - Added `data()` and `size_bytes()` methods to slice types, like those
      in std::span. (Can't add `size()` because it conflicts with a data
      member.) This is an incremental step toward moving to `span`, or at
      least making the `buf` and `size` fields private.
    - Likewise, added `data()`, `size_bytes()` to FLSlice and
      FLSliceResult, as well as `empty()` and `operator bool`.
    - Removed obsolete `sliceHash`.
    - Removed conditional support for `std::string_view`, unnecessary
      since we require C++17.
    - Removed `constexpr14` which was only useful when we supported C++11.
    - Added default initializers to slice member variables instead of
      initializing in the default constructor.
    - Use `= default` for default constructors.
    snej committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    b794101 View commit details
    Browse the repository at this point in the history
  4. C++ improvements to Fleece.hh

    - Make Value, Array, Dict trivially copyable: this allows instances
      to be passed in a register instead of on the stack in some ABIs,
      such as ARM64, which is more efficient. (The fix is to remove the
      custom operator= methods, which are unnecessary.)
    - Made operator==, operator!= methods const.
    - Made move constructors/assignment `noexcept`, which helps
      collections generate more optimal code.
    - Don't pass `alloc_slice` or `string` by value.
    snej committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    75a30c8 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    3333109 View commit details
    Browse the repository at this point in the history