diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d62d0493a..e4100f605 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -371,7 +371,7 @@ jobs: build-lnx-bad: needs: [cache-submodule] - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 diff --git a/README.md b/README.md index cc91ebf97..2d7674b4b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Orchid is a decentralized marketplace "for bandwidth"; providers run a server (i Many users would like to compile Orchid. Thankfully, Orchid is extremely easy to build... so easy, in fact, that a lot of people seem confused by a lack of complex instructions :(. Every single library dependency of Orchid is included as a git submodule (so don't forget to run "git submodule update --init --recursive") and is compiled by the Orchid build system, so there is no need for a lengthy DEPS list: there are no "external" steps (as you often see with many other C/C++ projects). -Of course, you do need to have the requisite build tooling installed... in addition to the standard set of C/C++ development tools (autotools, bison/flex, make, etc.) we specifically require clang (for which I'm truly sorry: maybe one day we'll support gcc) and ldd (neither binutils ld nor gold are sufficient). Some of the build scripts for our dependencies use Python (I think only 3.x), one insists on being built using meson/ninja, and we use a couple libraries that are written in Rust. +Of course, you do need to have the requisite build tooling installed... in addition to the standard set of C/C++ development tools (autotools, bison/flex, make, etc.) we specifically require clang 16+ (for which I'm truly sorry: maybe one day we'll support gcc) and ldd (neither binutils ld nor gold are sufficient). Some of the build scripts for our dependencies use Python (I think only 3.x), one insists on being built using meson/ninja, and we use a couple libraries that are written in Rust. (At this point I will note, as this has come up multiple times: it is neither practical nor appropriate for Orchid's documentation to detail how to install any of these toolchains. The instructions are different for every operating system, are different for every single distribution of Linux, and are often even different for specific versions of a distribution. FWIW, developers already have most of this software installed; and, if you don't, these projects have their own documentation.) diff --git a/app-linux/source/main.cpp b/app-linux/source/main.cpp index 0b72ee057..0874e84da 100644 --- a/app-linux/source/main.cpp +++ b/app-linux/source/main.cpp @@ -32,7 +32,7 @@ struct _MyApplication { char **dart_entrypoint_arguments; }; -// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables,performance-no-int-to-ptr) +// NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange,cppcoreguidelines-avoid-non-const-global-variables,performance-no-int-to-ptr) G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) static void my_application_activate(GApplication *application) { diff --git a/env/checks.mk b/env/checks.mk index bd6d2f358..58ec97edc 100644 --- a/env/checks.mk +++ b/env/checks.mk @@ -15,6 +15,8 @@ checks += bugprone-* checks/bugprone-argument-comment.StrictMode := true checks += -bugprone-branch-clone checks += -bugprone-easily-swappable-parameters +# XXX: I should enable this check and do a comprehensive audit +checks += -bugprone-empty-catch # XXX: this is higher priority but I'm not ready for this yet checks += -bugprone-exception-escape checks/bugprone-exception-escape.IgnoredExceptions := "broken_promise" @@ -34,9 +36,12 @@ checks += -cert-env33-c checks += -cert-err58-cpp checks += clang-analyzer-* +# XXX: this flags something in boost multiprecision (of course) +checks += -clang-analyzer-core.BitwiseShift checks += cppcoreguidelines-* checks += -cppcoreguidelines-avoid-c-arrays +checks += -cppcoreguidelines-avoid-capturing-lambda-coroutines # this check is the exact opposite of a good guideline :/ checks += -cppcoreguidelines-avoid-const-or-ref-data-members checks += -cppcoreguidelines-avoid-do-while @@ -49,6 +54,10 @@ checks += -cppcoreguidelines-avoid-reference-coroutine-parameters checks += -cppcoreguidelines-init-variables # XXX: I didn't pay any attention to whether this check was interesting or not checks += -cppcoreguidelines-macro-usage +# this was accidentally helpful, actually, but isn't an acceptable decision :/ +checks += -cppcoreguidelines-misleading-capture-default-by-value +# this check doesn't handle unused parameters; am I doing this wrong?! +checks += -cppcoreguidelines-missing-std-forward checks += -cppcoreguidelines-non-private-member-variables-in-classes # XXX: the code which most hates this apparently does allow for memory leaks :( checks += -cppcoreguidelines-prefer-member-initializer @@ -57,8 +66,13 @@ checks += -cppcoreguidelines-pro-bounds-array-to-pointer-decay checks += -cppcoreguidelines-pro-bounds-pointer-arithmetic checks += -cppcoreguidelines-pro-type-reinterpret-cast checks += -cppcoreguidelines-pro-type-union-access +# XXX: this check is interesting, but I'm unsure about move/forward confusion +checks += -cppcoreguidelines-rvalue-reference-param-not-moved +checks/cppcoreguidelines-rvalue-reference-param-not-moved.IgnoreUnnamedParams := true # this check makes utility classes super frustrating :/ checks += -cppcoreguidelines-special-member-functions +# this check makes separates definitions of related variables +checks += -cppcoreguidelines-use-default-member-init # XXX: I'm using a lot of statically constructed objects #checks += fuchsia-statically-constructed-objects @@ -67,6 +81,9 @@ checks += fuchsia-virtual-inheritance checks += google-build-* checks += misc-* +# I love the idea of this check, but boost does this a lot +checks += -misc-header-include-cycle +checks += -misc-include-cleaner checks += -misc-misplaced-const checks += -misc-no-recursion # this check doesn't allow for any protected members :/ @@ -76,6 +93,8 @@ checks += -misc-unused-parameters checks += modernize-* checks += -modernize-avoid-c-arrays +# XXX: I don't want this, but it also crashes on boost::multiprecision::abs +checks += -modernize-use-constraints checks += -modernize-use-default-member-init checks += -modernize-use-nodiscard checks += -modernize-use-trailing-return-type @@ -84,6 +103,8 @@ checks += -modernize-use-using checks += performance-* checks/performance-move-const-arg.CheckTriviallyCopyableMove := 0 +# XXX: I am pretty sure I just disagree with this optimization +checks += -performance-avoid-endl checks += readability-const-return-type checks += readability-container-size-empty @@ -98,11 +119,6 @@ checks += readability-redundant-string-init checks += readability-static-definition-in-anonymous-namespace checks += readability-uniqueptr-delete-release -ifeq ($(target),and) -# XXX: boost multiprecision on android -#checks += -clang-analyzer-core.UndefinedBinaryOperatorResult -endif - ifeq ($(target),win) # XXX: boost::asio::detail::do_throw_error should be [[noreturn]] # (though, marking it [[noreturn]] didn't actually make it work) diff --git a/env/output.mk b/env/output.mk index 2d55e90bc..42d73b725 100644 --- a/env/output.mk +++ b/env/output.mk @@ -30,7 +30,7 @@ code = $(patsubst @/%,$(output)/$(arch)/%,$(header)) $(sysroot) # in this model, cflags would be something controlled only by the user flags_ = $(if $(filter ./,$(1)),,$(call flags_,$(dir $(patsubst %/,%,$(1)))) $(cflags/$(1))) flags- = $(call flags_,$(patsubst ./$(output)/%,%,$(patsubst ./$(output)/$(arch)/%,./$(output)/%,./$(dir $<)))) -flags = $(qflags) $(patsubst -I@/%,-I$(output)/$(arch)/%,$(filter -I%,$(cflags/./$<) $(flags-) $(cflags)) $(filter-out -I%,$(cflags) $(flags-) $(cflags/./$<))) +flags = $(filter-out $(dflags/./$<),$(qflags)) $(patsubst -I@/%,-I$(output)/$(arch)/%,$(filter -I%,$(cflags/./$<) $(flags-) $(cflags)) $(filter-out -I%,$(cflags) $(flags-) $(cflags/./$<))) flags += $(if $(filter $(output)/%,$<),-D__FILE__='"$(patsubst $(output)/%,%,$<)"' -Wno-builtin-macro-redefined) define compile diff --git a/env/setup-ndk.sh b/env/setup-ndk.sh index 0fd0f4eb7..08eb5ae57 100755 --- a/env/setup-ndk.sh +++ b/env/setup-ndk.sh @@ -1,4 +1,4 @@ #!/bin/bash set -e set -o pipefail -echo y | "${ANDROID_HOME}"/cmdline-tools/latest/bin/sdkmanager "build-tools;29.0.2" "ndk;26.3.11579264" "platforms;android-34" >/dev/null +echo y | "${ANDROID_HOME}"/cmdline-tools/latest/bin/sdkmanager "build-tools;29.0.2" "ndk;27.0.12077973" "platforms;android-34" >/dev/null diff --git a/lib-protocol/source/drain.hpp b/lib-protocol/source/drain.hpp index 1a4effd12..72e593a6d 100644 --- a/lib-protocol/source/drain.hpp +++ b/lib-protocol/source/drain.hpp @@ -90,7 +90,7 @@ class Sunk { } }; -template >().Inner())>::type> +template >().Inner())>> class Sink : public Super_, public Sunk diff --git a/lib-protocol/source/jsonrpc.hpp b/lib-protocol/source/jsonrpc.hpp index e2b5a1ef8..62f5a696d 100644 --- a/lib-protocol/source/jsonrpc.hpp +++ b/lib-protocol/source/jsonrpc.hpp @@ -79,7 +79,7 @@ struct Numeric { }; template -struct Coded::value>::type> : +struct Coded>> : public Numeric { static void Name(std::ostringstream &signature) { @@ -88,7 +88,7 @@ struct Coded::value>::typ }; template -struct Coded::value>::type> : +struct Coded>> : public Numeric { static void Name(std::ostringstream &signature) { @@ -97,7 +97,7 @@ struct Coded::value>::type> }; template -struct Coded>, typename std::enable_if::type> : +struct Coded>, typename std::enable_if_t> : public Numeric> 3), boost::multiprecision::number>> { static void Name(std::ostringstream &signature) { @@ -106,7 +106,7 @@ struct Coded -struct Coded>, typename std::enable_if::type> : +struct Coded>, typename std::enable_if_t> : public Numeric> 3), boost::multiprecision::number>> { static void Name(std::ostringstream &signature) { @@ -161,7 +161,7 @@ struct Coded { }; template -struct Coded, typename std::enable_if::type> { +struct Coded, typename std::enable_if_t> { static const bool dynamic_ = false; static void Name(std::ostringstream &signature) { diff --git a/lib-protocol/source/lwip.hpp b/lib-protocol/source/lwip.hpp index 317dad024..1c210b032 100644 --- a/lib-protocol/source/lwip.hpp +++ b/lib-protocol/source/lwip.hpp @@ -56,6 +56,7 @@ typedef int SOCKET; using namespace rtc; // Event constants for the Dispatcher class. +// NOLINTNEXTLINE(performance-enum-size) enum DispatcherEvent { DE_READ = 0x0001, DE_WRITE = 0x0002, diff --git a/lib-protocol/source/memory.cpp b/lib-protocol/source/memory.cpp index 36c329799..a71a42eac 100644 --- a/lib-protocol/source/memory.cpp +++ b/lib-protocol/source/memory.cpp @@ -34,8 +34,9 @@ // NOLINTBEGIN(cppcoreguidelines-avoid-non-const-global-variables) namespace orc { +namespace { -static int file_(-1); +int file_(-1); // XXX: there are a number of arrays in this file; are they correct? @@ -74,7 +75,7 @@ class Out { if (value == 0) *--end = '0'; else do { - unsigned digit(value % 10); + const unsigned digit(value % 10); value /= 10; *--end = static_cast('0' + digit); } while (value != 0); @@ -100,7 +101,7 @@ class Out { if (value == 0) *--end = '0'; else do { - unsigned digit(value & 0xf); + const unsigned digit(value & 0xf); value >>= 4; *--end = static_cast((digit < 10 ? '0' : 'a' - 10) + digit); } while (value != 0); @@ -110,9 +111,9 @@ class Out { } }; -static size_t total_(0); +size_t total_(0); -static void Audit(size_t add, size_t sub) { +void Audit(size_t add, size_t sub) { total_ += add; total_ -= sub; if (add < sub) @@ -122,8 +123,8 @@ static void Audit(size_t add, size_t sub) { Out() << total_ << " (" << (add - sub) << ")"; } -static decltype(std::declval<_malloc_zone_t *>()->malloc) apl_malloc; -static void *orc_malloc(struct _malloc_zone_t *zone, size_t size) { +decltype(std::declval<_malloc_zone_t *>()->malloc) apl_malloc; +void *orc_malloc(struct _malloc_zone_t *zone, size_t size) { auto value(apl_malloc(zone, size)); if (value == nullptr) return nullptr; @@ -134,8 +135,8 @@ static void *orc_malloc(struct _malloc_zone_t *zone, size_t size) { return value; } -static decltype(std::declval<_malloc_zone_t *>()->calloc) apl_calloc; -static void *orc_calloc(struct _malloc_zone_t *zone, size_t count, size_t size) { +decltype(std::declval<_malloc_zone_t *>()->calloc) apl_calloc; +void *orc_calloc(struct _malloc_zone_t *zone, size_t count, size_t size) { auto value(apl_calloc(zone, count, size)); if (value == nullptr) return nullptr; @@ -146,8 +147,8 @@ static void *orc_calloc(struct _malloc_zone_t *zone, size_t count, size_t size) return value; } -static decltype(std::declval<_malloc_zone_t *>()->valloc) apl_valloc; -static void *orc_valloc(struct _malloc_zone_t *zone, size_t size) { +decltype(std::declval<_malloc_zone_t *>()->valloc) apl_valloc; +void *orc_valloc(struct _malloc_zone_t *zone, size_t size) { auto value(apl_valloc(zone, size)); if (value == nullptr) return nullptr; @@ -158,8 +159,8 @@ static void *orc_valloc(struct _malloc_zone_t *zone, size_t size) { return value; } -static decltype(std::declval<_malloc_zone_t *>()->realloc) apl_realloc; -static void *orc_realloc(struct _malloc_zone_t *zone, void *old, size_t size) { +decltype(std::declval<_malloc_zone_t *>()->realloc) apl_realloc; +void *orc_realloc(struct _malloc_zone_t *zone, void *old, size_t size) { auto before(zone->size(zone, old)); auto value(apl_realloc(zone, old, size)); auto after(zone->size(zone, value)); @@ -169,8 +170,8 @@ static void *orc_realloc(struct _malloc_zone_t *zone, void *old, size_t size) { return value; } -static decltype(std::declval<_malloc_zone_t *>()->free) apl_free; -static void orc_free(struct _malloc_zone_t *zone, void *value) { +decltype(std::declval<_malloc_zone_t *>()->free) apl_free; +void orc_free(struct _malloc_zone_t *zone, void *value) { auto full(zone->size(zone, value)); if (file_ != -1) Out() << "free(" << value << ")"; @@ -178,33 +179,33 @@ static void orc_free(struct _malloc_zone_t *zone, void *value) { return apl_free(zone, value); } -static decltype(std::declval<_malloc_zone_t *>()->batch_malloc) apl_batch_malloc; -static unsigned orc_batch_malloc(struct _malloc_zone_t *zone, size_t size, void **values, unsigned count) { +decltype(std::declval<_malloc_zone_t *>()->batch_malloc) apl_batch_malloc; +unsigned orc_batch_malloc(struct _malloc_zone_t *zone, size_t size, void **values, unsigned count) { count = apl_batch_malloc(zone, size, values, count); size_t full(0); for (size_t i(0); i != count; ++i) { full += zone->size(zone, values[i]); if (file_ != -1) - Out() << "batch_malloc(" << size << ", " << values << "[" << i << "]) = " << values[i]; + Out() << "batch_malloc(" << size << ", " << reinterpret_cast(values) << "[" << i << "]) = " << values[i]; } Audit(full, 0); return count; } -static decltype(std::declval<_malloc_zone_t *>()->batch_free) apl_batch_free; -static void orc_batch_free(struct _malloc_zone_t *zone, void **values, unsigned count) { +decltype(std::declval<_malloc_zone_t *>()->batch_free) apl_batch_free; +void orc_batch_free(struct _malloc_zone_t *zone, void **values, unsigned count) { size_t full(0); for (size_t i(0); i != count; ++i) { full += zone->size(zone, values[i]); if (file_ != -1) - Out() << "batch_free(" << values << "[" << i << "] = " << values[i] << ")"; + Out() << "batch_free(" << reinterpret_cast(values) << "[" << i << "] = " << values[i] << ")"; } Audit(0, full); return apl_batch_free(zone, values, count); } -static decltype(std::declval<_malloc_zone_t *>()->memalign) apl_memalign; -static void *orc_memalign(struct _malloc_zone_t *zone, size_t alignment, size_t size) { +decltype(std::declval<_malloc_zone_t *>()->memalign) apl_memalign; +void *orc_memalign(struct _malloc_zone_t *zone, size_t alignment, size_t size) { auto value(apl_memalign(zone, alignment, size)); auto full(zone->size(zone, value)); if (file_ != -1) @@ -213,8 +214,8 @@ static void *orc_memalign(struct _malloc_zone_t *zone, size_t alignment, size_t return value; } -static decltype(std::declval<_malloc_zone_t *>()->free_definite_size) apl_free_definite_size; -static void orc_free_definite_size(struct _malloc_zone_t *zone, void *value, size_t size) { +decltype(std::declval<_malloc_zone_t *>()->free_definite_size) apl_free_definite_size; +void orc_free_definite_size(struct _malloc_zone_t *zone, void *value, size_t size) { auto full(zone->size(zone, value)); if (file_ != -1) Out() << "free_definite_size(" << value << ", " << size << ")"; @@ -229,6 +230,9 @@ static void orc_free_definite_size(struct _malloc_zone_t *zone, void *value, siz zone->name = &orc_ ## name; \ } while (false) +} } + +namespace orc { void Hook() { return; @@ -257,9 +261,7 @@ void Hook() { orc_swizzle(batch_free); orc_swizzle(memalign); orc_swizzle(free_definite_size); -} - -} +} } #else namespace orc { diff --git a/lib-protocol/source/nest.hpp b/lib-protocol/source/nest.hpp index c5de2d43b..49cd9907e 100644 --- a/lib-protocol/source/nest.hpp +++ b/lib-protocol/source/nest.hpp @@ -94,7 +94,7 @@ class Nest final : } template - auto Hatch(Code_ code, const char *name) noexcept -> typename std::enable_if::type { + auto Hatch(Code_ code, const char *name) noexcept -> typename std::enable_if_t { Count count(this); if (count > limit_) return false; diff --git a/lib-protocol/source/spawn.hpp b/lib-protocol/source/spawn.hpp index a434218cc..a19721cc3 100644 --- a/lib-protocol/source/spawn.hpp +++ b/lib-protocol/source/spawn.hpp @@ -110,7 +110,7 @@ class Detached { }; template -auto Spawn(Code_ code, const char *name) noexcept -> typename std::enable_if::type { +auto Spawn(Code_ code, const char *name) noexcept -> typename std::enable_if_t { [](Code_ code, const char *name) mutable noexcept -> Detached { co_await Schedule(); #ifdef ORC_FIBER diff --git a/lib-protocol/source/transport.cpp b/lib-protocol/source/transport.cpp index 743a2c6e5..b02b4b33f 100644 --- a/lib-protocol/source/transport.cpp +++ b/lib-protocol/source/transport.cpp @@ -332,7 +332,7 @@ class Middle : } openvpn::TunClient::Ptr new_tun_client_obj(openvpn_io::io_context &context, openvpn::TunClientParent &parent, openvpn::TransportClient *transport) noexcept override { - return new Tunnel(middle_, config_, context, parent); + return {new Tunnel(middle_, config_, context, parent)}; } }; @@ -365,10 +365,12 @@ class Middle : } openvpn::TransportClientFactory *new_transport_factory(const openvpn::ExternalTransport::Config &config) noexcept override { + // NOLINTNEXTLINE(cppcoreguidelines-owning-memory) return new orc::Factory(base_, config); } openvpn::TunClientFactory *new_tun_factory(const openvpn::ExternalTun::Config &config, const openvpn::OptionList &options) noexcept override { + // NOLINTNEXTLINE(cppcoreguidelines-owning-memory) return new Factory(*this, config); } diff --git a/lib-shared/source/address.hpp b/lib-shared/source/address.hpp index 77eb92f72..c7f927909 100644 --- a/lib-shared/source/address.hpp +++ b/lib-shared/source/address.hpp @@ -36,6 +36,8 @@ class Address : private uint160_t { public: + // XXX: this check is false positive here + // NOLINTNEXTLINE(modernize-type-traits) using uint160_t::uint160_t; Address(const uint160_t &value) : diff --git a/lib-shared/source/buffer.hpp b/lib-shared/source/buffer.hpp index 1f5ca4f4a..e16b9c640 100644 --- a/lib-shared/source/buffer.hpp +++ b/lib-shared/source/buffer.hpp @@ -153,7 +153,7 @@ template struct Cast; template -struct Cast::value>::type> { +struct Cast>> { static auto Load(const uint8_t *data, size_t size) { orc_assert(size == sizeof(Type_)); return boost::endian::big_to_native(*reinterpret_cast(data)); @@ -161,7 +161,7 @@ struct Cast::value>::ty }; template -struct Cast>, typename std::enable_if::type> { +struct Cast>, typename std::enable_if_t> { static auto Load(const uint8_t *data, size_t size) { orc_assert(size == Bits_ / 8); boost::multiprecision::number> value; @@ -171,7 +171,7 @@ struct Cast -struct Cast, typename std::enable_if::type> { +struct Cast, typename std::enable_if_t> { static auto Load(const uint8_t *data, size_t size) { orc_assert(size == Bits_ / 8); return intx::be::load>(*reinterpret_cast(data)); @@ -735,7 +735,7 @@ inline Brick operator ^(const Data &lhs, const Data &rhs) { return value; } -template ::value> +template > class Number; template @@ -1041,12 +1041,12 @@ inline bool Each(const char &data, const std::function -inline typename std::enable_if::value && !std::is_same_v, bool>::type Each(const Type_ &value, const std::function &code) { +inline typename std::enable_if_t && !std::is_same_v, bool> Each(const Type_ &value, const std::function &code) { return Number(value).each(code); } template -inline typename std::enable_if::type Each(const boost::multiprecision::number> &value, const std::function &code) { +inline typename std::enable_if_t Each(const boost::multiprecision::number> &value, const std::function &code) { return Number>>(value).each(code); } @@ -1355,7 +1355,7 @@ static bool Take(Tuple_ &tuple, Window &window, Buffer_ &&buffer) { } }; template -struct Taking>, typename std::enable_if::type, Taking_...> final { +struct Taking>, typename std::enable_if_t, Taking_...> final { template static bool Take(Tuple_ &tuple, Window &window, Buffer_ &&buffer) { Brick brick; @@ -1365,7 +1365,7 @@ static bool Take(Tuple_ &tuple, Window &window, Buffer_ &&buffer) { } }; template -struct Taking::value>::type, Taking_...> { +struct Taking>, Taking_...> { template static bool Take(Tuple_ &tuple, Window &window, Buffer_ &&buffer) { Brick brick; @@ -1378,7 +1378,7 @@ template struct Taking { template static bool Take(Tuple_ &tuple, Window &window, Buffer_ &&buffer) { - static_assert(!std::is_rvalue_reference::value); + static_assert(!std::is_rvalue_reference_v); std::get(tuple) = std::move(window); return false; } }; diff --git a/min-wireshark/target.mk b/min-wireshark/target.mk index 3323619a0..ffeeaf7c2 100644 --- a/min-wireshark/target.mk +++ b/min-wireshark/target.mk @@ -139,6 +139,16 @@ cflags/$(pwd/wireshark)/ += -Wno-pointer-sign # XXX: fwrite used without check; submit patch cflags/$(pwd/wireshark)/ += -Wno-unused-result +# XXX: packet-5co-legacy.c:923:9: error: 'snprintf' will always be truncated; specified size is 8, but format string expands to at least 9 [-Werror,-Wformat-truncation] +# snprintf( result, 8, "Disabled"); +# ^ +cflags/$(pwd/wireshark)/epan/dissectors/packet-5co-legacy.c += -Wno-format-truncation + +# XXX: packet-ipars.c:131:33: error: 'snprintf' will always be truncated; specified size is 16, but format string expands to at least 24 [-Werror,-Wformat-truncation] +# default: snprintf(eom_msg, MAX_EOM_MSG_SIZE, "Unknown EOM type (0x%2.2X)", ia); break; +# ^ +cflags/$(pwd/wireshark)/epan/dissectors/packet-ipars.c += -Wno-format-truncation + # XXX: this is only used if you have libgnutls and I don't know what I think about that :/ cflags/$(pwd/wireshark)/epan/dissectors/packet-tls-utils.c += -Wno-unused-but-set-variable diff --git a/srv-daemon/source/egress.cpp b/srv-daemon/source/egress.cpp index 16d64d07f..2084857b3 100644 --- a/srv-daemon/source/egress.cpp +++ b/srv-daemon/source/egress.cpp @@ -154,6 +154,9 @@ task Egress::Translator::Send(const Buffer &data) { Forge(icmp, &openvpn::ICMPv4::id, translated.Port()); co_return co_await egress_->Send(beam); } break; + + default: { + } break; } } @@ -193,6 +196,9 @@ void Egress::Land(const Buffer &data) { return translation->translator_.Land(beam); } } break; + + default: { + } break; } } diff --git a/srv-daemon/source/lottery.cpp b/srv-daemon/source/lottery.cpp index 65def39f5..b83d3a32e 100644 --- a/srv-daemon/source/lottery.cpp +++ b/srv-daemon/source/lottery.cpp @@ -31,7 +31,7 @@ std::ostream &operator <<(std::ostream &out, const Pot &pot) { } void Lottery::Open() { - Spawn([=]() mutable noexcept -> task { + Spawn([this]() mutable noexcept -> task { for (auto height(co_await Height());;) try { co_await Sleep(10*1000); auto next(co_await Height()); diff --git a/srv-daemon/source/lottery0.hpp b/srv-daemon/source/lottery0.hpp index 97af25649..b76b6c7c3 100644 --- a/srv-daemon/source/lottery0.hpp +++ b/srv-daemon/source/lottery0.hpp @@ -84,10 +84,10 @@ class Lottery0 : Bytes /*receipt*/, std::vector /*old*/ > grab("grab"); - Spawn([=]() mutable noexcept -> task { + Spawn([this, executor, args...]() mutable noexcept -> task { for (;;) { orc_ignore({ - co_await executor->Send(*token_.market_.chain_, {}, contract_, 0, grab(std::forward(args)...)); + co_await executor->Send(*token_.market_.chain_, {}, contract_, 0, grab(args...)); break; }); diff --git a/srv-daemon/source/lottery1.hpp b/srv-daemon/source/lottery1.hpp index 86505eda6..83c916fb0 100644 --- a/srv-daemon/source/lottery1.hpp +++ b/srv-daemon/source/lottery1.hpp @@ -74,7 +74,7 @@ class Lottery1 : std::vector /*refunds*/ > claim("claim"); - Spawn([=]() mutable noexcept -> task { + Spawn([this, executor, recipient, payment]() mutable noexcept -> task { for (;;) { orc_ignore({ co_await executor->Send(*market_.chain_, {}, contract_, 0, claim({}, recipient, {payment}, {})); diff --git a/srv-daemon/source/server.cpp b/srv-daemon/source/server.cpp index b2e1f5a88..bfbd51a22 100644 --- a/srv-daemon/source/server.cpp +++ b/srv-daemon/source/server.cpp @@ -200,7 +200,7 @@ void Server::Submit0(Pipe *pipe, const Socket &source, const Bytes32 &id nonces.erase(oldest); } - const auto reveal([&, &commit = commit]() { + const auto reveal([&]() { for (const auto &reveal : locked->reveals_) if (HashK(reveal.first) == commit) { const auto &expire(reveal.second); @@ -217,8 +217,9 @@ void Server::Submit0(Pipe *pipe, const Socket &source, const Bytes32 &id Commit(locked); std::make_tuple(reveal, winner); }); - // XXX: the C++ prohibition on automatic capture of a binding name because it isn't a "variable" is ridiculous - nest_.Hatch([&, &commit = commit, &issued = issued, &nonce = nonce, &v = v, &r = r, &s = s, &amount = amount, &ratio = ratio, &start = start, &range = range, &funder = funder, &recipient = recipient, &reveal = reveal, &winner = winner]() noexcept { return [=]() noexcept -> task { try { + // XXX: this is related to the long-standing issue with boost multiprecision and clang-tidy + // NOLINTNEXTLINE(clang-analyzer-core.CallAndMessage) + nest_.Hatch([&]() noexcept { return [=, this]() noexcept -> task { try { const auto usable(co_await lottery->Check(signer, funder, recipient)); const auto valid(usable >= amount); @@ -306,7 +307,7 @@ void Server::Submit1(Pipe *pipe, const Socket &source, const Bytes32 &id nonces.erase(oldest); } - const auto reveal([&, &commit = commit]() { + const auto reveal([&]() { for (const auto &reveal : locked->reveals_) if (HashK(reveal.first) == commit) { const auto &expire(reveal.second); @@ -323,8 +324,9 @@ void Server::Submit1(Pipe *pipe, const Socket &source, const Bytes32 &id Commit(locked); std::make_tuple(reveal, winner); }); - // XXX: the C++ prohibition on automatic capture of a binding name because it isn't a "variable" is ridiculous - nest_.Hatch([&, &amount = amount, &funder = funder, &recipient = recipient, &reveal = reveal, &winner = winner]() noexcept { return [=]() noexcept -> task { try { + // XXX: this is related to the long-standing issue with boost multiprecision and clang-tidy + // NOLINTNEXTLINE(clang-analyzer-core.CallAndMessage) + nest_.Hatch([&]() noexcept { return [=, this]() noexcept -> task { try { const auto usable(co_await lottery->Check(signer, funder, recipient)); const auto valid(usable >= amount); @@ -361,7 +363,7 @@ void Server::Land(Pipe *pipe, const Buffer &data) { orc_ignore({ const auto &[magic, id] = header; orc_assert(magic == Magic_); - Scan(window, [&, &id = id](const Buffer &data) { try { + Scan(window, [&](const Buffer &data) { try { const auto [command, window] = Take(data); if (false); else if (command == Submit0_) diff --git a/srv-kernel/makefile b/srv-kernel/makefile index 318110ebf..c05886b5d 100644 --- a/srv-kernel/makefile +++ b/srv-kernel/makefile @@ -93,6 +93,7 @@ qflags += -mno-red-zone qflags += -mno-sse cflags/$(pwd)/source/paging.cpp += -m32 cflags/$(pwd)/source/paging.cpp += -g0 +dflags/$(pwd)/source/paging.cpp += -mcmodel=% oflags/$(pwd)/source/paging.cpp += -O elf64-x86-64 endif diff --git a/srv-worker/capnproto.mk b/srv-worker/capnproto.mk index 22e4724c7..6f722c98c 100644 --- a/srv-worker/capnproto.mk +++ b/srv-worker/capnproto.mk @@ -40,4 +40,6 @@ $(output)/capnp/%.capnp.h: %.capnp $(capnp) cflags += -I$(pwd)/capnproto/c++/src cflags += -I$(output)/capnp/capnproto/c++/src +cflags/$(pwd)/capnproto/ += -Wno-deprecated-this-capture + source += $(shell find $(pwd)/capnproto/c++/src/kj -name '*.c++' -not -name '*test.c++') diff --git a/vpn-apple/source/family.hpp b/vpn-apple/source/family.hpp index 849239825..ee2151a20 100644 --- a/vpn-apple/source/family.hpp +++ b/vpn-apple/source/family.hpp @@ -39,8 +39,8 @@ class Family : switch (protocol) { case 4: return AF_INET; case 6: return AF_INET6; + default: return 0; } - return 0; } protected: diff --git a/vpn-apple/source/protect.cpp b/vpn-apple/source/protect.cpp index 25c0efdd0..9d4cc8b59 100644 --- a/vpn-apple/source/protect.cpp +++ b/vpn-apple/source/protect.cpp @@ -36,7 +36,7 @@ namespace orc { int Protect(int socket, int (*attach)(int, const sockaddr *, socklen_t), const sockaddr *address, socklen_t length) { - std::unique_ptr interfaces([]() { + const std::unique_ptr interfaces([]() { ifaddrs *interfaces; orc_assert(getifaddrs(&interfaces) != -1); return interfaces; diff --git a/vpn-shared/source/capture.cpp b/vpn-shared/source/capture.cpp index 1fb56a8dd..8ccc6c455 100644 --- a/vpn-shared/source/capture.cpp +++ b/vpn-shared/source/capture.cpp @@ -216,7 +216,7 @@ void Capture::Land(const Buffer &data) { orc_ignore({ if (Datagram(data, [&](const Socket &source, const Socket &destination, const Buffer &data) { if (destination != Socket(Resolver_, 53)) return false; - up_.Hatch([&]() noexcept { return [=, data = Beam(data)]() mutable -> task { + up_.Hatch([&]() noexcept { return [this, source, destination, data = Beam(data)]() mutable -> task { const Query query(data.span()); const auto resolver([&]() { @@ -625,6 +625,9 @@ task Transform::Send(const Beam &data) { Log() << "ICMP" << subset << std::endl; co_return true; } break; + + default: + break; } co_return false; diff --git a/vpn-shared/source/client.cpp b/vpn-shared/source/client.cpp index a46a6c919..58d98dc3a 100644 --- a/vpn-shared/source/client.cpp +++ b/vpn-shared/source/client.cpp @@ -111,7 +111,7 @@ void Client::Land(Pipe *pipe, const Buffer &data) { const auto &[magic, id] = header; orc_assert(magic == Magic_); - Scan(window, [&, &id = id](const Buffer &data) { try { + Scan(window, [&](const Buffer &data) { try { Invoice(id, data); } orc_catch({}) }); } orc_catch({}) return true; })) {