Passthrough service functions: warn unused result
Prevent these from cropping up again:
b/34634573
b/34641942
b/34640335
b/34643521
b/36424561
Note, also made defaultServicePassthroughImplementation return status_t
instead of int.
Test: pass
Change-Id: I930a5f7f82390a6869e0ab99c8536bf73dad7d0c
diff --git a/transport/include/hidl/LegacySupport.h b/transport/include/hidl/LegacySupport.h
index 3cc23f3..d7e1d74 100644
--- a/transport/include/hidl/LegacySupport.h
+++ b/transport/include/hidl/LegacySupport.h
@@ -36,6 +36,7 @@
* Registers passthrough service implementation.
*/
template<class Interface>
+__attribute__((warn_unused_result))
status_t registerPassthroughServiceImplementation(
std::string name = "default") {
// TODO(b/34274385)
@@ -71,7 +72,8 @@
* Return value is exit status.
*/
template<class Interface>
-int defaultPassthroughServiceImplementation(std::string name,
+__attribute__((warn_unused_result))
+status_t defaultPassthroughServiceImplementation(std::string name,
size_t maxThreads = 1) {
configureRpcThreadpool(maxThreads, true);
status_t result = registerPassthroughServiceImplementation<Interface>(name);
@@ -84,7 +86,8 @@
return 0;
}
template<class Interface>
-int defaultPassthroughServiceImplementation(size_t maxThreads = 1) {
+__attribute__((warn_unused_result))
+status_t defaultPassthroughServiceImplementation(size_t maxThreads = 1) {
return defaultPassthroughServiceImplementation<Interface>("default", maxThreads);
}