Recommend using [[deprecated]] over ABSL_DEPRECATED
Bug: none Change-Id: I6018fc75d347d610d078077e7b34131efaaef0db Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/260160 Commit-Queue: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Artem Titov <titovartem@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36696}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
19ebabc904
commit
832657f162
@ -73,12 +73,12 @@ referencing a WebRTC bug, prefer the url form, e.g.
|
|||||||
### Deprecation
|
### Deprecation
|
||||||
|
|
||||||
Annotate the declarations of deprecated functions and classes with the
|
Annotate the declarations of deprecated functions and classes with the
|
||||||
[`ABSL_DEPRECATED` macro][ABSL_DEPRECATED] to cause an error when they're used
|
[`[[deprecated]]` attribute][DEPRECATED] to cause an error when they're used
|
||||||
inside WebRTC and a compiler warning when they're used by dependant projects.
|
inside WebRTC and a compiler warning when they're used by dependant projects.
|
||||||
Like so:
|
Like so:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
ABSL_DEPRECATED("bugs.webrtc.org/12345")
|
[[deprecated("bugs.webrtc.org/12345")]]
|
||||||
std::pony PonyPlz(const std::pony_spec& ps);
|
std::pony PonyPlz(const std::pony_spec& ps);
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ getting errors, do something like this:
|
|||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
std::pony DEPRECATED_PonyPlz(const std::pony_spec& ps);
|
std::pony DEPRECATED_PonyPlz(const std::pony_spec& ps);
|
||||||
ABSL_DEPRECATED("bugs.webrtc.org/12345")
|
[[deprecated("bugs.webrtc.org/12345")]]
|
||||||
inline std::pony PonyPlz(const std::pony_spec& ps) {
|
inline std::pony PonyPlz(const std::pony_spec& ps) {
|
||||||
return DEPRECATED_PonyPlz(ps);
|
return DEPRECATED_PonyPlz(ps);
|
||||||
}
|
}
|
||||||
@ -100,6 +100,12 @@ In other words, rename the existing function, and provide an inline wrapper
|
|||||||
using the original name that calls it. That way, callers who are willing to
|
using the original name that calls it. That way, callers who are willing to
|
||||||
call it using the `DEPRECATED_`-prefixed name don't get the warning.
|
call it using the `DEPRECATED_`-prefixed name don't get the warning.
|
||||||
|
|
||||||
|
NOTE 3: Occasionally, with long descriptions, `git cl format` will do the wrong
|
||||||
|
thing with the attribute. In that case, you can use the
|
||||||
|
[`ABSL_DEPRECATED` macro][ABSL_DEPRECATED], which is formatted in a more
|
||||||
|
readable way.
|
||||||
|
|
||||||
|
[DEPRECATED]: https://en.cppreference.com/w/cpp/language/attributes/deprecated
|
||||||
[ABSL_DEPRECATED]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/abseil-cpp/absl/base/attributes.h?q=ABSL_DEPRECATED
|
[ABSL_DEPRECATED]: https://source.chromium.org/chromium/chromium/src/+/main:third_party/abseil-cpp/absl/base/attributes.h?q=ABSL_DEPRECATED
|
||||||
|
|
||||||
### ArrayView
|
### ArrayView
|
||||||
|
Reference in New Issue
Block a user