| 1 |
#define MUST_USE_FUNC __attribute__((warn_unused_result)) |
| 2 |
#define MUST_USE_STRUCT __attribute__((warn_unused)) |
| 3 |
#define MUST_USE_ENUM /* nothing */ |
| 4 |
|
| 5 |
|
| 6 |
#include <stdarg.h> |
| 7 |
#include <stdbool.h> |
| 8 |
#include <stdint.h> |
| 9 |
#include <stdlib.h> |
| 10 |
|
| 11 |
enum MaybeOwnedPtr_i32_Tag |
| 12 |
#ifdef __cplusplus |
| 13 |
: uint8_t |
| 14 |
#endif // __cplusplus |
| 15 |
{ |
| 16 |
Owned_i32, |
| 17 |
None_i32, |
| 18 |
}; |
| 19 |
#ifndef __cplusplus |
| 20 |
typedef uint8_t MaybeOwnedPtr_i32_Tag; |
| 21 |
#endif // __cplusplus |
| 22 |
|
| 23 |
typedef struct MUST_USE_STRUCT MaybeOwnedPtr_i32 { |
| 24 |
MaybeOwnedPtr_i32_Tag tag; |
| 25 |
union { |
| 26 |
struct { |
| 27 |
int32_t *owned; |
| 28 |
}; |
| 29 |
}; |
| 30 |
} MaybeOwnedPtr_i32; |
| 31 |
|
| 32 |
typedef struct MUST_USE_STRUCT OwnedPtr_i32 { |
| 33 |
int32_t *ptr; |
| 34 |
} OwnedPtr_i32; |
| 35 |
|
| 36 |
#ifdef __cplusplus |
| 37 |
extern "C" { |
| 38 |
#endif // __cplusplus |
| 39 |
|
| 40 |
MUST_USE_FUNC struct MaybeOwnedPtr_i32 maybe_consume(struct OwnedPtr_i32 input); |
| 41 |
|
| 42 |
#ifdef __cplusplus |
| 43 |
} // extern "C" |
| 44 |
#endif // __cplusplus |