Skip to content

Commit

Permalink
Avoid unused-parameter warning in field accessor listeners.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 603424598
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Feb 1, 2024
1 parent dc7001e commit f4d5c2c
Showing 1 changed file with 46 additions and 40 deletions.
86 changes: 46 additions & 40 deletions src/google/protobuf/field_access_listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit f4d5c2c

Please sign in to comment.