Avoid unused-parameter warning in field accessor listeners.

PiperOrigin-RevId: 603424598
pull/15672/head
Protobuf Team Bot 10 months ago committed by Copybara-Service
parent dc7001e517
commit f4d5c2c571
  1. 86
      src/google/protobuf/field_access_listener.h

@ -34,14 +34,15 @@ struct NoOpAccessListener {
// to differentiate the protos during the runtime before the start of the
// program, use this functor to get its name. We either way need it for
// LITE_RUNTIME protos as they don't have descriptors at all.
explicit NoOpAccessListener(absl::string_view (*name_extractor)()) {}
explicit NoOpAccessListener(absl::string_view (* /*name_extractor*/)()) {}
// called repeatedly during serialization/deserialization/ByteSize of
// Reflection as:
// AccessListener<MessageT>::OnSerialize(this);
static void OnSerialize(const MessageLite* msg) {}
static void OnDeserialize(const MessageLite* msg) {}
static void OnByteSize(const MessageLite* msg) {}
static void OnMergeFrom(const MessageLite* to, const MessageLite* from) {}
static void OnSerialize(const MessageLite* /*msg*/) {}
static void OnDeserialize(const MessageLite* /*msg*/) {}
static void OnByteSize(const MessageLite* /*msg*/) {}
static void OnMergeFrom(const MessageLite* /*to*/,
const MessageLite* /*from*/) {}
// NOTE: This function can be called pre-main. Make sure it does not make
// the state of the listener invalid.
@ -63,77 +64,82 @@ struct NoOpAccessListener {
// add_<field>(f)
template <int kFieldNum>
static void OnAdd(const MessageLite* msg, const void* field) {}
static void OnAdd(const MessageLite* /*msg*/, const void* /*field*/) {}
// add_<field>()
template <int kFieldNum>
static void OnAddMutable(const MessageLite* msg, const void* field) {}
static void OnAddMutable(const MessageLite* /*msg*/, const void* /*field*/) {}
// <field>() and <repeated_field>(i)
template <int kFieldNum>
static void OnGet(const MessageLite* msg, const void* field) {}
static void OnGet(const MessageLite* /*msg*/, const void* /*field*/) {}
// clear_<field>()
template <int kFieldNum>
static void OnClear(const MessageLite* msg, const void* field) {}
static void OnClear(const MessageLite* /*msg*/, const void* /*field*/) {}
// has_<field>()
template <int kFieldNum>
static void OnHas(const MessageLite* msg, const void* field) {}
static void OnHas(const MessageLite* /*msg*/, const void* /*field*/) {}
// <repeated_field>()
template <int kFieldNum>
static void OnList(const MessageLite* msg, const void* field) {}
static void OnList(const MessageLite* /*msg*/, const void* /*field*/) {}
// mutable_<field>()
template <int kFieldNum>
static void OnMutable(const MessageLite* msg, const void* field) {}
static void OnMutable(const MessageLite* /*msg*/, const void* /*field*/) {}
// mutable_<repeated_field>()
template <int kFieldNum>
static void OnMutableList(const MessageLite* msg, const void* field) {}
static void OnMutableList(const MessageLite* /*msg*/, const void* /*field*/) {
}
// release_<field>()
template <int kFieldNum>
static void OnRelease(const MessageLite* msg, const void* field) {}
static void OnRelease(const MessageLite* /*msg*/, const void* /*field*/) {}
// set_<field>() and set_<repeated_field>(i)
template <int kFieldNum>
static void OnSet(const MessageLite* msg, const void* field) {}
static void OnSet(const MessageLite* /*msg*/, const void* /*field*/) {}
// <repeated_field>_size()
template <int kFieldNum>
static void OnSize(const MessageLite* msg, const void* field) {}
static void OnSize(const MessageLite* /*msg*/, const void* /*field*/) {}
// unknown_fields()
static void OnUnknownFields(const MessageLite* msg) {}
static void OnUnknownFields(const MessageLite* /*msg*/) {}
// mutable_unknown_fields()
static void OnMutableUnknownFields(const MessageLite* msg) {}
static void OnMutableUnknownFields(const MessageLite* /*msg*/) {}
static void OnHasExtension(const MessageLite* msg, int extension_tag,
const void* field) {}
static void OnHasExtension(const MessageLite* /*msg*/, int /*extension_tag*/,
const void* /*field*/) {}
// TODO: Support clear in the proto compiler.
static void OnClearExtension(const MessageLite* msg, int extension_tag,
const void* field) {}
static void OnExtensionSize(const MessageLite* msg, int extension_tag,
const void* field) {}
static void OnGetExtension(const MessageLite* msg, int extension_tag,
const void* field) {}
static void OnMutableExtension(const MessageLite* msg, int extension_tag,
const void* field) {}
static void OnSetExtension(const MessageLite* msg, int extension_tag,
const void* field) {}
static void OnReleaseExtension(const MessageLite* msg, int extension_tag,
const void* field) {}
static void OnAddExtension(const MessageLite* msg, int extension_tag,
const void* field) {}
static void OnAddMutableExtension(const MessageLite* msg, int extension_tag,
const void* field) {}
static void OnListExtension(const MessageLite* msg, int extension_tag,
const void* field) {}
static void OnMutableListExtension(const MessageLite* msg, int extension_tag,
const void* field) {}
static void OnClearExtension(const MessageLite* /*msg*/,
int /*extension_tag*/, const void* /*field*/) {}
static void OnExtensionSize(const MessageLite* /*msg*/, int /*extension_tag*/,
const void* /*field*/) {}
static void OnGetExtension(const MessageLite* /*msg*/, int /*extension_tag*/,
const void* /*field*/) {}
static void OnMutableExtension(const MessageLite* /*msg*/,
int /*extension_tag*/, const void* /*field*/) {
}
static void OnSetExtension(const MessageLite* /*msg*/, int /*extension_tag*/,
const void* /*field*/) {}
static void OnReleaseExtension(const MessageLite* /*msg*/,
int /*extension_tag*/, const void* /*field*/) {
}
static void OnAddExtension(const MessageLite* /*msg*/, int /*extension_tag*/,
const void* /*field*/) {}
static void OnAddMutableExtension(const MessageLite* /*msg*/,
int /*extension_tag*/,
const void* /*field*/) {}
static void OnListExtension(const MessageLite* /*msg*/, int /*extension_tag*/,
const void* /*field*/) {}
static void OnMutableListExtension(const MessageLite* /*msg*/,
int /*extension_tag*/,
const void* /*field*/) {}
};
} // namespace protobuf

Loading…
Cancel
Save