Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 23 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,28 +248,38 @@ jobs:
# The two C files, because they are the ones that hand raw
# pointers across and give everything back by hand.
#
# Definitely and indirectly lost are errors. Possibly lost is not:
# it is one block of 180 bytes, it belongs to a thread the library
# started, and a pointer into the middle of a block is how a
# thread-local arena looks to a leak checker rather than how a
# leak looks.
# Definitely lost is an error. Indirectly lost is shown and not
# counted, because an indirectly lost block is by definition one
# hanging off a definitely lost block: count the root and the
# children come with it, and a leak that had no root would not be
# indirect. It is the spelling that lets the five roots the engine
# keeps be suppressed by name in test/memcheck.supp rather than by
# a rule about libzu.so wide enough to hide this job's own point.
# Possibly lost is not an error either: it is one block of 180
# bytes, it belongs to a thread the library started, and a pointer
# into the middle of a block is how a thread-local arena looks to
# a leak checker rather than how a leak looks.
#
# ZU_TEST_ROWS shrinks the two fixtures that exist to be slow.
# Memcheck already runs the machine forty times slower, which is
# another way of getting a statement that lasts long enough to be
# interrupted, so the smaller number tests the same thing in a
# fifth of the wall clock.
# This used to set ZU_TEST_ROWS to 300, to shrink the two fixtures
# that exist in order to be slow, on the reasoning that memcheck
# runs the machine forty times slower and that is another way of
# getting a statement long enough to be watched and interrupted.
# The arithmetic does not work: the statement counts pairs, so a
# tenth of the rows is a hundredth of the work, and a hundredth
# slowed by forty is shorter than the whole fixture is natively.
# The watcher never fired, and the case that says it fired is the
# one that has been red here since this job was added. The whole
# fixture runs now and this job costs a minute more.
- name: The C suites under memcheck
run: |
set -eu
for t in misuse threads; do
valgrind --error-exitcode=99 --leak-check=full \
--show-leak-kinds=definite,indirect \
--errors-for-leak-kinds=definite,indirect \
--errors-for-leak-kinds=definite \
--suppressions=test/memcheck.supp \
--track-origins=yes "./build-vg/test/$t"
done
env:
ZU_TEST_ROWS: 300

# The reference, built the same way the release builds it, and graded
# rather than glanced at.
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if(POLICY CMP0144)
endif()

