Skip to content

Commit

Permalink
Deprecate repeated field cleared elements API.
Browse files Browse the repository at this point in the history
This will be removed in a future release.

PiperOrigin-RevId: 503218340
  • Loading branch information
mkruskal-google authored and copybara-github committed Jan 19, 2023
1 parent 514c9a8 commit 84d8b00
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/google/protobuf/repeated_ptr_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -1152,13 +1152,15 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase {
//
// This method cannot be called when either the repeated field or |value| is
// on an arena; both cases will trigger a GOOGLE_ABSL_DCHECK-failure.
ABSL_DEPRECATED("This will be removed in a future release")
void AddCleared(Element* value);
// Removes and returns a single element from the cleared pool, passing
// ownership to the caller. The element is guaranteed to be cleared.
// Requires: ClearedCount() > 0
//
// This method cannot be called when the repeated field is on an arena; doing
// so will trigger a GOOGLE_ABSL_DCHECK-failure.
ABSL_DEPRECATED("This will be removed in a future release")

This comment has been minimized.

Copy link
@mumbleskates

mumbleskates Jan 19, 2023

Contributor

this fails to build in clang-16: error: 'nodiscard' attribute cannot be applied to types

PROTOBUF_NODISCARD seemingly needs to come before the deprecation attribute.

This comment has been minimized.

Copy link
@mkruskal-google

mkruskal-google Jan 20, 2023

Author Member

Whoops, thanks! I'll send out a fix for that

This comment has been minimized.

Copy link
@mumbleskates

mumbleskates Jan 20, 2023

Contributor

I did a PR too because i couldn't find this comment after sending it: #11606

Whatever works 👍

PROTOBUF_NODISCARD Element* ReleaseCleared();
#endif // !PROTOBUF_FUTURE_REMOVE_CLEARED_API

Expand Down

0 comments on commit 84d8b00

Please sign in to comment.