Add tests for nested struct literals
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct PREFIXBar {
|
||||
int32_t a;
|
||||
} PREFIXBar;
|
||||
|
||||
typedef struct PREFIXFoo {
|
||||
int32_t a;
|
||||
uint32_t b;
|
||||
PREFIXBar bar;
|
||||
} PREFIXFoo;
|
||||
|
||||
#define PREFIXVAL (PREFIXFoo){ .a = 42, .b = 1337, .bar = (PREFIXBar){ .a = 323 } }
|
||||
|
||||
void root(PREFIXFoo x);
|
||||
@@ -0,0 +1,17 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct {
|
||||
int32_t a;
|
||||
} PREFIXBar;
|
||||
|
||||
typedef struct {
|
||||
int32_t a;
|
||||
uint32_t b;
|
||||
PREFIXBar bar;
|
||||
} PREFIXFoo;
|
||||
|
||||
#define PREFIXVAL (PREFIXFoo){ .a = 42, .b = 1337, .bar = (PREFIXBar){ .a = 323 } }
|
||||
|
||||
void root(PREFIXFoo x);
|
||||
@@ -0,0 +1,20 @@
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
|
||||
struct PREFIXBar {
|
||||
int32_t a;
|
||||
};
|
||||
|
||||
struct PREFIXFoo {
|
||||
int32_t a;
|
||||
uint32_t b;
|
||||
PREFIXBar bar;
|
||||
};
|
||||
|
||||
static const PREFIXFoo PREFIXVAL = (PREFIXFoo){ .a = 42, .b = 1337, .bar = (PREFIXBar){ .a = 323 } };
|
||||
|
||||
extern "C" {
|
||||
|
||||
void root(PREFIXFoo x);
|
||||
|
||||
} // extern "C"
|
||||
@@ -0,0 +1,17 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
struct PREFIXBar {
|
||||
int32_t a;
|
||||
};
|
||||
|
||||
struct PREFIXFoo {
|
||||
int32_t a;
|
||||
uint32_t b;
|
||||
struct PREFIXBar bar;
|
||||
};
|
||||
|
||||
#define PREFIXVAL (PREFIXFoo){ .a = 42, .b = 1337, .bar = (PREFIXBar){ .a = 323 } }
|
||||
|
||||
void root(struct PREFIXFoo x);
|
||||
@@ -0,0 +1,20 @@
|
||||
#[repr(C)]
|
||||
struct Foo {
|
||||
a: i32,
|
||||
b: u32,
|
||||
bar: Bar,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
struct Bar {
|
||||
a: i32,
|
||||
}
|
||||
|
||||
const VAL: Foo = Foo {
|
||||
a: 42,
|
||||
b: 1337,
|
||||
bar: Bar { a: 323 },
|
||||
};
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn root(x: Foo) {}
|
||||
@@ -0,0 +1,2 @@
|
||||
[export]
|
||||
prefix = "PREFIX"
|
||||
Reference in New Issue
Block a user