.cargo/vendor/cbindgen/tests/expectations/asserted_cast.compat.c
raw| 1 | #define MY_ASSERT(...) do { } while (0) |
| 2 | #define MY_ATTRS __attribute((noinline)) |
| 3 | |
| 4 | |
| 5 | #include <stdarg.h> |
| 6 | #include <stdbool.h> |
| 7 | #include <stdint.h> |
| 8 | #include <stdlib.h> |
| 9 | |
| 10 | typedef struct I I; |
| 11 | |
| 12 | enum H_Tag |
| 13 | #ifdef __cplusplus |
| 14 | : uint8_t |
| 15 | #endif // __cplusplus |
| 16 | { |
| 17 | H_Foo, |
| 18 | H_Bar, |
| 19 | H_Baz, |
| 20 | }; |
| 21 | #ifndef __cplusplus |
| 22 | typedef uint8_t H_Tag; |
| 23 | #endif // __cplusplus |
| 24 | |
| 25 | typedef struct { |
| 26 | uint8_t x; |
| 27 | int16_t y; |
| 28 | } H_Bar_Body; |
| 29 | |
| 30 | typedef struct { |
| 31 | H_Tag tag; |
| 32 | union { |
| 33 | struct { |
| 34 | int16_t foo; |
| 35 | }; |
| 36 | H_Bar_Body bar; |
| 37 | }; |
| 38 | } H; |
| 39 | |
| 40 | enum J_Tag |
| 41 | #ifdef __cplusplus |
| 42 | : uint8_t |
| 43 | #endif // __cplusplus |
| 44 | { |
| 45 | J_Foo, |
| 46 | J_Bar, |
| 47 | J_Baz, |
| 48 | }; |
| 49 | #ifndef __cplusplus |
| 50 | typedef uint8_t J_Tag; |
| 51 | #endif // __cplusplus |
| 52 | |
| 53 | typedef struct { |
| 54 | uint8_t x; |
| 55 | int16_t y; |
| 56 | } J_Bar_Body; |
| 57 | |
| 58 | typedef struct { |
| 59 | J_Tag tag; |
| 60 | union { |
| 61 | struct { |
| 62 | int16_t foo; |
| 63 | }; |
| 64 | J_Bar_Body bar; |
| 65 | }; |
| 66 | } J; |
| 67 | |
| 68 | enum K_Tag |
| 69 | #ifdef __cplusplus |
| 70 | : uint8_t |
| 71 | #endif // __cplusplus |
| 72 | { |
| 73 | K_Foo, |
| 74 | K_Bar, |
| 75 | K_Baz, |
| 76 | }; |
| 77 | #ifndef __cplusplus |
| 78 | typedef uint8_t K_Tag; |
| 79 | #endif // __cplusplus |
| 80 | |
| 81 | typedef struct { |
| 82 | K_Tag tag; |
| 83 | uint8_t x; |
| 84 | int16_t y; |
| 85 | } K_Bar_Body; |
| 86 | |
| 87 | typedef union { |
| 88 | K_Tag tag; |
| 89 | struct { |
| 90 | K_Tag foo_tag; |
| 91 | int16_t foo; |
| 92 | }; |
| 93 | K_Bar_Body bar; |
| 94 | } K; |
| 95 | |
| 96 | #ifdef __cplusplus |
| 97 | extern "C" { |
| 98 | #endif // __cplusplus |
| 99 | |
| 100 | void foo(H h, I i, J j, K k); |
| 101 | |
| 102 | #ifdef __cplusplus |
| 103 | } // extern "C" |
| 104 | #endif // __cplusplus |