diff --git a/tests/expectations/both/prefixed_struct_literal_deep.c b/tests/expectations/both/prefixed_struct_literal_deep.c new file mode 100644 index 0000000..33aa66e --- /dev/null +++ b/tests/expectations/both/prefixed_struct_literal_deep.c @@ -0,0 +1,17 @@ +#include +#include +#include + +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); diff --git a/tests/expectations/prefixed_struct_literal_deep.c b/tests/expectations/prefixed_struct_literal_deep.c new file mode 100644 index 0000000..a90481a --- /dev/null +++ b/tests/expectations/prefixed_struct_literal_deep.c @@ -0,0 +1,17 @@ +#include +#include +#include + +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); diff --git a/tests/expectations/prefixed_struct_literal_deep.cpp b/tests/expectations/prefixed_struct_literal_deep.cpp new file mode 100644 index 0000000..0a7a543 --- /dev/null +++ b/tests/expectations/prefixed_struct_literal_deep.cpp @@ -0,0 +1,20 @@ +#include +#include + +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" diff --git a/tests/expectations/tag/prefixed_struct_literal_deep.c b/tests/expectations/tag/prefixed_struct_literal_deep.c new file mode 100644 index 0000000..0003ecc --- /dev/null +++ b/tests/expectations/tag/prefixed_struct_literal_deep.c @@ -0,0 +1,17 @@ +#include +#include +#include + +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); diff --git a/tests/rust/prefixed_struct_literal_deep.rs b/tests/rust/prefixed_struct_literal_deep.rs new file mode 100644 index 0000000..dfadfdb --- /dev/null +++ b/tests/rust/prefixed_struct_literal_deep.rs @@ -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) {} diff --git a/tests/rust/prefixed_struct_literal_deep.toml b/tests/rust/prefixed_struct_literal_deep.toml new file mode 100644 index 0000000..189d09a --- /dev/null +++ b/tests/rust/prefixed_struct_literal_deep.toml @@ -0,0 +1,2 @@ +[export] +prefix = "PREFIX"