diff options
| author | 2021-03-17 16:28:54 +0900 | |
|---|---|---|
| committer | 2021-03-17 16:40:22 +0900 | |
| commit | 1cd746b6abd542010741c216593beb3b6c56dd66 (patch) | |
| tree | b87d1327664a8e13b974fb1c795efc569f34b708 /libs/gui/QueueBufferInputOutput.cpp | |
| parent | 3ce4a1b9a230eeebdf8ee8a27317ab9e8f86bb76 (diff) | |
Allow SharedRefBase::make to use the deprecated new operator
The direct use of the new operator is discouraged in favor or
SharedRefBase::make. So, we have been completely hiding the operator for
newer builds (i.e. min_sdk_version >= 30). For older builds, we don't
hide it in order to keep the backwards compatibility, but mark it as
deprecated to give clients a warning.
However, we have missed a legit use of the operator: from inside the
make function. When the code is built for a module whose min_sdk_version
< 30, it triggers the -Wdeprecated-declarations check and might fail the
build if it is with -Werror.
```
frameworks/native/libs/binder/ndk/include_cpp/android/binder_interface_utils.h:85:16: error: 'operator new' is deprecated: Prefer SharedRefBase::make<T>(...) if possible. [-Werror,-Wdeprecated-declarations]
T* t = new T(std::forward<Args>(args)...);
^
out/soong/.intermediates/packages/modules/DnsResolver/dnsresolver_aidl_interface-V7-ndk_platform-source/gen/android/net/resolv/aidl/IDnsResolverUnsolicitedEventListener.cpp:483:32: note: in instantiation of function template specialization 'ndk::SharedRefBase::make<aidl::android::net::resolv::a
idl::BpDnsResolverUnsolicitedEventListener, const ndk::SpAIBinder &>' requested here
return ::ndk::SharedRefBase::make<BpDnsResolverUnsolicitedEventListener>(binder);
^
frameworks/native/libs/binder/ndk/include_cpp/android/binder_interface_utils.h:100:7: note: 'operator new' has been explicitly marked deprecated here
[[deprecated("Prefer SharedRefBase::make<T>(...) if possible.")]]
^
1 error generated.
```
This change silence the deprecation check at the point where the new
operator is used inside the make function.
Bug: N/A
Test: m resolv_stress_test.
Change-Id: I79b10851d587da62fa0df151c1e9604d31446c04
Diffstat (limited to 'libs/gui/QueueBufferInputOutput.cpp')
0 files changed, 0 insertions, 0 deletions