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>
This commit is contained in:
Simon Ser 2024-04-08 13:32:31 +02:00
parent da8e1bbc45
commit 80c65f862f
8 changed files with 105 additions and 3 deletions

View file

@ -85,6 +85,12 @@ enum intf_A_foo {
* @since 2 * @since 2
*/ */
INTF_A_FOO_NEGATIVE = -1, 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 * @ingroup iface_intf_A
@ -94,6 +100,10 @@ enum intf_A_foo {
* @ingroup iface_intf_A * @ingroup iface_intf_A
*/ */
#define INTF_A_FOO_NEGATIVE_SINCE_VERSION 2 #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 */ #endif /* INTF_A_FOO_ENUM */
/** /**
@ -105,6 +115,12 @@ struct intf_A_listener {
*/ */
void (*hey)(void *data, void (*hey)(void *data,
struct intf_A *intf_A); 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 * @ingroup iface_intf_A
*/ */
#define INTF_A_HEY_SINCE_VERSION 1 #define INTF_A_HEY_SINCE_VERSION 1
/**
* @ingroup iface_intf_A
*/
#define INTF_A_YO_SINCE_VERSION 2
/** /**
* @ingroup iface_intf_A * @ingroup iface_intf_A

View file

@ -85,6 +85,12 @@ enum intf_A_foo {
* @since 2 * @since 2
*/ */
INTF_A_FOO_NEGATIVE = -1, 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 * @ingroup iface_intf_A
@ -94,6 +100,10 @@ enum intf_A_foo {
* @ingroup iface_intf_A * @ingroup iface_intf_A
*/ */
#define INTF_A_FOO_NEGATIVE_SINCE_VERSION 2 #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 */ #endif /* INTF_A_FOO_ENUM */
/** /**
@ -105,6 +115,12 @@ struct intf_A_listener {
*/ */
void (*hey)(void *data, void (*hey)(void *data,
struct intf_A *intf_A); 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 * @ingroup iface_intf_A
*/ */
#define INTF_A_HEY_SINCE_VERSION 1 #define INTF_A_HEY_SINCE_VERSION 1
/**
* @ingroup iface_intf_A
*/
#define INTF_A_YO_SINCE_VERSION 2
/** /**
* @ingroup iface_intf_A * @ingroup iface_intf_A

View file

@ -52,11 +52,12 @@ static const struct wl_message intf_A_requests[] = {
static const struct wl_message intf_A_events[] = { static const struct wl_message intf_A_events[] = {
{ "hey", "", small_test_types + 0 }, { "hey", "", small_test_types + 0 },
{ "yo", "2", small_test_types + 0 },
}; };
WL_EXPORT const struct wl_interface intf_A_interface = { WL_EXPORT const struct wl_interface intf_A_interface = {
"intf_A", 3, "intf_A", 3,
3, intf_A_requests, 3, intf_A_requests,
1, intf_A_events, 2, intf_A_events,
}; };

View file

@ -52,11 +52,12 @@ static const struct wl_message intf_A_requests[] = {
static const struct wl_message intf_A_events[] = { static const struct wl_message intf_A_events[] = {
{ "hey", "", small_test_types + 0 }, { "hey", "", small_test_types + 0 },
{ "yo", "2", small_test_types + 0 },
}; };
WL_EXPORT const struct wl_interface intf_A_interface = { WL_EXPORT const struct wl_interface intf_A_interface = {
"intf_A", 3, "intf_A", 3,
3, intf_A_requests, 3, intf_A_requests,
1, intf_A_events, 2, intf_A_events,
}; };

View file

@ -62,11 +62,12 @@ static const struct wl_message intf_A_requests[] = {
static const struct wl_message intf_A_events[] = { static const struct wl_message intf_A_events[] = {
{ "hey", "", small_test_types + 0 }, { "hey", "", small_test_types + 0 },
{ "yo", "2", small_test_types + 0 },
}; };
WL_PRIVATE const struct wl_interface intf_A_interface = { WL_PRIVATE const struct wl_interface intf_A_interface = {
"intf_A", 3, "intf_A", 3,
3, intf_A_requests, 3, intf_A_requests,
1, intf_A_events, 2, intf_A_events,
}; };

View file

@ -88,6 +88,12 @@ enum intf_A_foo {
* @since 2 * @since 2
*/ */
INTF_A_FOO_NEGATIVE = -1, 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 * @ingroup iface_intf_A
@ -97,6 +103,10 @@ enum intf_A_foo {
* @ingroup iface_intf_A * @ingroup iface_intf_A
*/ */
#define INTF_A_FOO_NEGATIVE_SINCE_VERSION 2 #define INTF_A_FOO_NEGATIVE_SINCE_VERSION 2
/**
* @ingroup iface_intf_A
*/
#define INTF_A_FOO_DEPRECATED_SINCE_VERSION 2
/** /**
* @ingroup iface_intf_A * @ingroup iface_intf_A
* Validate a intf_A foo value. * Validate a intf_A foo value.
@ -115,6 +125,8 @@ intf_A_foo_is_valid(uint32_t value, uint32_t version) {
return version >= 2; return version >= 2;
case (uint32_t)INTF_A_FOO_NEGATIVE: case (uint32_t)INTF_A_FOO_NEGATIVE:
return version >= 2; return version >= 2;
case INTF_A_FOO_DEPRECATED:
return version >= 2;
default: default:
return false; return false;
} }
@ -151,11 +163,16 @@ struct intf_A_interface {
}; };
#define INTF_A_HEY 0 #define INTF_A_HEY 0
#define INTF_A_YO 1
/** /**
* @ingroup iface_intf_A * @ingroup iface_intf_A
*/ */
#define INTF_A_HEY_SINCE_VERSION 1 #define INTF_A_HEY_SINCE_VERSION 1
/**
* @ingroup iface_intf_A
*/
#define INTF_A_YO_SINCE_VERSION 2
/** /**
* @ingroup iface_intf_A * @ingroup iface_intf_A
@ -181,6 +198,17 @@ intf_A_send_hey(struct wl_resource *resource_)
wl_resource_post_event(resource_, INTF_A_HEY); 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 #ifdef __cplusplus
} }
#endif #endif

View file

@ -88,6 +88,12 @@ enum intf_A_foo {
* @since 2 * @since 2
*/ */
INTF_A_FOO_NEGATIVE = -1, 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 * @ingroup iface_intf_A
@ -97,6 +103,10 @@ enum intf_A_foo {
* @ingroup iface_intf_A * @ingroup iface_intf_A
*/ */
#define INTF_A_FOO_NEGATIVE_SINCE_VERSION 2 #define INTF_A_FOO_NEGATIVE_SINCE_VERSION 2
/**
* @ingroup iface_intf_A
*/
#define INTF_A_FOO_DEPRECATED_SINCE_VERSION 2
/** /**
* @ingroup iface_intf_A * @ingroup iface_intf_A
* Validate a intf_A foo value. * Validate a intf_A foo value.
@ -115,6 +125,8 @@ intf_A_foo_is_valid(uint32_t value, uint32_t version) {
return version >= 2; return version >= 2;
case (uint32_t)INTF_A_FOO_NEGATIVE: case (uint32_t)INTF_A_FOO_NEGATIVE:
return version >= 2; return version >= 2;
case INTF_A_FOO_DEPRECATED:
return version >= 2;
default: default:
return false; return false;
} }
@ -151,11 +163,16 @@ struct intf_A_interface {
}; };
#define INTF_A_HEY 0 #define INTF_A_HEY 0
#define INTF_A_YO 1
/** /**
* @ingroup iface_intf_A * @ingroup iface_intf_A
*/ */
#define INTF_A_HEY_SINCE_VERSION 1 #define INTF_A_HEY_SINCE_VERSION 1
/**
* @ingroup iface_intf_A
*/
#define INTF_A_YO_SINCE_VERSION 2
/** /**
* @ingroup iface_intf_A * @ingroup iface_intf_A
@ -181,6 +198,17 @@ intf_A_send_hey(struct wl_resource *resource_)
wl_resource_post_event(resource_, INTF_A_HEY); 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 #ifdef __cplusplus
} }
#endif #endif

View file

@ -49,11 +49,14 @@
<event name="hey"/> <event name="hey"/>
<event name="yo" since="2" deprecated-since="3"/>
<enum name="foo"> <enum name="foo">
<entry name="first" value="0" summary="this is the first"/> <entry name="first" value="0" summary="this is the first"/>
<entry name="second" value="1" summary="this is the second"/> <entry name="second" value="1" summary="this is the second"/>
<entry name="third" value="2" since="2" summary="this is the third"/> <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="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> </enum>
</interface> </interface>
</protocol> </protocol>