project(zu-cpp
VERSION 0.14.0
VERSION 0.15.0
DESCRIPTION "The header-only C++ wrapper over libzu"
HOMEPAGE_URL "https://github.com/tamnd/zu-c"
LANGUAGES C CXX)
Expand Down Expand Up @@ -83,9 +83,9 @@ if(TARGET zu::zu)
# is not fatal here, because the two numbers are counts and a header
# newer than this wrapper is usually only wider, but it is worth
# saying out loud rather than finding at the first struct.
if(NOT ZU_ABI_VERSION VERSION_EQUAL "0.14")
if(NOT ZU_ABI_VERSION VERSION_EQUAL "0.15")
message(WARNING
"zu.h declares ABI ${ZU_ABI_VERSION} and this wrapper was written against 0.14")
"zu.h declares ABI ${ZU_ABI_VERSION} and this wrapper was written against 0.15")
endif()
else()
message(STATUS
Expand Down
16 changes: 16 additions & 0 deletions api/surface.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
define ZU_HAS_EXPECTED
define ZU_HAS_FORMAT
define ZU_HAS_INT128
formatter std::formatter< zu::Decimal >
formatter std::formatter< zu::Error >
formatter std::formatter< zu::Node >
formatter std::formatter< zu::Position >
Expand Down Expand Up @@ -121,6 +123,16 @@ func static zu::Database::try_create(std::string_view, const Config & = Config{}
func static zu::Database::try_memory(const Config & = Config{}) -> expected< Database >
func static zu::Database::try_open(std::string_view, const Config & = Config{}) -> expected< Database >
func zu::Database::try_path() const -> expected< std::string_view >
struct zu::Decimal
func zu::Decimal::as_double() const noexcept -> double
var zu::Decimal::hi -> std::int64_t
var zu::Decimal::lo -> std::uint64_t
func static zu::Decimal::of(std::int64_t, std::int32_t) noexcept -> Decimal
friend zu::Decimal::operator==(const Decimal &, const Decimal &) = default -> bool
var zu::Decimal::scale -> std::int32_t
func zu::Decimal::unscaled() const noexcept -> __int128
func zu::Decimal::unscaled64() const noexcept -> std::optional< std::int64_t >
func static zu::Decimal::wide(__int128, std::int32_t) noexcept -> Decimal
class zu::Error
func zu::Error::Error() = default
func zu::Error::code() const noexcept -> std::optional< std::string_view >
Expand Down Expand Up @@ -382,6 +394,7 @@ enum zu::Type -> int
enum value zu::Type::binding_table -> ZU_TYPE_BINDING_TABLE
enum value zu::Type::boolean -> ZU_TYPE_BOOL
enum value zu::Type::bytes -> ZU_TYPE_BYTES
enum value zu::Type::decimal -> ZU_TYPE_DECIMAL
enum value zu::Type::floating -> ZU_TYPE_FLOAT
enum value zu::Type::graph -> ZU_TYPE_GRAPH
enum value zu::Type::integer -> ZU_TYPE_INT
Expand All @@ -398,6 +411,7 @@ func explicit zu::Value::Value(const zu_value *) noexcept
func zu::Value::Value() = default
func zu::Value::as_bool() const -> bool
func zu::Value::as_bytes() const -> std::span< const std::uint8_t >
func zu::Value::as_decimal() const -> Decimal
func zu::Value::as_double() const -> double
func zu::Value::as_int() const -> std::int64_t
func zu::Value::as_node() const -> Node
Expand All @@ -415,6 +429,7 @@ func zu::Value::raw() const noexcept -> const zu_value *
func zu::Value::size() const noexcept -> std::uint64_t
func zu::Value::try_as_bool() const -> expected< bool >
func zu::Value::try_as_bytes() const -> expected< std::span< const std::uint8_t > >
func zu::Value::try_as_decimal() const -> expected< Decimal >
func zu::Value::try_as_double() const -> expected< double >
func zu::Value::try_as_int() const -> expected< std::int64_t >
func zu::Value::try_as_node() const -> expected< Node >
Expand Down Expand Up @@ -461,6 +476,7 @@ func zu::to_string(Status) noexcept -> std::string_view
func zu::to_string(Temporal) -> std::string
func zu::to_string(TemporalKind) noexcept -> std::string_view
func zu::to_string(Type) noexcept -> std::string_view
func zu::to_string(const Decimal &) -> std::string
func zu::to_string(const Error &) -> std::string
func zu::to_string(const Value &) -> std::string
func zu::version() -> std::string_view
20 changes: 16 additions & 4 deletions docs/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,25 @@ EXPAND_ONLY_PREDEF = YES
# reader's problem and not Doxygen's, so they are written out here as
# the values the reference is generated at.
#
# ZU_FORMATTER expands to nothing so that its ten invocations do not
# arrive as ten functions nobody declared. The macro itself is
# ZU_HAS_INT128 is the same pair for the same reason, and __SIZEOF_INT128__
# is the compiler macro it is defined from rather than a library one.
# The value is 16, which is what GCC and Clang set it to, though nothing
# here reads it: what matters is that it is defined, since that is the
# whole of the test. Without the pair, Decimal::wide and
# Decimal::unscaled are thrown away before Doxygen sees them, and two
# published names would then be missing from the reference and from
# api/surface.txt while being present in the header on every compiler
# this project builds on.
#
# ZU_FORMATTER expands to nothing so that its eleven invocations do not
# arrive as eleven functions nobody declared. The macro itself is
# documented where it is defined and names what it specializes, and
# docs/surface.py puts the ten back, because a specialization a caller
# formats against is published whether Doxygen sees it or not.
# docs/surface.py puts the eleven back, because a specialization a
# caller formats against is published whether Doxygen sees it or not.
PREDEFINED = __cpp_lib_expected=202202L \
__cpp_lib_format=201907L \
__SIZEOF_INT128__=16 \
ZU_HAS_EXPECTED=1 \
ZU_HAS_FORMAT=1 \
ZU_HAS_INT128=1 \
ZU_FORMATTER(TYPE)=
Loading
Loading