Files
kotlin-fork/kotlin-native/backend.native/tests/interop/basics/cstructs.def
T
2021-10-19 13:45:00 +00:00

65 lines
1015 B
Modula-2

nonStrictEnums = NonStrict
---
typedef struct {
int i;
} Trivial;
enum E {
R, G, B
};
enum NonStrict {
N, S, K
};
struct Complex {
unsigned int ui;
Trivial t;
struct Complex* next;
enum E e;
enum NonStrict nonStrict;
int arr[2];
_Bool b;
};
struct __attribute__((packed)) Packed {
int i : 1;
enum E e : 2;
};
struct Complex produceComplex() {
struct Complex complex = {
.ui = 128,
.t = {1},
.next = 0,
.e = R,
.nonStrict = K,
.arr = {-51, -19},
.b = 1
};
return complex;
};
struct WithFlexibleArray {
int size;
int data[];
};
struct WithFlexibleArrayWithPadding {
int size;
char c;
long long data[];
};
void fillArray(struct WithFlexibleArrayWithPadding *flex, int count) {
flex->size = count;
flex->c = '!';
for (int i = 0; i < count; i++) {
flex->data[i] = (((long long)i) << 32) | (i * 100);
}
}
struct WithZeroSizedArray {
int size;
int data[0];
};