tests: add tests for #[repr(packed)] and #[repr(align(...))]
The tests are very straightforward, and effecitvely are just ensuring that the formatting works correctly and is included in all of the important cases. It's also very important to ensure we do not generate laid-out structs for layouts which we cannot reasonably represent in C (such as in cases where we weren't told what annotation to use for packed and specifically-aligned structures). Thus, add some tests to verify that this is the case. Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
This commit is contained in:
committed by
Emilio Cobos Álvarez
parent
725378d419
commit
f23d4ee6e8
@@ -0,0 +1,72 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
typedef struct RustAlign4Struct RustAlign4Struct;
|
||||||
|
|
||||||
|
typedef struct RustAlign4Union RustAlign4Union;
|
||||||
|
|
||||||
|
typedef struct RustPackedStruct RustPackedStruct;
|
||||||
|
|
||||||
|
typedef struct RustPackedUnion RustPackedUnion;
|
||||||
|
|
||||||
|
typedef struct UnsupportedAlign4Enum UnsupportedAlign4Enum;
|
||||||
|
|
||||||
|
typedef struct UnsupportedPacked4Struct UnsupportedPacked4Struct;
|
||||||
|
|
||||||
|
typedef struct UnsupportedPacked4Union UnsupportedPacked4Union;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(1) Align1Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align1Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(2) Align2Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align2Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(4) Align4Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align4Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(8) Align8Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align8Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(32) Align32Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align32Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_PACKED PackedStruct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} PackedStruct;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(1) Align1Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align1Union;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(4) Align4Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align4Union;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(16) Align16Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align16Union;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_PACKED PackedUnion {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} PackedUnion;
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
typedef struct RustAlign4Struct RustAlign4Struct;
|
||||||
|
|
||||||
|
typedef struct RustAlign4Union RustAlign4Union;
|
||||||
|
|
||||||
|
typedef struct RustPackedStruct RustPackedStruct;
|
||||||
|
|
||||||
|
typedef struct RustPackedUnion RustPackedUnion;
|
||||||
|
|
||||||
|
typedef struct UnsupportedAlign4Enum UnsupportedAlign4Enum;
|
||||||
|
|
||||||
|
typedef struct UnsupportedPacked4Struct UnsupportedPacked4Struct;
|
||||||
|
|
||||||
|
typedef struct UnsupportedPacked4Union UnsupportedPacked4Union;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(1) Align1Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align1Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(2) Align2Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align2Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(4) Align4Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align4Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(8) Align8Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align8Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(32) Align32Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align32Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_PACKED PackedStruct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} PackedStruct;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(1) Align1Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align1Union;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(4) Align4Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align4Union;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(16) Align16Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align16Union;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_PACKED PackedUnion {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} PackedUnion;
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign16Union OpaqueAlign16Union;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign1Struct OpaqueAlign1Struct;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign1Union OpaqueAlign1Union;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign2Struct OpaqueAlign2Struct;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign32Struct OpaqueAlign32Struct;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign4Struct OpaqueAlign4Struct;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign4Union OpaqueAlign4Union;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign8Struct OpaqueAlign8Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_PACKED PackedStruct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} PackedStruct;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_PACKED PackedUnion {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} PackedUnion;
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign16Union OpaqueAlign16Union;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign1Struct OpaqueAlign1Struct;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign1Union OpaqueAlign1Union;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign2Struct OpaqueAlign2Struct;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign32Struct OpaqueAlign32Struct;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign4Struct OpaqueAlign4Struct;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign4Union OpaqueAlign4Union;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign8Struct OpaqueAlign8Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_PACKED PackedStruct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} PackedStruct;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_PACKED PackedUnion {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} PackedUnion;
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
typedef struct OpaquePackedStruct OpaquePackedStruct;
|
||||||
|
|
||||||
|
typedef struct OpaquePackedUnion OpaquePackedUnion;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(1) Align1Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align1Union;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(4) Align4Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align4Union;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(16) Align16Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align16Union;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(1) Align1Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align1Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(2) Align2Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align2Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(4) Align4Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align4Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(8) Align8Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align8Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(32) Align32Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align32Struct;
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
typedef struct OpaquePackedStruct OpaquePackedStruct;
|
||||||
|
|
||||||
|
typedef struct OpaquePackedUnion OpaquePackedUnion;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(1) Align1Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align1Union;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(4) Align4Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align4Union;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(16) Align16Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align16Union;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(1) Align1Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align1Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(2) Align2Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align2Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(4) Align4Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align4Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(8) Align8Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align8Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(32) Align32Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align32Struct;
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
typedef struct RustAlign4Struct RustAlign4Struct;
|
||||||
|
|
||||||
|
typedef struct RustAlign4Union RustAlign4Union;
|
||||||
|
|
||||||
|
typedef struct RustPackedStruct RustPackedStruct;
|
||||||
|
|
||||||
|
typedef struct RustPackedUnion RustPackedUnion;
|
||||||
|
|
||||||
|
typedef struct UnsupportedAlign4Enum UnsupportedAlign4Enum;
|
||||||
|
|
||||||
|
typedef struct UnsupportedPacked4Struct UnsupportedPacked4Struct;
|
||||||
|
|
||||||
|
typedef struct UnsupportedPacked4Union UnsupportedPacked4Union;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(1) {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align1Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(2) {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align2Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(4) {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align4Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(8) {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align8Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(32) {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align32Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_PACKED {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} PackedStruct;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(1) {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align1Union;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(4) {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align4Union;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(16) {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align16Union;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_PACKED {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} PackedUnion;
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
typedef struct RustAlign4Struct RustAlign4Struct;
|
||||||
|
|
||||||
|
typedef struct RustAlign4Union RustAlign4Union;
|
||||||
|
|
||||||
|
typedef struct RustPackedStruct RustPackedStruct;
|
||||||
|
|
||||||
|
typedef struct RustPackedUnion RustPackedUnion;
|
||||||
|
|
||||||
|
typedef struct UnsupportedAlign4Enum UnsupportedAlign4Enum;
|
||||||
|
|
||||||
|
typedef struct UnsupportedPacked4Struct UnsupportedPacked4Struct;
|
||||||
|
|
||||||
|
typedef struct UnsupportedPacked4Union UnsupportedPacked4Union;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(1) {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align1Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(2) {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align2Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(4) {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align4Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(8) {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align8Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(32) {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align32Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_PACKED {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} PackedStruct;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(1) {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align1Union;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(4) {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align4Union;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(16) {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align16Union;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_PACKED {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} PackedUnion;
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <cstdarg>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <new>
|
||||||
|
|
||||||
|
struct RustAlign4Struct;
|
||||||
|
|
||||||
|
struct RustAlign4Union;
|
||||||
|
|
||||||
|
struct RustPackedStruct;
|
||||||
|
|
||||||
|
struct RustPackedUnion;
|
||||||
|
|
||||||
|
struct UnsupportedAlign4Enum;
|
||||||
|
|
||||||
|
struct UnsupportedPacked4Struct;
|
||||||
|
|
||||||
|
struct UnsupportedPacked4Union;
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(1) Align1Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(2) Align2Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(4) Align4Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(8) Align8Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(32) Align32Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_PACKED PackedStruct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_ALIGNED(1) Align1Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_ALIGNED(4) Align4Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_ALIGNED(16) Align16Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_PACKED PackedUnion {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign16Union OpaqueAlign16Union;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign1Struct OpaqueAlign1Struct;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign1Union OpaqueAlign1Union;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign2Struct OpaqueAlign2Struct;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign32Struct OpaqueAlign32Struct;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign4Struct OpaqueAlign4Struct;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign4Union OpaqueAlign4Union;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign8Struct OpaqueAlign8Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_PACKED {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} PackedStruct;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_PACKED {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} PackedUnion;
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign16Union OpaqueAlign16Union;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign1Struct OpaqueAlign1Struct;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign1Union OpaqueAlign1Union;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign2Struct OpaqueAlign2Struct;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign32Struct OpaqueAlign32Struct;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign4Struct OpaqueAlign4Struct;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign4Union OpaqueAlign4Union;
|
||||||
|
|
||||||
|
typedef struct OpaqueAlign8Struct OpaqueAlign8Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_PACKED {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} PackedStruct;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_PACKED {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} PackedUnion;
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <cstdarg>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <new>
|
||||||
|
|
||||||
|
struct OpaqueAlign16Union;
|
||||||
|
|
||||||
|
struct OpaqueAlign1Struct;
|
||||||
|
|
||||||
|
struct OpaqueAlign1Union;
|
||||||
|
|
||||||
|
struct OpaqueAlign2Struct;
|
||||||
|
|
||||||
|
struct OpaqueAlign32Struct;
|
||||||
|
|
||||||
|
struct OpaqueAlign4Struct;
|
||||||
|
|
||||||
|
struct OpaqueAlign4Union;
|
||||||
|
|
||||||
|
struct OpaqueAlign8Struct;
|
||||||
|
|
||||||
|
struct CBINDGEN_PACKED PackedStruct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_PACKED PackedUnion {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
typedef struct OpaquePackedStruct OpaquePackedStruct;
|
||||||
|
|
||||||
|
typedef struct OpaquePackedUnion OpaquePackedUnion;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(1) {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align1Union;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(4) {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align4Union;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(16) {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align16Union;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(1) {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align1Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(2) {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align2Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(4) {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align4Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(8) {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align8Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(32) {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align32Struct;
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
typedef struct OpaquePackedStruct OpaquePackedStruct;
|
||||||
|
|
||||||
|
typedef struct OpaquePackedUnion OpaquePackedUnion;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(1) {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align1Union;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(4) {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align4Union;
|
||||||
|
|
||||||
|
typedef union CBINDGEN_ALIGNED(16) {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
} Align16Union;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(1) {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align1Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(2) {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align2Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(4) {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align4Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(8) {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align8Struct;
|
||||||
|
|
||||||
|
typedef struct CBINDGEN_ALIGNED(32) {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
} Align32Struct;
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <cstdarg>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <new>
|
||||||
|
|
||||||
|
struct OpaquePackedStruct;
|
||||||
|
|
||||||
|
struct OpaquePackedUnion;
|
||||||
|
|
||||||
|
union CBINDGEN_ALIGNED(1) Align1Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_ALIGNED(4) Align4Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_ALIGNED(16) Align16Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(1) Align1Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(2) Align2Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(4) Align4Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(8) Align8Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(32) Align32Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
struct RustAlign4Struct;
|
||||||
|
|
||||||
|
struct RustAlign4Union;
|
||||||
|
|
||||||
|
struct RustPackedStruct;
|
||||||
|
|
||||||
|
struct RustPackedUnion;
|
||||||
|
|
||||||
|
struct UnsupportedAlign4Enum;
|
||||||
|
|
||||||
|
struct UnsupportedPacked4Struct;
|
||||||
|
|
||||||
|
struct UnsupportedPacked4Union;
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(1) Align1Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(2) Align2Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(4) Align4Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(8) Align8Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(32) Align32Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_PACKED PackedStruct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_ALIGNED(1) Align1Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_ALIGNED(4) Align4Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_ALIGNED(16) Align16Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_PACKED PackedUnion {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
struct RustAlign4Struct;
|
||||||
|
|
||||||
|
struct RustAlign4Union;
|
||||||
|
|
||||||
|
struct RustPackedStruct;
|
||||||
|
|
||||||
|
struct RustPackedUnion;
|
||||||
|
|
||||||
|
struct UnsupportedAlign4Enum;
|
||||||
|
|
||||||
|
struct UnsupportedPacked4Struct;
|
||||||
|
|
||||||
|
struct UnsupportedPacked4Union;
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(1) Align1Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(2) Align2Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(4) Align4Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(8) Align8Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(32) Align32Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_PACKED PackedStruct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_ALIGNED(1) Align1Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_ALIGNED(4) Align4Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_ALIGNED(16) Align16Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_PACKED PackedUnion {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
struct OpaqueAlign16Union;
|
||||||
|
|
||||||
|
struct OpaqueAlign1Struct;
|
||||||
|
|
||||||
|
struct OpaqueAlign1Union;
|
||||||
|
|
||||||
|
struct OpaqueAlign2Struct;
|
||||||
|
|
||||||
|
struct OpaqueAlign32Struct;
|
||||||
|
|
||||||
|
struct OpaqueAlign4Struct;
|
||||||
|
|
||||||
|
struct OpaqueAlign4Union;
|
||||||
|
|
||||||
|
struct OpaqueAlign8Struct;
|
||||||
|
|
||||||
|
struct CBINDGEN_PACKED PackedStruct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_PACKED PackedUnion {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
struct OpaqueAlign16Union;
|
||||||
|
|
||||||
|
struct OpaqueAlign1Struct;
|
||||||
|
|
||||||
|
struct OpaqueAlign1Union;
|
||||||
|
|
||||||
|
struct OpaqueAlign2Struct;
|
||||||
|
|
||||||
|
struct OpaqueAlign32Struct;
|
||||||
|
|
||||||
|
struct OpaqueAlign4Struct;
|
||||||
|
|
||||||
|
struct OpaqueAlign4Union;
|
||||||
|
|
||||||
|
struct OpaqueAlign8Struct;
|
||||||
|
|
||||||
|
struct CBINDGEN_PACKED PackedStruct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_PACKED PackedUnion {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
struct OpaquePackedStruct;
|
||||||
|
|
||||||
|
struct OpaquePackedUnion;
|
||||||
|
|
||||||
|
union CBINDGEN_ALIGNED(1) Align1Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_ALIGNED(4) Align4Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_ALIGNED(16) Align16Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(1) Align1Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(2) Align2Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(4) Align4Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(8) Align8Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(32) Align32Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
struct OpaquePackedStruct;
|
||||||
|
|
||||||
|
struct OpaquePackedUnion;
|
||||||
|
|
||||||
|
union CBINDGEN_ALIGNED(1) Align1Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_ALIGNED(4) Align4Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
|
|
||||||
|
union CBINDGEN_ALIGNED(16) Align16Union {
|
||||||
|
uintptr_t variant1;
|
||||||
|
uint8_t *variant2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(1) Align1Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(2) Align2Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(4) Align4Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(8) Align8Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CBINDGEN_ALIGNED(32) Align32Struct {
|
||||||
|
uintptr_t arg1;
|
||||||
|
uint8_t *arg2;
|
||||||
|
};
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
#[repr(align(1), C)]
|
||||||
|
pub struct Align1Struct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(align(2), C)]
|
||||||
|
pub struct Align2Struct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(align(4), C)]
|
||||||
|
pub struct Align4Struct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(align(8), C)]
|
||||||
|
pub struct Align8Struct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(align(32), C)]
|
||||||
|
pub struct Align32Struct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(packed, C)]
|
||||||
|
pub struct PackedStruct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(align(1), C)]
|
||||||
|
pub union Align1Union {
|
||||||
|
pub variant1: usize,
|
||||||
|
pub variant2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(align(4), C)]
|
||||||
|
pub union Align4Union {
|
||||||
|
pub variant1: usize,
|
||||||
|
pub variant2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(align(16), C)]
|
||||||
|
pub union Align16Union {
|
||||||
|
pub variant1: usize,
|
||||||
|
pub variant2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(packed, C)]
|
||||||
|
pub union PackedUnion {
|
||||||
|
pub variant1: usize,
|
||||||
|
pub variant2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
// #[repr(packed(n), C)] structs are currently unsupported.
|
||||||
|
#[repr(packed(4), C)]
|
||||||
|
pub struct UnsupportedPacked4Struct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
// #[repr(packed(n), C)] unions are currently unsupported.
|
||||||
|
#[repr(packed(4), C)]
|
||||||
|
pub union UnsupportedPacked4Union {
|
||||||
|
pub variant1: usize,
|
||||||
|
pub variant2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
// #[repr(align(n), C)] enums are currently unsupported.
|
||||||
|
#[repr(align(4), C)]
|
||||||
|
pub enum UnsupportedAlign4Enum {
|
||||||
|
Variant1,
|
||||||
|
Variant2,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Non-repr(C) structs aren't translated.
|
||||||
|
#[repr(align(4))]
|
||||||
|
pub struct RustAlign4Struct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Non-repr(C) structs aren't translated.
|
||||||
|
#[repr(packed)]
|
||||||
|
pub struct RustPackedStruct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Non-repr(C) unions aren't translated.
|
||||||
|
#[repr(align(4))]
|
||||||
|
pub struct RustAlign4Union {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Non-repr(C) unions aren't translated.
|
||||||
|
#[repr(packed)]
|
||||||
|
pub struct RustPackedUnion {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
header = """
|
||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
"""
|
||||||
|
|
||||||
|
[layout]
|
||||||
|
packed = "CBINDGEN_PACKED"
|
||||||
|
aligned_n = "CBINDGEN_ALIGNED"
|
||||||
|
|
||||||
|
[export]
|
||||||
|
include = [
|
||||||
|
"Align1Struct",
|
||||||
|
"Align2Struct",
|
||||||
|
"Align4Struct",
|
||||||
|
"Align8Struct",
|
||||||
|
"Align32Struct",
|
||||||
|
"PackedStruct",
|
||||||
|
"Align1Union",
|
||||||
|
"Align4Union",
|
||||||
|
"Align16Union",
|
||||||
|
"PackedUnion",
|
||||||
|
"UnsupportedPacked4Struct",
|
||||||
|
"UnsupportedPacked4Union",
|
||||||
|
"UnsupportedAlign4Enum",
|
||||||
|
"RustAlign4Struct",
|
||||||
|
"RustPackedStruct",
|
||||||
|
"RustAlign4Union",
|
||||||
|
"RustPackedUnion",
|
||||||
|
]
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
#[repr(packed, C)]
|
||||||
|
pub struct PackedStruct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(packed, C)]
|
||||||
|
pub union PackedUnion {
|
||||||
|
pub variant1: usize,
|
||||||
|
pub variant2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opaque because aligned_n is not defined.
|
||||||
|
#[repr(align(1), C)]
|
||||||
|
pub union OpaqueAlign1Union {
|
||||||
|
pub variant1: usize,
|
||||||
|
pub variant2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opaque because aligned_n is not defined.
|
||||||
|
#[repr(align(4), C)]
|
||||||
|
pub union OpaqueAlign4Union {
|
||||||
|
pub variant1: usize,
|
||||||
|
pub variant2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opaque because aligned_n is not defined.
|
||||||
|
#[repr(align(16), C)]
|
||||||
|
pub union OpaqueAlign16Union {
|
||||||
|
pub variant1: usize,
|
||||||
|
pub variant2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opaque because aligned_n is not defined.
|
||||||
|
#[repr(align(1), C)]
|
||||||
|
pub struct OpaqueAlign1Struct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opaque because aligned_n is not defined.
|
||||||
|
#[repr(align(2), C)]
|
||||||
|
pub struct OpaqueAlign2Struct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opaque because aligned_n is not defined.
|
||||||
|
#[repr(align(4), C)]
|
||||||
|
pub struct OpaqueAlign4Struct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opaque because aligned_n is not defined.
|
||||||
|
#[repr(align(8), C)]
|
||||||
|
pub struct OpaqueAlign8Struct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opaque because aligned_n is not defined.
|
||||||
|
#[repr(align(32), C)]
|
||||||
|
pub struct OpaqueAlign32Struct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
header = """
|
||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
"""
|
||||||
|
|
||||||
|
[layout]
|
||||||
|
# We do not define aligned_n.
|
||||||
|
packed = "CBINDGEN_PACKED"
|
||||||
|
|
||||||
|
[export]
|
||||||
|
include = [
|
||||||
|
"PackedStruct",
|
||||||
|
"PackedUnion",
|
||||||
|
"OpaqueAlign1Union",
|
||||||
|
"OpaqueAlign4Union",
|
||||||
|
"OpaqueAlign16Union",
|
||||||
|
"OpaqueAlign1Struct",
|
||||||
|
"OpaqueAlign2Struct",
|
||||||
|
"OpaqueAlign4Struct",
|
||||||
|
"OpaqueAlign8Struct",
|
||||||
|
"OpaqueAlign32Struct",
|
||||||
|
]
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
#[repr(align(1), C)]
|
||||||
|
pub union Align1Union {
|
||||||
|
pub variant1: usize,
|
||||||
|
pub variant2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(align(4), C)]
|
||||||
|
pub union Align4Union {
|
||||||
|
pub variant1: usize,
|
||||||
|
pub variant2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(align(16), C)]
|
||||||
|
pub union Align16Union {
|
||||||
|
pub variant1: usize,
|
||||||
|
pub variant2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(align(1), C)]
|
||||||
|
pub struct Align1Struct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(align(2), C)]
|
||||||
|
pub struct Align2Struct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(align(4), C)]
|
||||||
|
pub struct Align4Struct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(align(8), C)]
|
||||||
|
pub struct Align8Struct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(align(32), C)]
|
||||||
|
pub struct Align32Struct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opaque because packed is not defined.
|
||||||
|
#[repr(packed, C)]
|
||||||
|
pub struct OpaquePackedStruct {
|
||||||
|
pub arg1: usize,
|
||||||
|
pub arg2: *mut u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opaque because packed is not defined.
|
||||||
|
#[repr(packed, C)]
|
||||||
|
pub union OpaquePackedUnion {
|
||||||
|
pub variant1: usize,
|
||||||
|
pub variant2: *mut u8,
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
header = """
|
||||||
|
#define CBINDGEN_PACKED __attribute__ ((packed))
|
||||||
|
#define CBINDGEN_ALIGNED(n) __attribute__ ((aligned(n)))
|
||||||
|
"""
|
||||||
|
|
||||||
|
[layout]
|
||||||
|
# We do not define packed.
|
||||||
|
aligned_n = "CBINDGEN_ALIGNED"
|
||||||
|
|
||||||
|
[export]
|
||||||
|
include = [
|
||||||
|
"Align1Union",
|
||||||
|
"Align4Union",
|
||||||
|
"Align16Union",
|
||||||
|
"Align1Struct",
|
||||||
|
"Align2Struct",
|
||||||
|
"Align4Struct",
|
||||||
|
"Align8Struct",
|
||||||
|
"Align32Struct",
|
||||||
|
"OpaquePackedStruct",
|
||||||
|
"OpaquePackedUnion",
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user