Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ void RepeatedEnum::GenerateAccessorDeclarations(io::Printer* p) const {
$DEPRECATED$ void $set_name$(int index, $Enum$ value);
$DEPRECATED$ void $add_name$($Enum$ value);
$DEPRECATED$ const $pb$::RepeatedField<int>& $name$() const;
$DEPRECATED$ $pb$::RepeatedField<int>* $nonnull$ $mutable_name$();
[[nodiscard]] $DEPRECATED$ $pb$::RepeatedField<int>* $nonnull$ $mutable_name$();

private:
const $pb$::RepeatedField<int>& $_internal_name$() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void Map::GenerateAccessorDeclarations(io::Printer* p) const {
io::AnnotationCollector::kAlias));
p->Emit(R"cc(
$DEPRECATED$ const $Map$& $name$() const;
$DEPRECATED$ $Map$* $nonnull$ $mutable_name$();
[[nodiscard]] $DEPRECATED$ $Map$* $nonnull$ $mutable_name$();

private:
const $Map$& $_internal_name$() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -758,8 +758,9 @@ void RepeatedMessage::GenerateAccessorDeclarations(io::Printer* p) const {
io::AnnotationCollector::kAlias));

p->Emit(R"cc(
$DEPRECATED$ $Submsg$* $nonnull$ $mutable_name$(int index);
$DEPRECATED$ $pb$::RepeatedPtrField<$Submsg$>* $nonnull$ $mutable_name$();
[[nodiscard]] $DEPRECATED$ $Submsg$* $nonnull$ $mutable_name$(int index);
[[nodiscard]] $DEPRECATED$ $pb$::RepeatedPtrField<$Submsg$>* $nonnull$
$mutable_name$();

private:
const $pb$::RepeatedPtrField<$Submsg$>& $_internal_name$() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,8 @@ void RepeatedString::GenerateAccessorDeclarations(io::Printer* p) const {
template <typename Arg_ = const ::std::string&, typename... Args_>
$DEPRECATED$ void $add_name$(Arg_&& value, Args_... args);
$DEPRECATED$ const $pb$::RepeatedPtrField<::std::string>& $name$() const;
$DEPRECATED$ $pb$::RepeatedPtrField<::std::string>* $nonnull$ $mutable_name$();
[[nodiscard]] $DEPRECATED$ $pb$::RepeatedPtrField<::std::string>* $nonnull$
$mutable_name$();

private:
const $pb$::RepeatedPtrField<::std::string>& _internal_$name$() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,8 @@ void RepeatedStringView::GenerateAccessorDeclarations(io::Printer* p) const {
template <typename Arg_ = ::std::string&&>
$DEPRECATED$ void add_$name$(Arg_&& value);
$DEPRECATED$ const $pb$::RepeatedPtrField<::std::string>& $name$() const;
$DEPRECATED$ $pb$::RepeatedPtrField<::std::string>* $nonnull$ $mutable_name$();
[[nodiscard]] $DEPRECATED$ $pb$::RepeatedPtrField<::std::string>* $nonnull$
$mutable_name$();

private:
const $pb$::RepeatedPtrField<::std::string>& _internal_$name$() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1890,7 +1890,7 @@ TEST(GeneratedMessageReflection, ListFieldsEmptyMap) {
const Reflection* reflection = msg.GetReflection();
std::vector<const FieldDescriptor*> fields;

msg.mutable_map_int32_int32();
(void)msg.mutable_map_int32_int32();
reflection->ListFields(msg, &fields);
EXPECT_THAT(fields, IsEmpty());
EXPECT_TRUE(reflection->IsEmpty(msg));
Expand Down
6 changes: 3 additions & 3 deletions src/google/protobuf/has_bits_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ TEST(HasBitsTest, HasBitsSetOnMutableMap) {
<< "Test only applies with hasbits for repeated fields enabled";
}
TestMap msg;
msg.mutable_map_int32_int32();
(void)msg.mutable_map_int32_int32();
EXPECT_TRUE(HasBitsTestPeer::HasBitSet(msg, "map_int32_int32"));
}

Expand All @@ -219,7 +219,7 @@ TEST(HasBitsTest, HasBitsClearedOnMapFieldClear) {
<< "Test only applies with hasbits for repeated fields enabled";
}
TestMap msg;
msg.mutable_map_int32_int32();
(void)msg.mutable_map_int32_int32();
msg.clear_map_int32_int32();
EXPECT_FALSE(HasBitsTestPeer::HasBitSet(msg, "map_int32_int32"));
}
Expand All @@ -241,7 +241,7 @@ TEST(HasBitsTest, HasBitsClearedOnMapFieldClearWithReflection) {
<< "Test only applies with hasbits for repeated fields enabled";
}
TestMap msg;
msg.mutable_map_int32_int32();
(void)msg.mutable_map_int32_int32();
msg.GetReflection()->ClearField(
&msg, msg.GetDescriptor()->FindFieldByName("map_int32_int32"));
EXPECT_FALSE(HasBitsTestPeer::HasBitSet(msg, "map_int32_int32"));
Expand Down
2 changes: 1 addition & 1 deletion src/google/protobuf/reflection_ops_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ TEST(ReflectionOpsTest, EmptyMapIsInitialized) {
message.set_a(1);
message.set_b(2);
message.set_c(3);
message.mutable_map_field();
(void)message.mutable_map_field();
EXPECT_TRUE(ReflectionOps::IsInitialized(message));
EXPECT_TRUE(ReflectionOps::IsInitialized(message, /*check_fields=*/true,
/*check_descendants=*/false));
Expand Down
Loading