dbus-c++: deprecate Connection::request_name
Connection::request_name is kind of broken, in that it doesn't
actually tell you whether or not you got the name. Callers
should use acquire_name instead of request_name, so mark
request_name as deprecated.
While there, mark acquire_name with the warn_unused_result
attribute. That way, callers will know that they need to
check the return value. (acquire_name will return false
to indicate that acquisition failed.)
BUG=chromium:364556
TEST=manual
CQ-DEPEND=CL:197066
Manual test: compiled some code that uses request_name,
saw that the compiler generated a warning. Added some
code that called acquire_name, but did not check its
return value. Saw a compiler warning for that, too.
Change-Id: Ied3088d0722df160526cc75a81c3158ff793eaee
Reviewed-on: https://chromium-review.googlesource.com/195420
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
diff --git a/include/dbus-c++/connection.h b/include/dbus-c++/connection.h
index 7db166f..e3df707 100644
--- a/include/dbus-c++/connection.h
+++ b/include/dbus-c++/connection.h
@@ -428,7 +428,8 @@
* \param name The name to request ownership of.
* \param flags Flags to be passed to dbus_bus_request_name.
*/
- void request_name( const char* name, int flags = 0 );
+ void request_name( const char* name, int flags = 0 )
+ __attribute__((__deprecated__));
/*!
*\brief Acquire a name from DBus.
@@ -438,7 +439,8 @@
*
* \return True if the name was acquired, and false otherwise.
*/
- bool acquire_name( const char* name );
+ bool acquire_name( const char* name )
+ __attribute__((__warn_unused_result__));
unsigned long sender_unix_uid(const char *sender);