Commit test expectations

This commit is contained in:
Ryan Hunt
2017-11-09 02:21:33 -05:00
parent b2587edfb6
commit 6a02ec4a7f
63 changed files with 1443 additions and 24 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ description = "A tool for generating C bindings to Rust code."
keywords = ["bindings", "ffi", "code-generation"]
categories = ["external-ffi-bindings", "development-tools::ffi"]
repository = "https://github.com/eqrion/cbindgen/"
exclude = ["test.py", "compile-tests/**"]
exclude = ["test.py", "tests/**"]
[badges]
travis-ci = { repository = "eqrion/cbindgen" }
+21 -23
View File
@@ -32,22 +32,22 @@ def gcc(src):
if gcc_bin == None:
gcc_bin = 'gcc'
subprocess.check_output([gcc_bin, "-D", "DEFINED", "-c", src, "-o", "compile-tests/tmp.o"])
os.remove("compile-tests/tmp.o")
subprocess.check_output([gcc_bin, "-D", "DEFINED", "-c", src, "-o", "tests/expectations/tmp.o"])
os.remove("tests/expectations/tmp.o")
def gxx(src):
gxx_bin = os.environ.get('CXX')
if gxx_bin == None:
gxx_bin = 'g++'
subprocess.check_output([gxx_bin, "-D", "DEFINED", "-std=c++11", "-c", src, "-o", "compile-tests/tmp.o"])
os.remove("compile-tests/tmp.o")
subprocess.check_output([gxx_bin, "-D", "DEFINED", "-std=c++11", "-c", src, "-o", "tests/expectations/tmp.o"])
os.remove("tests/expectations/tmp.o")
def run_compile_test(rust_src, leave_output, c):
def run_compile_test(rust_src, c):
if c:
out = rust_src.replace(".rs", ".c")
out = os.path.join('tests/expectations/', os.path.basename(rust_src).replace(".rs", ".c"))
else:
out = rust_src.replace(".rs", ".cpp")
out = os.path.join('tests/expectations/', os.path.basename(rust_src).replace(".rs", ".cpp"))
config = rust_src.replace(".rs", ".toml")
if not os.path.exists(config):
@@ -61,11 +61,7 @@ def run_compile_test(rust_src, leave_output, c):
else:
gxx(out)
if not leave_output:
os.remove(out)
except subprocess.CalledProcessError:
if not leave_output and os.path.exists(out):
os.remove(out)
return False
return True
@@ -75,28 +71,30 @@ if not build_cbindgen():
args = sys.argv[1:]
files = [x for x in args if not x.startswith("-")]
flags = [x for x in args if x.startswith("-")]
leave_output = False
c = False
for flag in flags:
if flag == "-l":
leave_output = True
elif flag == "-c":
c = True
tests = []
if len(files) == 0:
tests = glob.glob("compile-tests/*.rs")
tests = glob.glob("tests/rust/*.rs")
else:
tests = files
num_pass = 0
num_fail = 0
# C
for test in tests:
if run_compile_test(test, leave_output, c):
if run_compile_test(test, True):
num_pass += 1
print("Pass - %s" % test)
else:
num_fail += 1
print("Fail - %s" % test)
# C++
for test in tests:
if run_compile_test(test, False):
num_pass += 1
print("Pass - %s" % test)
else:
+36
View File
@@ -0,0 +1,36 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
enum Status {
Ok = 0,
Err = 1,
};
typedef uint32_t Status;
typedef struct {
int32_t a;
float b;
} Dep;
typedef struct {
int32_t a;
int32_t b;
Dep c;
} Foo_i32;
typedef Foo_i32 IntFoo;
typedef struct {
double a;
double b;
Dep c;
} Foo_f64;
typedef Foo_f64 DoubleFoo;
typedef int32_t Unit;
typedef Status SpecialStatus;
void root(IntFoo x, DoubleFoo y, Unit z, SpecialStatus w);
+51
View File
@@ -0,0 +1,51 @@
#include <cstdint>
#include <cstdlib>
extern "C" {
enum class Status : uint32_t {
Ok = 0,
Err = 1,
};
struct Dep {
int32_t a;
float b;
};
struct Foo_i32 {
int32_t a;
int32_t b;
Dep c;
};
typedef Foo_i32 IntFoo;
struct Foo_f64 {
double a;
double b;
Dep c;
};
typedef Foo_f64 DoubleFoo;
typedef int32_t Unit;
typedef Status SpecialStatus;
void root(IntFoo x, DoubleFoo y, Unit z, SpecialStatus w);
} // extern "C"
template<typename X>
struct Foo;
template<>
struct Foo<double> : public Foo_f64 {
};
template<>
struct Foo<int32_t> : public Foo_i32 {
};
+20
View File
@@ -0,0 +1,20 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
enum C {
X = 2,
Y = 3,
};
typedef uint32_t C;
typedef struct {
int32_t m0;
} A;
typedef struct {
int32_t x;
float y;
} B;
void root(A x, B y, C z);
+29
View File
@@ -0,0 +1,29 @@
#include <cstdint>
#include <cstdlib>
extern "C" {
enum class C : uint32_t {
X = 2,
Y = 3,
};
struct A {
int32_t m0;
bool operator<(const A& other) const {
return m0 < other.m0;
}
bool operator<=(const A& other) const {
return m0 <= other.m0;
}
};
struct B {
int32_t x;
float y;
};
void root(A x, B y, C z);
} // extern "C"
+35
View File
@@ -0,0 +1,35 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef void (*A)();
typedef void (*B)();
typedef bool (*C)(int32_t, int32_t);
typedef bool (*(*D)(int32_t))(float);
typedef int32_t (*(*E)())[16];
typedef const int32_t *F;
typedef const int32_t *const *G;
typedef int32_t *const *H;
typedef int32_t (*I)[16];
typedef double (**J)(float);
typedef int32_t K[16];
typedef const int32_t *L[16];
typedef bool (*M[16])(int32_t, int32_t);
typedef void (*N[16])(int32_t, int32_t);
void (*O())();
void root(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n);
+38
View File
@@ -0,0 +1,38 @@
#include <cstdint>
#include <cstdlib>
extern "C" {
typedef void (*A)();
typedef void (*B)();
typedef bool (*C)(int32_t, int32_t);
typedef bool (*(*D)(int32_t))(float);
typedef int32_t (*(*E)())[16];
typedef const int32_t *F;
typedef const int32_t *const *G;
typedef int32_t *const *H;
typedef int32_t (*I)[16];
typedef double (**J)(float);
typedef int32_t K[16];
typedef const int32_t *L[16];
typedef bool (*M[16])(int32_t, int32_t);
typedef void (*N[16])(int32_t, int32_t);
void (*O())();
void root(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n);
} // extern "C"
+27
View File
@@ -0,0 +1,27 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#if (defined(NOT_DEFINED) || defined(DEFINED))
typedef struct {
int32_t x;
} Foo;
#endif
#if defined(NOT_DEFINED)
typedef struct {
Foo y;
} Bar;
#endif
#if defined(DEFINED)
typedef struct {
Foo z;
} Bar;
#endif
typedef struct {
Bar w;
} Root;
void root(Root a);
+30
View File
@@ -0,0 +1,30 @@
#include <cstdint>
#include <cstdlib>
extern "C" {
#if (defined(NOT_DEFINED) || defined(DEFINED))
struct Foo {
int32_t x;
};
#endif
#if defined(NOT_DEFINED)
struct Bar {
Foo y;
};
#endif
#if defined(DEFINED)
struct Bar {
Foo z;
};
#endif
struct Root {
Bar w;
};
void root(Root a);
} // extern "C"
+45
View File
@@ -0,0 +1,45 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#if (defined(PLATFORM_WIN) || defined(M_32))
enum BarType {
A = 0,
B = 1,
C = 2,
};
typedef uint32_t BarType;
#endif
#if (defined(PLATFORM_UNIX) && defined(X11))
enum FooType {
A = 0,
B = 1,
C = 2,
};
typedef uint32_t FooType;
#endif
#if (defined(PLATFORM_UNIX) && defined(X11))
typedef struct {
FooType ty;
int32_t x;
float y;
} FooHandle;
#endif
#if (defined(PLATFORM_WIN) || defined(M_32))
typedef struct {
BarType ty;
int32_t x;
float y;
} BarHandle;
#endif
#if (defined(PLATFORM_UNIX) && defined(X11))
void root(FooHandle a);
#endif
#if (defined(PLATFORM_WIN) || defined(M_32))
void root(BarHandle a);
#endif
+46
View File
@@ -0,0 +1,46 @@
#include <cstdint>
#include <cstdlib>
extern "C" {
#if (defined(PLATFORM_WIN) || defined(M_32))
enum class BarType : uint32_t {
A = 0,
B = 1,
C = 2,
};
#endif
#if (defined(PLATFORM_UNIX) && defined(X11))
enum class FooType : uint32_t {
A = 0,
B = 1,
C = 2,
};
#endif
#if (defined(PLATFORM_UNIX) && defined(X11))
struct FooHandle {
FooType ty;
int32_t x;
float y;
};
#endif
#if (defined(PLATFORM_WIN) || defined(M_32))
struct BarHandle {
BarType ty;
int32_t x;
float y;
};
#endif
#if (defined(PLATFORM_UNIX) && defined(X11))
void root(FooHandle a);
#endif
#if (defined(PLATFORM_WIN) || defined(M_32))
void root(BarHandle a);
#endif
} // extern "C"
+15
View File
@@ -0,0 +1,15 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#define BAR u8"hello world"
#define FOO 10
#define ZOM 3.14
typedef struct {
int32_t x[FOO];
} Foo;
void root(Foo x);
+18
View File
@@ -0,0 +1,18 @@
#include <cstdint>
#include <cstdlib>
extern "C" {
static const char* BAR = u8"hello world";
static const int32_t FOO = 10;
static const float ZOM = 3.14;
struct Foo {
int32_t x[FOO];
};
void root(Foo x);
} // extern "C"
+48
View File
@@ -0,0 +1,48 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
enum A {
a1 = 0,
a2 = 2,
a3 = 3,
a4 = 5,
};
typedef uint32_t A;
enum B {
b1 = 0,
b2 = 2,
b3 = 3,
b4 = 5,
};
typedef uint16_t B;
enum C {
c1 = 0,
c2 = 2,
c3 = 3,
c4 = 5,
};
typedef uint8_t C;
enum D {
d1 = 0,
d2 = 2,
d3 = 3,
d4 = 5,
};
typedef uintptr_t D;
enum E {
e1 = 0,
e2 = 2,
e3 = 3,
e4 = 5,
};
typedef intptr_t E;
struct Opaque;
typedef struct Opaque Opaque;
void root(Opaque *o, A a, B b, C c, D d, E e);
+45
View File
@@ -0,0 +1,45 @@
#include <cstdint>
#include <cstdlib>
extern "C" {
enum class A : uint32_t {
a1 = 0,
a2 = 2,
a3 = 3,
a4 = 5,
};
enum class B : uint16_t {
b1 = 0,
b2 = 2,
b3 = 3,
b4 = 5,
};
enum class C : uint8_t {
c1 = 0,
c2 = 2,
c3 = 3,
c4 = 5,
};
enum class D : uintptr_t {
d1 = 0,
d2 = 2,
d3 = 3,
d4 = 5,
};
enum class E : intptr_t {
e1 = 0,
e2 = 2,
e3 = 3,
e4 = 5,
};
struct Opaque;
void root(Opaque *o, A a, B b, C c, D d, E e);
} // extern "C"
+132
View File
@@ -0,0 +1,132 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct {
float _0;
} TypedLength_f32__UnknownUnit;
typedef struct {
float _0;
} TypedLength_f32__LayoutUnit;
typedef struct {
float _0;
} Length_f32;
typedef TypedLength_f32__LayoutUnit LayoutLength;
typedef struct {
float top;
float right;
float bottom;
float left;
} TypedSideOffsets2D_f32__UnknownUnit;
typedef struct {
float top;
float right;
float bottom;
float left;
} TypedSideOffsets2D_f32__LayoutUnit;
typedef struct {
float top;
float right;
float bottom;
float left;
} SideOffsets2D_f32;
typedef TypedSideOffsets2D_f32__LayoutUnit LayoutSideOffsets2D;
typedef struct {
float width;
float height;
} TypedSize2D_f32__UnknownUnit;
typedef struct {
float width;
float height;
} TypedSize2D_f32__LayoutUnit;
typedef struct {
float width;
float height;
} Size2D_f32;
typedef TypedSize2D_f32__LayoutUnit LayoutSize2D;
typedef struct {
float x;
float y;
} TypedPoint2D_f32__UnknownUnit;
typedef struct {
float x;
float y;
} TypedPoint2D_f32__LayoutUnit;
typedef struct {
float x;
float y;
} Point2D_f32;
typedef TypedPoint2D_f32__LayoutUnit LayoutPoint2D;
typedef struct {
TypedPoint2D_f32__UnknownUnit origin;
TypedSize2D_f32__UnknownUnit size;
} TypedRect_f32__UnknownUnit;
typedef struct {
TypedPoint2D_f32__LayoutUnit origin;
TypedSize2D_f32__LayoutUnit size;
} TypedRect_f32__LayoutUnit;
typedef struct {
TypedPoint2D_f32__UnknownUnit origin;
TypedSize2D_f32__UnknownUnit size;
} Rect_f32;
typedef TypedRect_f32__LayoutUnit LayoutRect;
typedef struct {
float m11;
float m12;
float m21;
float m22;
float m31;
float m32;
} TypedTransform2D_f32__UnknownUnit__LayoutUnit;
typedef struct {
float m11;
float m12;
float m21;
float m22;
float m31;
float m32;
} TypedTransform2D_f32__LayoutUnit__UnknownUnit;
void root(TypedLength_f32__UnknownUnit length_a,
TypedLength_f32__LayoutUnit length_b,
Length_f32 length_c,
LayoutLength length_d,
TypedSideOffsets2D_f32__UnknownUnit side_offsets_a,
TypedSideOffsets2D_f32__LayoutUnit side_offsets_b,
SideOffsets2D_f32 side_offsets_c,
LayoutSideOffsets2D side_offsets_d,
TypedSize2D_f32__UnknownUnit size_a,
TypedSize2D_f32__LayoutUnit size_b,
Size2D_f32 size_c,
LayoutSize2D size_d,
TypedPoint2D_f32__UnknownUnit point_a,
TypedPoint2D_f32__LayoutUnit point_b,
Point2D_f32 point_c,
LayoutPoint2D point_d,
TypedRect_f32__UnknownUnit rect_a,
TypedRect_f32__LayoutUnit rect_b,
Rect_f32 rect_c,
LayoutRect rect_d,
TypedTransform2D_f32__UnknownUnit__LayoutUnit transform_a,
TypedTransform2D_f32__LayoutUnit__UnknownUnit transform_b);
+257
View File
@@ -0,0 +1,257 @@
#include <cstdint>
#include <cstdlib>
extern "C" {
struct LayoutUnit;
struct UnknownUnit;
struct TypedLength_f32__UnknownUnit {
float _0;
};
struct TypedLength_f32__LayoutUnit {
float _0;
};
struct Length_f32 {
float _0;
};
typedef TypedLength_f32__LayoutUnit LayoutLength;
struct TypedSideOffsets2D_f32__UnknownUnit {
float top;
float right;
float bottom;
float left;
};
struct TypedSideOffsets2D_f32__LayoutUnit {
float top;
float right;
float bottom;
float left;
};
struct SideOffsets2D_f32 {
float top;
float right;
float bottom;
float left;
};
typedef TypedSideOffsets2D_f32__LayoutUnit LayoutSideOffsets2D;
struct TypedSize2D_f32__UnknownUnit {
float width;
float height;
};
struct TypedSize2D_f32__LayoutUnit {
float width;
float height;
};
struct Size2D_f32 {
float width;
float height;
};
typedef TypedSize2D_f32__LayoutUnit LayoutSize2D;
struct TypedPoint2D_f32__UnknownUnit {
float x;
float y;
};
struct TypedPoint2D_f32__LayoutUnit {
float x;
float y;
};
struct Point2D_f32 {
float x;
float y;
};
typedef TypedPoint2D_f32__LayoutUnit LayoutPoint2D;
struct TypedRect_f32__UnknownUnit {
TypedPoint2D_f32__UnknownUnit origin;
TypedSize2D_f32__UnknownUnit size;
};
struct TypedRect_f32__LayoutUnit {
TypedPoint2D_f32__LayoutUnit origin;
TypedSize2D_f32__LayoutUnit size;
};
struct Rect_f32 {
TypedPoint2D_f32__UnknownUnit origin;
TypedSize2D_f32__UnknownUnit size;
};
typedef TypedRect_f32__LayoutUnit LayoutRect;
struct TypedTransform2D_f32__UnknownUnit__LayoutUnit {
float m11;
float m12;
float m21;
float m22;
float m31;
float m32;
};
struct TypedTransform2D_f32__LayoutUnit__UnknownUnit {
float m11;
float m12;
float m21;
float m22;
float m31;
float m32;
};
void root(TypedLength_f32__UnknownUnit length_a,
TypedLength_f32__LayoutUnit length_b,
Length_f32 length_c,
LayoutLength length_d,
TypedSideOffsets2D_f32__UnknownUnit side_offsets_a,
TypedSideOffsets2D_f32__LayoutUnit side_offsets_b,
SideOffsets2D_f32 side_offsets_c,
LayoutSideOffsets2D side_offsets_d,
TypedSize2D_f32__UnknownUnit size_a,
TypedSize2D_f32__LayoutUnit size_b,
Size2D_f32 size_c,
LayoutSize2D size_d,
TypedPoint2D_f32__UnknownUnit point_a,
TypedPoint2D_f32__LayoutUnit point_b,
Point2D_f32 point_c,
LayoutPoint2D point_d,
TypedRect_f32__UnknownUnit rect_a,
TypedRect_f32__LayoutUnit rect_b,
Rect_f32 rect_c,
LayoutRect rect_d,
TypedTransform2D_f32__UnknownUnit__LayoutUnit transform_a,
TypedTransform2D_f32__LayoutUnit__UnknownUnit transform_b);
} // extern "C"
template<typename T>
struct Length;
template<>
struct Length<float> : public Length_f32 {
};
template<typename T>
struct Point2D;
template<>
struct Point2D<float> : public Point2D_f32 {
};
template<typename T>
struct Rect;
template<>
struct Rect<float> : public Rect_f32 {
};
template<typename T>
struct SideOffsets2D;
template<>
struct SideOffsets2D<float> : public SideOffsets2D_f32 {
};
template<typename T>
struct Size2D;
template<>
struct Size2D<float> : public Size2D_f32 {
};
template<typename T, typename Unit>
struct TypedLength;
template<>
struct TypedLength<float, LayoutUnit> : public TypedLength_f32__LayoutUnit {
};
template<>
struct TypedLength<float, UnknownUnit> : public TypedLength_f32__UnknownUnit {
};
template<typename T, typename U>
struct TypedPoint2D;
template<>
struct TypedPoint2D<float, LayoutUnit> : public TypedPoint2D_f32__LayoutUnit {
};
template<>
struct TypedPoint2D<float, UnknownUnit> : public TypedPoint2D_f32__UnknownUnit {
};
template<typename T, typename U>
struct TypedRect;
template<>
struct TypedRect<float, LayoutUnit> : public TypedRect_f32__LayoutUnit {
};
template<>
struct TypedRect<float, UnknownUnit> : public TypedRect_f32__UnknownUnit {
};
template<typename T, typename U>
struct TypedSideOffsets2D;
template<>
struct TypedSideOffsets2D<float, LayoutUnit> : public TypedSideOffsets2D_f32__LayoutUnit {
};
template<>
struct TypedSideOffsets2D<float, UnknownUnit> : public TypedSideOffsets2D_f32__UnknownUnit {
};
template<typename T, typename U>
struct TypedSize2D;
template<>
struct TypedSize2D<float, LayoutUnit> : public TypedSize2D_f32__LayoutUnit {
};
template<>
struct TypedSize2D<float, UnknownUnit> : public TypedSize2D_f32__UnknownUnit {
};
template<typename T, typename Src, typename Dst>
struct TypedTransform2D;
template<>
struct TypedTransform2D<float, UnknownUnit, LayoutUnit> : public TypedTransform2D_f32__UnknownUnit__LayoutUnit {
};
template<>
struct TypedTransform2D<float, LayoutUnit, UnknownUnit> : public TypedTransform2D_f32__LayoutUnit__UnknownUnit {
};
+7
View File
@@ -0,0 +1,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
void first();
void second();
+10
View File
@@ -0,0 +1,10 @@
#include <cstdint>
#include <cstdlib>
extern "C" {
void first();
void second();
} // extern "C"
+12
View File
@@ -0,0 +1,12 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct {
int32_t x;
float y;
} Normal;
extern void bar(Normal a);
extern int32_t foo();
+15
View File
@@ -0,0 +1,15 @@
#include <cstdint>
#include <cstdlib>
extern "C" {
struct Normal {
int32_t x;
float y;
};
extern void bar(Normal a);
extern int32_t foo();
} // extern "C"
+43
View File
@@ -0,0 +1,43 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
struct Bar_Bar_f32;
typedef struct Bar_Bar_f32 Bar_Bar_f32;
struct Bar_Foo_f32;
typedef struct Bar_Foo_f32 Bar_Foo_f32;
struct Bar_f32;
typedef struct Bar_f32 Bar_f32;
typedef struct {
const int32_t *data;
} Foo_i32;
typedef struct {
const float *data;
} Foo_f32;
typedef struct {
const Bar_f32 *data;
} Foo_Bar_f32;
typedef struct {
const Foo_f32 *a;
const float *b;
} Tuple_Foo_f32_____f32;
typedef struct {
const float *a;
const float *b;
} Indirection_f32;
void root(Foo_i32 a,
Foo_f32 b,
Bar_f32 c,
Foo_Bar_f32 d,
Bar_Foo_f32 e,
Bar_Bar_f32 f,
Tuple_Foo_f32_____f32 g,
Indirection_f32 h);
+77
View File
@@ -0,0 +1,77 @@
#include <cstdint>
#include <cstdlib>
extern "C" {
struct Bar_Bar_f32;
struct Bar_Foo_f32;
struct Bar_f32;
struct Foo_i32 {
const int32_t *data;
};
struct Foo_f32 {
const float *data;
};
struct Foo_Bar_f32 {
const Bar_f32 *data;
};
struct Tuple_Foo_f32_____f32 {
const Foo_f32 *a;
const float *b;
};
struct Indirection_f32 {
const float *a;
const float *b;
};
void root(Foo_i32 a,
Foo_f32 b,
Bar_f32 c,
Foo_Bar_f32 d,
Bar_Foo_f32 e,
Bar_Bar_f32 f,
Tuple_Foo_f32_____f32 g,
Indirection_f32 h);
} // extern "C"
template<typename T>
struct Foo;
template<>
struct Foo<int32_t> : public Foo_i32 {
};
template<>
struct Foo<float> : public Foo_f32 {
};
template<>
struct Foo<Bar_f32> : public Foo_Bar_f32 {
};
template<typename T>
struct Indirection;
template<>
struct Indirection<float> : public Indirection_f32 {
};
template<typename T, typename E>
struct Tuple;
template<>
struct Tuple<Foo_f32, float> : public Tuple_Foo_f32_____f32 {
};
+23
View File
@@ -0,0 +1,23 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
struct A;
typedef struct A A;
struct B;
typedef struct B B;
typedef struct {
B *members;
size_t count;
} List_B;
typedef struct {
A *members;
size_t count;
} List_A;
void bar(List_B b);
void foo(List_A a);
+37
View File
@@ -0,0 +1,37 @@
#include <cstdint>
#include <cstdlib>
extern "C" {
struct A;
struct B;
struct List_B {
B *members;
size_t count;
};
struct List_A {
A *members;
size_t count;
};
void bar(List_B b);
void foo(List_A a);
} // extern "C"
template<typename T>
struct List;
template<>
struct List<B> : public List_B {
};
template<>
struct List<A> : public List_A {
};
+43
View File
@@ -0,0 +1,43 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
struct Bar_Bar_f32;
typedef struct Bar_Bar_f32 Bar_Bar_f32;
struct Bar_Foo_f32;
typedef struct Bar_Foo_f32 Bar_Foo_f32;
struct Bar_f32;
typedef struct Bar_f32 Bar_f32;
typedef union {
const int32_t *data;
} Foo_i32;
typedef union {
const float *data;
} Foo_f32;
typedef union {
const Bar_f32 *data;
} Foo_Bar_f32;
typedef union {
const Foo_f32 *a;
const float *b;
} Tuple_Foo_f32_____f32;
typedef union {
const float *a;
const float *b;
} Indirection_f32;
void root(Foo_i32 a,
Foo_f32 b,
Bar_f32 c,
Foo_Bar_f32 d,
Bar_Foo_f32 e,
Bar_Bar_f32 f,
Tuple_Foo_f32_____f32 g,
Indirection_f32 h);
+43
View File
@@ -0,0 +1,43 @@
#include <cstdint>
#include <cstdlib>
extern "C" {
struct Bar_Bar_f32;
struct Bar_Foo_f32;
struct Bar_f32;
union Foo_i32 {
const int32_t *data;
};
union Foo_f32 {
const float *data;
};
union Foo_Bar_f32 {
const Bar_f32 *data;
};
union Tuple_Foo_f32_____f32 {
const Foo_f32 *a;
const float *b;
};
union Indirection_f32 {
const float *a;
const float *b;
};
void root(Foo_i32 a,
Foo_f32 b,
Bar_f32 c,
Foo_Bar_f32 d,
Bar_Foo_f32 e,
Bar_Bar_f32 f,
Tuple_Foo_f32_____f32 g,
Indirection_f32 h);
} // extern "C"
+20
View File
@@ -0,0 +1,20 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
struct Opaque;
typedef struct Opaque Opaque;
typedef struct {
const Opaque *x;
Opaque *y;
void (*z)();
} Foo;
typedef union {
const Opaque *x;
Opaque *y;
void (*z)();
} Bar;
void root(const Opaque *a, Opaque *b, Foo c, Bar d);
@@ -0,0 +1,22 @@
#include <cstdint>
#include <cstdlib>
extern "C" {
struct Opaque;
struct Foo {
const Opaque *x;
Opaque *y;
void (*z)();
};
union Bar {
const Opaque *x;
Opaque *y;
void (*z)();
};
void root(const Opaque *a, Opaque *b, Foo c, Bar d);
} // extern "C"
+20
View File
@@ -0,0 +1,20 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
struct Bar;
typedef struct Bar Bar;
typedef struct {
} Foo;
extern const Bar BAR;
extern Foo FOO;
extern const int32_t NUMBER;
extern const char* STRING;
void root();
+22
View File
@@ -0,0 +1,22 @@
#include <cstdint>
#include <cstdlib>
extern "C" {
struct Bar;
struct Foo {
};
extern const Bar BAR;
extern Foo FOO;
extern const int32_t NUMBER;
extern const char* STRING;
void root();
} // extern "C"
+14
View File
@@ -0,0 +1,14 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
struct Option_i32;
typedef struct Option_i32 Option_i32;
struct Result_i32__String;
typedef struct Result_i32__String Result_i32__String;
struct Vec_String;
typedef struct Vec_String Vec_String;
void root(const Vec_String *a, const Option_i32 *b, const Result_i32__String *c);
+14
View File
@@ -0,0 +1,14 @@
#include <cstdint>
#include <cstdlib>
extern "C" {
struct Option_i32;
struct Result_i32__String;
struct Vec_String;
void root(const Vec_String *a, const Option_i32 *b, const Result_i32__String *c);
} // extern "C"
+28
View File
@@ -0,0 +1,28 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
struct Opaque;
typedef struct Opaque Opaque;
typedef struct {
int32_t x;
float y;
} Normal;
typedef struct {
int32_t x;
float y;
} NormalWithZST;
typedef struct {
int32_t m0;
float m1;
} TupleRenamed;
typedef struct {
int32_t x;
float y;
} TupleNamed;
void root(Opaque *a, Normal b, NormalWithZST c, TupleRenamed d, TupleNamed e);
+30
View File
@@ -0,0 +1,30 @@
#include <cstdint>
#include <cstdlib>
extern "C" {
struct Opaque;
struct Normal {
int32_t x;
float y;
};
struct NormalWithZST {
int32_t x;
float y;
};
struct TupleRenamed {
int32_t m0;
float m1;
};
struct TupleNamed {
int32_t x;
float y;
};
void root(Opaque *a, Normal b, NormalWithZST c, TupleRenamed d, TupleNamed e);
} // extern "C"
+10
View File
@@ -0,0 +1,10 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct {
int32_t x;
int32_t y;
} IntFoo_i32;
void root(IntFoo_i32 a);
+21
View File
@@ -0,0 +1,21 @@
#include <cstdint>
#include <cstdlib>
extern "C" {
struct IntFoo_i32 {
int32_t x;
int32_t y;
};
void root(IntFoo_i32 a);
} // extern "C"
template<typename T>
struct IntFoo;
template<>
struct IntFoo<int32_t> : public IntFoo_i32 {
};
+18
View File
@@ -0,0 +1,18 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
struct Opaque;
typedef struct Opaque Opaque;
typedef union {
int32_t x;
float y;
} Normal;
typedef union {
int32_t x;
float y;
} NormalWithZST;
void root(Opaque *a, Normal b, NormalWithZST c);
+20
View File
@@ -0,0 +1,20 @@
#include <cstdint>
#include <cstdlib>
extern "C" {
struct Opaque;
union Normal {
int32_t x;
float y;
};
union NormalWithZST {
int32_t x;
float y;
};
void root(Opaque *a, Normal b, NormalWithZST c);
} // extern "C"