diff options
author | Ben Chan <benchan@chromium.org> | 2017-06-27 23:37:43 -0700 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2017-06-28 09:52:24 +0200 |
commit | c5192ed9f22f3a2f7be6300ccd5222ed39ab4335 (patch) | |
tree | 4cf2476ae1d346d0c5b4495a0789aa5ca8277ab1 | |
parent | de25d1233d13d5c6832e94a085170293953a2586 (diff) |
libmbim-glib: fix G_DEPRECATED_FOR annotations
mbim-compat.h defines a few deprecated enumerators as an alias to their
equivalence using macros and annotates those macros with
G_DEPRECATED_FOR, which may be expanded to
`__attribute__((deprecated))'.
Neither gcc nor clang supports `__attribute__((deprecated))' on macros.
Thus, a G_DEPRECATED_FOR annotation before a macro definition is
actually associated with the next identifier found after the macro
definition, which is incorrect.
Alternatively, the G_DEPRECATED_FOR annotation can be used on the
deprecated enumerators. But only gcc 6 or above supports enumerator
attributes.
To address the issue, this patch defines the deprecated enumerators as
`static const int' values, which can then be annotated with
G_DEPRECATED_FOR.
(cherry picked from commit e5b6807d6f2a8488878cd1cc1530f3b3fd92a2ec)
-rw-r--r-- | src/libmbim-glib/mbim-compat.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libmbim-glib/mbim-compat.h b/src/libmbim-glib/mbim-compat.h index 0edd527..88966db 100644 --- a/src/libmbim-glib/mbim-compat.h +++ b/src/libmbim-glib/mbim-compat.h @@ -28,6 +28,7 @@ #include <glib.h> #include "mbim-basic-connect.h" +#include "mbim-cid.h" G_BEGIN_DECLS @@ -42,7 +43,8 @@ G_BEGIN_DECLS * Deprecated:1.8.0: Use MBIM_REGISTRATION_FLAG_PACKET_SERVICE_AUTOMATIC_ATTACH instead. */ G_DEPRECATED_FOR (MBIM_REGISTRATION_FLAG_PACKET_SERVICE_AUTOMATIC_ATTACH) -#define MBIM_REGISTRATION_FLAG_MANUAL_PACKET_SERVICE_AUTOMATIC_ATTACH MBIM_REGISTRATION_FLAG_PACKET_SERVICE_AUTOMATIC_ATTACH +static const int MBIM_REGISTRATION_FLAG_MANUAL_PACKET_SERVICE_AUTOMATIC_ATTACH = + MBIM_REGISTRATION_FLAG_PACKET_SERVICE_AUTOMATIC_ATTACH; /*****************************************************************************/ /* 'Service Subscriber List' rename to 'Service Subscribe List' */ @@ -55,7 +57,8 @@ G_DEPRECATED_FOR (MBIM_REGISTRATION_FLAG_PACKET_SERVICE_AUTOMATIC_ATTACH) * Deprecated:1.8.0: Use MBIM_CID_BASIC_CONNECT_DEVICE_SERVICE_SUBSCRIBE_LIST instead. */ G_DEPRECATED_FOR (MBIM_CID_BASIC_CONNECT_DEVICE_SERVICE_SUBSCRIBE_LIST) -#define MBIM_CID_BASIC_CONNECT_DEVICE_SERVICE_SUBSCRIBER_LIST MBIM_CID_BASIC_CONNECT_DEVICE_SERVICE_SUBSCRIBE_LIST +static const int MBIM_CID_BASIC_CONNECT_DEVICE_SERVICE_SUBSCRIBER_LIST = + MBIM_CID_BASIC_CONNECT_DEVICE_SERVICE_SUBSCRIBE_LIST; G_DEPRECATED_FOR (mbim_message_device_service_subscribe_list_set_new) MbimMessage *mbim_message_device_service_subscriber_list_set_new ( |