From 4a44210ee30a7b896c740eaa3e9a1a8c5fcbc9e3 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Tue, 21 Nov 2023 09:45:16 -0800 Subject: [PATCH] [ntcore] NetworkTableInstance: Suppress unused lambda capture warning (#5947) Clang warns that the "this" capture is not required, even though a member function is being called. --- .../include/networktables/NetworkTableInstance.inc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ntcore/src/main/native/include/networktables/NetworkTableInstance.inc b/ntcore/src/main/native/include/networktables/NetworkTableInstance.inc index fdd517e201..b4bbee16c0 100644 --- a/ntcore/src/main/native/include/networktables/NetworkTableInstance.inc +++ b/ntcore/src/main/native/include/networktables/NetworkTableInstance.inc @@ -257,6 +257,12 @@ inline void NetworkTableInstance::AddSchema(std::string_view name, ::nt::AddSchema(m_handle, name, type, schema); } +// Suppress unused-lambda-capture warning on AddSchema() call +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-lambda-capture" +#endif + template void NetworkTableInstance::AddProtobufSchema(wpi::ProtobufMessage& msg) { msg.ForEachProtobufDescriptor( @@ -273,4 +279,8 @@ void NetworkTableInstance::AddStructSchema() { }); } +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + } // namespace nt