diff options
author | Simon Ser <contact@emersion.fr> | 2024-04-08 13:32:31 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2024-04-24 16:18:28 +0000 |
commit | 80c65f862f7919691d3b0d31810f5a40f8675f37 (patch) | |
tree | b8941a0918ffb67c1b1bf7d47408f5d9e56fbfb2 | |
parent | da8e1bbc45bde2debc6c8a1f9e3c67cb964de968 (diff) |
tests: add deprecated-since attributes
Add a new event and enum entry to small.xml with a deprecated-since
attribute to exercise the scanner code generation.
Signed-off-by: Simon Ser <contact@emersion.fr>
-rw-r--r-- | tests/data/small-client-core.h | 20 | ||||
-rw-r--r-- | tests/data/small-client.h | 20 | ||||
-rw-r--r-- | tests/data/small-code-core.c | 3 | ||||
-rw-r--r-- | tests/data/small-code.c | 3 | ||||
-rw-r--r-- | tests/data/small-private-code.c | 3 | ||||
-rw-r--r-- | tests/data/small-server-core.h | 28 | ||||
-rw-r--r-- | tests/data/small-server.h | 28 | ||||
-rw-r--r-- | tests/data/small.xml | 3 |
8 files changed, 105 insertions, 3 deletions
diff --git a/tests/data/small-client-core.h b/tests/data/small-client-core.h index e5e2193..0e72244 100644 --- a/tests/data/small-client-core.h +++ b/tests/data/small-client-core.h @@ -85,6 +85,12 @@ enum intf_A_foo { * @since 2 */ INTF_A_FOO_NEGATIVE = -1, + /** + * this is a deprecated value + * @since 2 + * @deprecated Deprecated since version 3 + */ + INTF_A_FOO_DEPRECATED = 3, }; /** * @ingroup iface_intf_A @@ -94,6 +100,10 @@ enum intf_A_foo { * @ingroup iface_intf_A */ #define INTF_A_FOO_NEGATIVE_SINCE_VERSION 2 +/** + * @ingroup iface_intf_A + */ +#define INTF_A_FOO_DEPRECATED_SINCE_VERSION 2 #endif /* INTF_A_FOO_ENUM */ /** @@ -105,6 +115,12 @@ struct intf_A_listener { */ void (*hey)(void *data, struct intf_A *intf_A); + /** + * @since 2 + * @deprecated Deprecated since version 3 + */ + void (*yo)(void *data, + struct intf_A *intf_A); }; /** @@ -126,6 +142,10 @@ intf_A_add_listener(struct intf_A *intf_A, * @ingroup iface_intf_A */ #define INTF_A_HEY_SINCE_VERSION 1 +/** + * @ingroup iface_intf_A + */ +#define INTF_A_YO_SINCE_VERSION 2 /** * @ingroup iface_intf_A diff --git a/tests/data/small-client.h b/tests/data/small-client.h index c81b70f..ad43592 100644 --- a/tests/data/small-client.h +++ b/tests/data/small-client.h @@ -85,6 +85,12 @@ enum intf_A_foo { * @since 2 */ INTF_A_FOO_NEGATIVE = -1, + /** + * this is a deprecated value + * @since 2 + * @deprecated Deprecated since version 3 + */ + INTF_A_FOO_DEPRECATED = 3, }; /** * @ingroup iface_intf_A @@ -94,6 +100,10 @@ enum intf_A_foo { * @ingroup iface_intf_A */ #define INTF_A_FOO_NEGATIVE_SINCE_VERSION 2 +/** + * @ingroup iface_intf_A + */ +#define INTF_A_FOO_DEPRECATED_SINCE_VERSION 2 #endif /* INTF_A_FOO_ENUM */ /** @@ -105,6 +115,12 @@ struct intf_A_listener { */ void (*hey)(void *data, struct intf_A *intf_A); + /** + * @since 2 + * @deprecated Deprecated since version 3 + */ + void (*yo)(void *data, + struct intf_A *intf_A); }; /** @@ -126,6 +142,10 @@ intf_A_add_listener(struct intf_A *intf_A, * @ingroup iface_intf_A */ #define INTF_A_HEY_SINCE_VERSION 1 +/** + * @ingroup iface_intf_A + */ +#define INTF_A_YO_SINCE_VERSION 2 /** * @ingroup iface_intf_A diff --git a/tests/data/small-code-core.c b/tests/data/small-code-core.c index 88e8257..b654549 100644 --- a/tests/data/small-code-core.c +++ b/tests/data/small-code-core.c @@ -52,11 +52,12 @@ static const struct wl_message intf_A_requests[] = { static const struct wl_message intf_A_events[] = { { "hey", "", small_test_types + 0 }, + { "yo", "2", small_test_types + 0 }, }; WL_EXPORT const struct wl_interface intf_A_interface = { "intf_A", 3, 3, intf_A_requests, - 1, intf_A_events, + 2, intf_A_events, }; diff --git a/tests/data/small-code.c b/tests/data/small-code.c index 88e8257..b654549 100644 --- a/tests/data/small-code.c +++ b/tests/data/small-code.c @@ -52,11 +52,12 @@ static const struct wl_message intf_A_requests[] = { static const struct wl_message intf_A_events[] = { { "hey", "", small_test_types + 0 }, + { "yo", "2", small_test_types + 0 }, }; WL_EXPORT const struct wl_interface intf_A_interface = { "intf_A", 3, 3, intf_A_requests, - 1, intf_A_events, + 2, intf_A_events, }; diff --git a/tests/data/small-private-code.c b/tests/data/small-private-code.c index 1679431..b2bbf0a 100644 --- a/tests/data/small-private-code.c +++ b/tests/data/small-private-code.c @@ -62,11 +62,12 @@ static const struct wl_message intf_A_requests[] = { static const struct wl_message intf_A_events[] = { { "hey", "", small_test_types + 0 }, + { "yo", "2", small_test_types + 0 }, }; WL_PRIVATE const struct wl_interface intf_A_interface = { "intf_A", 3, 3, intf_A_requests, - 1, intf_A_events, + 2, intf_A_events, }; diff --git a/tests/data/small-server-core.h b/tests/data/small-server-core.h index ff19d67..e696cde 100644 --- a/tests/data/small-server-core.h +++ b/tests/data/small-server-core.h @@ -88,6 +88,12 @@ enum intf_A_foo { * @since 2 */ INTF_A_FOO_NEGATIVE = -1, + /** + * this is a deprecated value + * @since 2 + * @deprecated Deprecated since version 3 + */ + INTF_A_FOO_DEPRECATED = 3, }; /** * @ingroup iface_intf_A @@ -99,6 +105,10 @@ enum intf_A_foo { #define INTF_A_FOO_NEGATIVE_SINCE_VERSION 2 /** * @ingroup iface_intf_A + */ +#define INTF_A_FOO_DEPRECATED_SINCE_VERSION 2 +/** + * @ingroup iface_intf_A * Validate a intf_A foo value. * * @return true on success, false on error. @@ -115,6 +125,8 @@ intf_A_foo_is_valid(uint32_t value, uint32_t version) { return version >= 2; case (uint32_t)INTF_A_FOO_NEGATIVE: return version >= 2; + case INTF_A_FOO_DEPRECATED: + return version >= 2; default: return false; } @@ -151,11 +163,16 @@ struct intf_A_interface { }; #define INTF_A_HEY 0 +#define INTF_A_YO 1 /** * @ingroup iface_intf_A */ #define INTF_A_HEY_SINCE_VERSION 1 +/** + * @ingroup iface_intf_A + */ +#define INTF_A_YO_SINCE_VERSION 2 /** * @ingroup iface_intf_A @@ -181,6 +198,17 @@ intf_A_send_hey(struct wl_resource *resource_) wl_resource_post_event(resource_, INTF_A_HEY); } +/** + * @ingroup iface_intf_A + * Sends an yo event to the client owning the resource. + * @param resource_ The client's resource + */ +static inline void +intf_A_send_yo(struct wl_resource *resource_) +{ + wl_resource_post_event(resource_, INTF_A_YO); +} + #ifdef __cplusplus } #endif diff --git a/tests/data/small-server.h b/tests/data/small-server.h index 13fd1ed..009d9cd 100644 --- a/tests/data/small-server.h +++ b/tests/data/small-server.h @@ -88,6 +88,12 @@ enum intf_A_foo { * @since 2 */ INTF_A_FOO_NEGATIVE = -1, + /** + * this is a deprecated value + * @since 2 + * @deprecated Deprecated since version 3 + */ + INTF_A_FOO_DEPRECATED = 3, }; /** * @ingroup iface_intf_A @@ -99,6 +105,10 @@ enum intf_A_foo { #define INTF_A_FOO_NEGATIVE_SINCE_VERSION 2 /** * @ingroup iface_intf_A + */ +#define INTF_A_FOO_DEPRECATED_SINCE_VERSION 2 +/** + * @ingroup iface_intf_A * Validate a intf_A foo value. * * @return true on success, false on error. @@ -115,6 +125,8 @@ intf_A_foo_is_valid(uint32_t value, uint32_t version) { return version >= 2; case (uint32_t)INTF_A_FOO_NEGATIVE: return version >= 2; + case INTF_A_FOO_DEPRECATED: + return version >= 2; default: return false; } @@ -151,11 +163,16 @@ struct intf_A_interface { }; #define INTF_A_HEY 0 +#define INTF_A_YO 1 /** * @ingroup iface_intf_A */ #define INTF_A_HEY_SINCE_VERSION 1 +/** + * @ingroup iface_intf_A + */ +#define INTF_A_YO_SINCE_VERSION 2 /** * @ingroup iface_intf_A @@ -181,6 +198,17 @@ intf_A_send_hey(struct wl_resource *resource_) wl_resource_post_event(resource_, INTF_A_HEY); } +/** + * @ingroup iface_intf_A + * Sends an yo event to the client owning the resource. + * @param resource_ The client's resource + */ +static inline void +intf_A_send_yo(struct wl_resource *resource_) +{ + wl_resource_post_event(resource_, INTF_A_YO); +} + #ifdef __cplusplus } #endif diff --git a/tests/data/small.xml b/tests/data/small.xml index 685c891..ac52779 100644 --- a/tests/data/small.xml +++ b/tests/data/small.xml @@ -49,11 +49,14 @@ <event name="hey"/> + <event name="yo" since="2" deprecated-since="3"/> + <enum name="foo"> <entry name="first" value="0" summary="this is the first"/> <entry name="second" value="1" summary="this is the second"/> <entry name="third" value="2" since="2" summary="this is the third"/> <entry name="negative" value="-1" since="2" summary="this is a negative value"/> + <entry name="deprecated" value="3" since="2" deprecated-since="3" summary="this is a deprecated value"/> </enum> </interface> </protocol> |