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
2 changes: 1 addition & 1 deletion ci/configs/default.bash
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CI_DESC="CI job using default libraries and tools, and running IWYU"
CI_DIR=build-default
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wundef -Wunused-const-variable -Wno-unused-parameter -Wextra-semi -Wmissing-noreturn -Wtrailing-whitespace"
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wundef -Wunused -Wunused-const-variable -Wextra-semi -Wmissing-noreturn -Wtrailing-whitespace"
CMAKE_ARGS=(-DMP_ENABLE_IWYU=ON)
BUILD_ARGS=(-k)
2 changes: 1 addition & 1 deletion ci/configs/freebsd.bash
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CI_DESC="CI config for FreeBSD"
CI_DIR=build-freebsd
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wno-unused-parameter -Wno-c++23-lambda-attributes"
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wunused -Wunused-const-variable -Wno-c++23-lambda-attributes"
CMAKE_ARGS=(-G Ninja)
BUILD_ARGS=(-k 0)
2 changes: 1 addition & 1 deletion ci/configs/gnu32.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ NIX_ARGS=(
--arg minimal true
--arg crossPkgs 'import <nixpkgs> { crossSystem = { config = "i686-unknown-linux-gnu"; }; }'
)
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wunused-const-variable -Wno-unused-parameter"
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wunused -Wunused-const-variable"
CMAKE_ARGS=(-G Ninja)
BUILD_ARGS=(-k 0)
2 changes: 1 addition & 1 deletion ci/configs/llvm.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CI_DESC="CI job using LLVM-based libraries and tools (clang, libc++, clang-tidy,
CI_DIR=build-llvm
NIX_ARGS=(--arg enableLibcxx true)
export CXX=clang++
export CXXFLAGS="-Werror -Wall -Wextra -Wextra-semi -Wpedantic -Wundef -Wthread-safety -Wno-unused-parameter -Wno-c++23-lambda-attributes"
export CXXFLAGS="-Werror -Wall -Wextra -Wextra-semi -Wpedantic -Wundef -Wthread-safety -Wunused -Wunused-const-variable -Wno-c++23-lambda-attributes"
CMAKE_ARGS=(
-G Ninja
-DMP_ENABLE_CLANG_TIDY=ON
Expand Down
2 changes: 1 addition & 1 deletion ci/configs/macos.bash
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CI_DESC="CI config for macOS"
CI_DIR=build-macos
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wno-unused-parameter -Wno-c++23-lambda-attributes"
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wunused -Wunused-const-variable -Wno-c++23-lambda-attributes"
CMAKE_ARGS=(-G Ninja -DMP_ENABLE_CLANG_TIDY=ON)
BUILD_ARGS=(-k 0)
2 changes: 1 addition & 1 deletion ci/configs/netbsd.bash
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CI_DESC="CI config for NetBSD"
CI_DIR=build-netbsd
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wno-unused-parameter ${CXXFLAGS:-}"
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wunused -Wunused-const-variable ${CXXFLAGS:-}"
CMAKE_ARGS=(-G Ninja)
BUILD_ARGS=(-k 0)
2 changes: 1 addition & 1 deletion ci/configs/newdeps.bash
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CI_DESC="CI job using newest Cap'n Proto and cmake versions"
CI_DIR=build-newdeps
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wunused-const-variable -Wno-unused-parameter -Wno-error=array-bounds"
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wunused -Wunused-const-variable -Wno-error=array-bounds"
CAPNP_CHECKOUT=master # This is the v1.x release branch
NIX_ARGS=(--argstr capnprotoVersion "none" --argstr cmakeVersion "4.3.4")
BUILD_ARGS=(-k)
2 changes: 1 addition & 1 deletion ci/configs/olddeps.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CI_DESC="CI job using old Cap'n Proto and cmake versions"
CI_DIR=build-olddeps
# Pin olddeps to an older Nixpkgs channel, to be able to test an older GCC.
CI_NIXPKGS_CHANNEL=nixos-25.05
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wunused-const-variable -Wno-unused-parameter -Wno-error=array-bounds"
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wunused -Wunused-const-variable -Wno-error=array-bounds"
CAPNP_CHECKOUT=v0.9.2 # Use a checkout to compile it with the selected GCC
NIX_ARGS=(--argstr capnprotoVersion "none" --argstr cmakeVersion "3.12.4" --argstr gccVersion "10")
BUILD_ARGS=(-k)
2 changes: 1 addition & 1 deletion ci/configs/openbsd.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ CI_DIR=build-openbsd
# The -Wno-c2y-extensions flag can be dropped once the change
# from commit 3724713e82456ce7d66d1f377539dd2e142d969a becomes
# available in Clang.
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wno-unused-parameter -Wno-c++23-lambda-attributes -Wno-c2y-extensions"
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wunused -Wunused-const-variable -Wno-c++23-lambda-attributes -Wno-c2y-extensions"
CMAKE_ARGS=(-G Ninja)
BUILD_ARGS=(-k 0)
2 changes: 1 addition & 1 deletion ci/configs/sanitize.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CI_DESC="CI job running ThreadSanitizer"
CI_DIR=build-sanitize
NIX_ARGS=(--arg enableLibcxx true --argstr libcxxSanitizers "Thread" --argstr capnprotoSanitizers "thread")
export CXX=clang++
export CXXFLAGS="-ggdb -Werror -Wall -Wextra -Wpedantic -Wthread-safety -Wno-unused-parameter -fsanitize=thread -Wno-c++23-lambda-attributes"
export CXXFLAGS="-ggdb -Werror -Wall -Wextra -Wpedantic -Wthread-safety -Wunused -Wunused-const-variable -fsanitize=thread -Wno-c++23-lambda-attributes"
CMAKE_ARGS=()
BUILD_ARGS=(-k)
BUILD_TARGETS=(mptest)
8 changes: 4 additions & 4 deletions cmake/pthread_checks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cmake_push_check_state()
set(CMAKE_REQUIRED_LIBRARIES Threads::Threads)
check_cxx_source_compiles("
#include <pthread.h>
int main(int argc, char** argv)
int main()
{
char thread_name[16];
return pthread_getname_np(pthread_self(), thread_name, sizeof(thread_name));
Expand All @@ -21,7 +21,7 @@ check_cxx_source_compiles("

check_cxx_source_compiles("
#include <pthread.h>
int main(int argc, char** argv)
int main()
{
return pthread_setname_np(pthread_self(), \"%s\", (void*)\"name\");
}"
Expand All @@ -30,7 +30,7 @@ check_cxx_source_compiles("
check_cxx_source_compiles("
#include <cstdint>
#include <pthread.h>
int main(int argc, char** argv)
int main()
{
uint64_t tid;
pthread_threadid_np(nullptr, &tid);
Expand All @@ -41,7 +41,7 @@ check_cxx_source_compiles("
check_cxx_source_compiles("
#include <pthread.h>
#include <pthread_np.h>
int main(int argc, char** argv)
int main()
{
return pthread_getthreadid_np();
}"
Expand Down
2 changes: 1 addition & 1 deletion example/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Init
public:
virtual ~Init() = default;
virtual std::unique_ptr<Printer> makePrinter() { return nullptr; }
virtual std::unique_ptr<Calculator> makeCalculator(std::unique_ptr<Printer> printer) { return nullptr; }
virtual std::unique_ptr<Calculator> makeCalculator(std::unique_ptr<Printer>) { return nullptr; }
};

#endif // EXAMPLE_INIT_H
11 changes: 6 additions & 5 deletions include/mp/proxy-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ struct ReadDestUpdate
//! can only be used to disable ReadField() calls in certain contexts like
//! std::optional and pointer contexts.
template <typename... LocalTypes, typename Input>
bool CustomHasField(TypeList<LocalTypes...>, InvokeContext& invoke_context, const Input& input)
bool CustomHasField(TypeList<LocalTypes...>, InvokeContext&, const Input& input)
{
return input.has();
}
Expand All @@ -233,7 +233,7 @@ void ThrowField(TypeList<LocalType>, InvokeContext& invoke_context, Input&& inpu
//! be created directly. Rethrow as std::runtime_error so callers expecting it
//! will still catch it.
template <typename Input>
void ThrowField(TypeList<std::exception>, InvokeContext& invoke_context, Input&& input)
void ThrowField(TypeList<std::exception>, InvokeContext&, Input&& input)
{
auto data = input.get();
throw std::runtime_error(std::string(CharCast(data.begin()), data.size()));
Expand All @@ -247,7 +247,7 @@ void ThrowField(TypeList<std::exception>, InvokeContext& invoke_context, Input&&
//! way to represent them in Cap'n Proto and a null Data field is a convenient
//! representation.
template <typename... Values>
bool CustomHasValue(InvokeContext& invoke_context, const Values&... value)
bool CustomHasValue(InvokeContext&, const Values&...)
{
return true;
}
Expand Down Expand Up @@ -459,7 +459,7 @@ struct ClientException
struct BuildParams : IterateFieldsHelper<BuildParams, 0>
{
template <typename Params, typename ParamList>
void handleField(InvokeContext& invoke_context, Params& params, ParamList)
void handleField(InvokeContext&, Params&, ParamList)
{
}

Expand Down Expand Up @@ -624,7 +624,8 @@ struct ServerExcept : Parent
//! Helper for CustomPassField below. Call Accessor::get method if it has one,
//! otherwise return capnp::Void.
template <typename Accessor, typename Message>
decltype(auto) MaybeGet(Message&& message, decltype(Accessor::get(message))* enable = nullptr)
decltype(auto) MaybeGet(Message&& message)
requires requires { Accessor::get(message); }
{
return Accessor::get(message);
}
Expand Down
4 changes: 2 additions & 2 deletions include/mp/type-chrono.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace mp {
//! Overload CustomBuildField and CustomReadField to serialize std::chrono
//! parameters and return values as numbers.
template <class Rep, class Period, typename Value, typename Output>
void CustomBuildField(TypeList<std::chrono::duration<Rep, Period>>, Priority<1>, InvokeContext& invoke_context, Value&& value,
void CustomBuildField(TypeList<std::chrono::duration<Rep, Period>>, Priority<1>, InvokeContext&, Value&& value,
Output&& output)
{
static_assert(safe_less_equal(std::numeric_limits<decltype(output.get())>::lowest(), std::numeric_limits<Rep>::lowest()),
Expand All @@ -35,7 +35,7 @@ decltype(auto) CustomReadField(TypeList<std::chrono::duration<Rep, Period>>, Pri
//! The capnp field type must be an integer type with enough range to hold the
//! time_since_epoch() count for the given Duration (e.g. Int64 for nanoseconds).
template <class Clock, class Duration, typename Value, typename Output>
void CustomBuildField(TypeList<std::chrono::time_point<Clock, Duration>>, Priority<1>, InvokeContext& invoke_context,
void CustomBuildField(TypeList<std::chrono::time_point<Clock, Duration>>, Priority<1>, InvokeContext&,
Value&& value, Output&& output)
{
using Rep = typename Duration::rep;
Expand Down
4 changes: 2 additions & 2 deletions include/mp/type-data.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ concept IsByteSpan =
//! blob types like uint256 or PKHash with data() and size() methods pointing to
//! bytes.
template <typename LocalType, typename Value, typename Output>
void CustomBuildField(TypeList<LocalType>, Priority<2>, InvokeContext& invoke_context, Value&& value, Output&& output)
void CustomBuildField(TypeList<LocalType>, Priority<2>, InvokeContext&, Value&& value, Output&& output)
requires (std::is_same_v<decltype(output.get()), ::capnp::Data::Builder> && IsByteSpan<LocalType>)
{
auto result = output.init(value.size());
std::ranges::copy(value, result.begin());
}

template <typename LocalType, typename Input, typename ReadDest>
decltype(auto) CustomReadField(TypeList<LocalType>, Priority<2>, InvokeContext& invoke_context, Input&& input, ReadDest&& read_dest)
decltype(auto) CustomReadField(TypeList<LocalType>, Priority<2>, InvokeContext&, Input&& input, ReadDest&& read_dest)
requires (std::is_same_v<decltype(input.get()), ::capnp::Data::Reader> && IsByteSpan<LocalType>)
{
using ByteType = decltype(std::span{std::declval<LocalType>().begin(), std::declval<LocalType>().end()})::element_type;
Expand Down
12 changes: 6 additions & 6 deletions include/mp/type-message.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace mp {
//! CustomBuildField overload because it only requires defining a normal
//! function, not a template function, but less flexible.
template <typename LocalType, typename Value, typename Output>
void CustomBuildField(TypeList<LocalType>, Priority<2>, InvokeContext& invoke_context, Value&& value, Output&& output,
decltype(CustomBuildMessage(invoke_context, value, std::move(output.get())))* enable = nullptr)
void CustomBuildField(TypeList<LocalType>, Priority<2>, InvokeContext& invoke_context, Value&& value, Output&& output)
requires requires { CustomBuildMessage(invoke_context, value, std::move(output.get())); }
{
CustomBuildMessage(invoke_context, value, std::move(output.init()));
}
Expand All @@ -25,17 +25,17 @@ void CustomBuildField(TypeList<LocalType>, Priority<2>, InvokeContext& invoke_co
//! function, not a template function, but less flexible.
template <typename LocalType, typename Input, typename ReadDest>
decltype(auto) CustomReadField(TypeList<LocalType>, Priority<2>, InvokeContext& invoke_context, Input&& input,
ReadDest&& read_dest,
decltype(CustomReadMessage(invoke_context, input.get(),
std::declval<LocalType&>()))* enable = nullptr)
ReadDest&& read_dest)
requires requires { CustomReadMessage(invoke_context, input.get(), std::declval<LocalType&>()); }
{
return read_dest.update([&](auto& value) { if (CustomHasField(TypeList<LocalType>(), invoke_context, input)) CustomReadMessage(invoke_context, input.get(), value); });
}

//! Helper for CustomPassField below. Call Accessor::init method if it has one,
//! otherwise do nothing.
template <typename Accessor, typename Message>
decltype(auto) MaybeInit(Message&& message, decltype(Accessor::get(message))* enable = nullptr)
decltype(auto) MaybeInit(Message&& message)
requires requires { Accessor::get(message); }
{
return Accessor::init(message);
}
Expand Down
14 changes: 7 additions & 7 deletions include/mp/type-number.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace mp {
template <typename LocalType, typename Value>
requires std::is_enum_v<Value>
LocalType BuildPrimitive(InvokeContext& invoke_context,
LocalType BuildPrimitive(InvokeContext&,
const Value& value,
TypeList<LocalType>)
{
Expand All @@ -23,7 +23,7 @@ LocalType BuildPrimitive(InvokeContext& invoke_context,

template <typename LocalType, typename Value>
requires (std::is_integral_v<Value> && !std::is_same_v<std::remove_cv_t<Value>, bool>)
LocalType BuildPrimitive(InvokeContext& invoke_context,
LocalType BuildPrimitive(InvokeContext&,
const Value& value,
TypeList<LocalType>)
{
Expand All @@ -35,7 +35,7 @@ LocalType BuildPrimitive(InvokeContext& invoke_context,
}

template <typename LocalType>
LocalType BuildPrimitive(InvokeContext& invoke_context, bool value, TypeList<LocalType>)
LocalType BuildPrimitive(InvokeContext&, bool value, TypeList<LocalType>)
{
static_assert(std::is_same_v<LocalType, bool>,
"capnp field type should be Bool for bool parameters. Fix the .capnp schema.");
Expand All @@ -44,7 +44,7 @@ LocalType BuildPrimitive(InvokeContext& invoke_context, bool value, TypeList<Loc

template <typename LocalType, typename Value>
requires std::is_floating_point_v<Value>
LocalType BuildPrimitive(InvokeContext& invoke_context,
LocalType BuildPrimitive(InvokeContext&,
const Value& value,
TypeList<LocalType>)
{
Expand All @@ -57,7 +57,7 @@ template <typename LocalType, typename Input, typename ReadDest>
requires std::is_enum_v<LocalType>
decltype(auto) CustomReadField(TypeList<LocalType>,
Priority<1>,
InvokeContext& invoke_context,
InvokeContext&,
Input&& input,
ReadDest&& read_dest)
{
Expand All @@ -74,7 +74,7 @@ template <typename LocalType, typename Input, typename ReadDest>
requires std::is_integral_v<LocalType>
decltype(auto) CustomReadField(TypeList<LocalType>,
Priority<1>,
InvokeContext& invoke_context,
InvokeContext&,
Input&& input,
ReadDest&& read_dest)
{
Expand All @@ -89,7 +89,7 @@ template <typename LocalType, typename Input, typename ReadDest>
requires std::is_floating_point_v<LocalType>
decltype(auto) CustomReadField(TypeList<LocalType>,
Priority<1>,
InvokeContext& invoke_context,
InvokeContext&,
Input&& input,
ReadDest&& read_dest)
{
Expand Down
4 changes: 2 additions & 2 deletions include/mp/type-string.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace mp {
template <typename Value, typename Output>
void CustomBuildField(TypeList<std::string>,
Priority<1>,
InvokeContext& invoke_context,
InvokeContext&,
Value&& value,
Output&& output)
{
Expand All @@ -24,7 +24,7 @@ void CustomBuildField(TypeList<std::string>,
template <typename Input, typename ReadDest>
decltype(auto) CustomReadField(TypeList<std::string>,
Priority<1>,
InvokeContext& invoke_context,
InvokeContext&,
Input&& input,
ReadDest&& read_dest)
{
Expand Down
16 changes: 8 additions & 8 deletions include/mp/type-struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ void BuildOne(TypeList<LocalType> param,

template <size_t index, typename LocalType, typename Value, typename Output>
requires (index == ProxyType<LocalType>::fields)
void BuildOne(TypeList<LocalType> param,
InvokeContext& invoke_context,
Output&& output,
Value&& value)
void BuildOne(TypeList<LocalType>,
InvokeContext&,
Output&&,
Value&&)
{
}

Expand Down Expand Up @@ -63,10 +63,10 @@ void ReadOne(TypeList<LocalType> param,

template <size_t index, typename LocalType, typename Input, typename Value>
requires (index == ProxyType<LocalType>::fields)
void ReadOne(TypeList<LocalType> param,
InvokeContext& invoke_context,
Input& input,
Value& value)
void ReadOne(TypeList<LocalType>,
InvokeContext&,
Input&,
Value&)
{
}

Expand Down
2 changes: 1 addition & 1 deletion include/mp/type-vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void CustomBuildField(TypeList<std::vector<LocalType>>,
BuildList(TypeList<LocalType>(), invoke_context, output, value);
}

inline static bool BuildPrimitive(InvokeContext& invoke_context, std::vector<bool>::const_reference value, TypeList<bool>)
inline static bool BuildPrimitive(InvokeContext&, std::vector<bool>::const_reference value, TypeList<bool>)
{
return value;
}
Expand Down
Loading
Loading