wasi/api.h: regenerated with tagged unions

This commit is contained in:
Pat Hickey 2020-02-06 13:20:57 -08:00
parent 4f03c9bbe7
commit 852d093a3c

View File

@ -1169,16 +1169,20 @@ _Static_assert(offsetof(__wasi_event_fd_readwrite_t, flags) == 8, "witx calculat
/**
* The contents of an $event.
*/
typedef union __wasi_event_u_t {
/**
* When type is `eventtype::fd_read` or `eventtype::fd_write`:
*/
__wasi_event_fd_readwrite_t fd_readwrite;
typedef union __wasi_event_u_u_t {
__wasi_event_fd_readwrite_t fd_read;
__wasi_event_fd_readwrite_t fd_write;
} __wasi_event_u_u_t;
typedef struct __wasi_event_u_t {
__wasi_eventtype_t tag;
__wasi_event_u_u_t u;
} __wasi_event_u_t;
_Static_assert(sizeof(__wasi_event_u_t) == 16, "witx calculated size");
_Static_assert(sizeof(__wasi_event_u_t) == 24, "witx calculated size");
_Static_assert(_Alignof(__wasi_event_u_t) == 8, "witx calculated align");
_Static_assert(offsetof(__wasi_event_u_t, u) == 8, "witx calculated union offset");
_Static_assert(sizeof(__wasi_event_u_u_t) == 16, "witx calculated union size");
_Static_assert(_Alignof(__wasi_event_u_u_t) == 8, "witx calculated union align");
/**
* An event that occurred.
@ -1195,22 +1199,16 @@ typedef struct __wasi_event_t {
__wasi_errno_t error;
/**
* The type of the event that occurred.
*/
__wasi_eventtype_t type;
/**
* The contents of the event.
* The type of the event that occurred, and its contents.
*/
__wasi_event_u_t u;
} __wasi_event_t;
_Static_assert(sizeof(__wasi_event_t) == 32, "witx calculated size");
_Static_assert(sizeof(__wasi_event_t) == 40, "witx calculated size");
_Static_assert(_Alignof(__wasi_event_t) == 8, "witx calculated align");
_Static_assert(offsetof(__wasi_event_t, userdata) == 0, "witx calculated offset");
_Static_assert(offsetof(__wasi_event_t, error) == 8, "witx calculated offset");
_Static_assert(offsetof(__wasi_event_t, type) == 10, "witx calculated offset");
_Static_assert(offsetof(__wasi_event_t, u) == 16, "witx calculated offset");
/**
@ -1284,21 +1282,21 @@ _Static_assert(offsetof(__wasi_subscription_fd_readwrite_t, file_descriptor) ==
/**
* The contents of a $subscription.
*/
typedef union __wasi_subscription_u_t {
/**
* When type is `eventtype::clock`:
*/
typedef union __wasi_subscription_u_u_t {
__wasi_subscription_clock_t clock;
/**
* When type is `eventtype::fd_read` or `eventtype::fd_write`:
*/
__wasi_subscription_fd_readwrite_t fd_readwrite;
__wasi_subscription_fd_readwrite_t fd_read;
__wasi_subscription_fd_readwrite_t fd_write;
} __wasi_subscription_u_u_t;
typedef struct __wasi_subscription_u_t {
__wasi_eventtype_t tag;
__wasi_subscription_u_u_t u;
} __wasi_subscription_u_t;
_Static_assert(sizeof(__wasi_subscription_u_t) == 32, "witx calculated size");
_Static_assert(sizeof(__wasi_subscription_u_t) == 40, "witx calculated size");
_Static_assert(_Alignof(__wasi_subscription_u_t) == 8, "witx calculated align");
_Static_assert(offsetof(__wasi_subscription_u_t, u) == 8, "witx calculated union offset");
_Static_assert(sizeof(__wasi_subscription_u_u_t) == 32, "witx calculated union size");
_Static_assert(_Alignof(__wasi_subscription_u_u_t) == 8, "witx calculated union align");
/**
* Subscription to an event.
@ -1311,12 +1309,7 @@ typedef struct __wasi_subscription_t {
__wasi_userdata_t userdata;
/**
* The type of the event to which to subscribe.
*/
__wasi_eventtype_t type;
/**
* The contents of the subscription.
* The type of the event to which to subscribe, and its contents
*/
__wasi_subscription_u_t u;
@ -1325,8 +1318,7 @@ typedef struct __wasi_subscription_t {
_Static_assert(sizeof(__wasi_subscription_t) == 48, "witx calculated size");
_Static_assert(_Alignof(__wasi_subscription_t) == 8, "witx calculated align");
_Static_assert(offsetof(__wasi_subscription_t, userdata) == 0, "witx calculated offset");
_Static_assert(offsetof(__wasi_subscription_t, type) == 8, "witx calculated offset");
_Static_assert(offsetof(__wasi_subscription_t, u) == 16, "witx calculated offset");
_Static_assert(offsetof(__wasi_subscription_t, u) == 8, "witx calculated offset");
/**
* Exit code generated by a process when exiting.
@ -1616,40 +1608,22 @@ _Static_assert(sizeof(__wasi_prestat_dir_t) == 4, "witx calculated size");
_Static_assert(_Alignof(__wasi_prestat_dir_t) == 4, "witx calculated align");
_Static_assert(offsetof(__wasi_prestat_dir_t, pr_name_len) == 0, "witx calculated offset");
/**
* The contents of an $prestat.
*/
typedef union __wasi_prestat_u_t {
/**
* When type is `preopentype::dir`:
*/
__wasi_prestat_dir_t dir;
} __wasi_prestat_u_t;
_Static_assert(sizeof(__wasi_prestat_u_t) == 4, "witx calculated size");
_Static_assert(_Alignof(__wasi_prestat_u_t) == 4, "witx calculated align");
/**
* Information about a pre-opened capability.
*/
typedef union __wasi_prestat_u_t {
__wasi_prestat_dir_t dir;
} __wasi_prestat_u_t;
typedef struct __wasi_prestat_t {
/**
* The type of the pre-opened capability.
*/
__wasi_preopentype_t pr_type;
/**
* The contents of the information.
*/
__wasi_preopentype_t tag;
__wasi_prestat_u_t u;
} __wasi_prestat_t;
_Static_assert(sizeof(__wasi_prestat_t) == 8, "witx calculated size");
_Static_assert(_Alignof(__wasi_prestat_t) == 4, "witx calculated align");
_Static_assert(offsetof(__wasi_prestat_t, pr_type) == 0, "witx calculated offset");
_Static_assert(offsetof(__wasi_prestat_t, u) == 4, "witx calculated offset");
_Static_assert(offsetof(__wasi_prestat_t, u) == 4, "witx calculated union offset");
_Static_assert(sizeof(__wasi_prestat_u_t) == 4, "witx calculated union size");
_Static_assert(_Alignof(__wasi_prestat_u_t) == 4, "witx calculated union align");
/**
* @defgroup wasi_snapshot_preview1