Add separate test expectations for C headers with C++ compatibility
This commit is contained in:
parent
bbeff3e3aa
commit
82da3c0afa
57
tests/expectations/alias.compat.c
Normal file
57
tests/expectations/alias.compat.c
Normal file
@ -0,0 +1,57 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
enum Status
|
||||
#ifdef __cplusplus
|
||||
: uint32_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Ok,
|
||||
Err,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint32_t Status;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
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;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(IntFoo x, DoubleFoo y, Unit z, SpecialStatus w);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
105
tests/expectations/annotation.compat.c
Normal file
105
tests/expectations/annotation.compat.c
Normal file
@ -0,0 +1,105 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
enum C
|
||||
#ifdef __cplusplus
|
||||
: uint32_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
X = 2,
|
||||
Y,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint32_t C;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct {
|
||||
int32_t m0;
|
||||
} A;
|
||||
|
||||
typedef struct {
|
||||
int32_t x;
|
||||
float y;
|
||||
} B;
|
||||
|
||||
enum F_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Foo,
|
||||
Bar,
|
||||
Baz,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t F_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct {
|
||||
F_Tag tag;
|
||||
int16_t _0;
|
||||
} Foo_Body;
|
||||
|
||||
typedef struct {
|
||||
F_Tag tag;
|
||||
uint8_t x;
|
||||
int16_t y;
|
||||
} Bar_Body;
|
||||
|
||||
typedef union {
|
||||
F_Tag tag;
|
||||
Foo_Body foo;
|
||||
Bar_Body bar;
|
||||
} F;
|
||||
|
||||
enum H_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Hello,
|
||||
There,
|
||||
Everyone,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t H_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct {
|
||||
int16_t _0;
|
||||
} Hello_Body;
|
||||
|
||||
typedef struct {
|
||||
uint8_t x;
|
||||
int16_t y;
|
||||
} There_Body;
|
||||
|
||||
typedef struct {
|
||||
H_Tag tag;
|
||||
union {
|
||||
Hello_Body hello;
|
||||
There_Body there;
|
||||
};
|
||||
} H;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(A x, B y, C z, F f, H h);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
37
tests/expectations/array.compat.c
Normal file
37
tests/expectations/array.compat.c
Normal file
@ -0,0 +1,37 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef enum {
|
||||
A,
|
||||
} Foo_Tag;
|
||||
#ifndef __cplusplus
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct {
|
||||
float _0[20];
|
||||
} A_Body;
|
||||
|
||||
typedef struct {
|
||||
Foo_Tag tag;
|
||||
union {
|
||||
A_Body a;
|
||||
};
|
||||
} Foo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Foo a);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
119
tests/expectations/asserted-cast.compat.c
Normal file
119
tests/expectations/asserted-cast.compat.c
Normal file
@ -0,0 +1,119 @@
|
||||
#define MY_ASSERT(...) do { } while (0)
|
||||
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct I I;
|
||||
|
||||
enum H_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
H_Foo,
|
||||
H_Bar,
|
||||
H_Baz,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t H_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct {
|
||||
int16_t _0;
|
||||
} H_Foo_Body;
|
||||
|
||||
typedef struct {
|
||||
uint8_t x;
|
||||
int16_t y;
|
||||
} H_Bar_Body;
|
||||
|
||||
typedef struct {
|
||||
H_Tag tag;
|
||||
union {
|
||||
H_Foo_Body foo;
|
||||
H_Bar_Body bar;
|
||||
};
|
||||
} H;
|
||||
|
||||
enum J_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
J_Foo,
|
||||
J_Bar,
|
||||
J_Baz,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t J_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct {
|
||||
int16_t _0;
|
||||
} J_Foo_Body;
|
||||
|
||||
typedef struct {
|
||||
uint8_t x;
|
||||
int16_t y;
|
||||
} J_Bar_Body;
|
||||
|
||||
typedef struct {
|
||||
J_Tag tag;
|
||||
union {
|
||||
J_Foo_Body foo;
|
||||
J_Bar_Body bar;
|
||||
};
|
||||
} J;
|
||||
|
||||
enum K_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
K_Foo,
|
||||
K_Bar,
|
||||
K_Baz,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t K_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct {
|
||||
K_Tag tag;
|
||||
int16_t _0;
|
||||
} K_Foo_Body;
|
||||
|
||||
typedef struct {
|
||||
K_Tag tag;
|
||||
uint8_t x;
|
||||
int16_t y;
|
||||
} K_Bar_Body;
|
||||
|
||||
typedef union {
|
||||
K_Tag tag;
|
||||
K_Foo_Body foo;
|
||||
K_Bar_Body bar;
|
||||
} K;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void foo(H h, I i, J j, K k);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
6
tests/expectations/assoc_const_conflict.compat.c
Normal file
6
tests/expectations/assoc_const_conflict.compat.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define Foo_FOO 42
|
24
tests/expectations/assoc_constant.compat.c
Normal file
24
tests/expectations/assoc_constant.compat.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct {
|
||||
|
||||
} Foo;
|
||||
#define Foo_GA 10
|
||||
#define Foo_ZO 3.14
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Foo x);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
31
tests/expectations/associated_in_body.compat.c
Normal file
31
tests/expectations/associated_in_body.compat.c
Normal file
@ -0,0 +1,31 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/**
|
||||
* Constants shared by multiple CSS Box Alignment properties
|
||||
* These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t bits;
|
||||
} StyleAlignFlags;
|
||||
#define StyleAlignFlags_AUTO (StyleAlignFlags){ .bits = 0 }
|
||||
#define StyleAlignFlags_NORMAL (StyleAlignFlags){ .bits = 1 }
|
||||
#define StyleAlignFlags_START (StyleAlignFlags){ .bits = 1 << 1 }
|
||||
#define StyleAlignFlags_END (StyleAlignFlags){ .bits = 1 << 2 }
|
||||
#define StyleAlignFlags_FLEX_START (StyleAlignFlags){ .bits = 1 << 3 }
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(StyleAlignFlags flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
31
tests/expectations/bitflags.compat.c
Normal file
31
tests/expectations/bitflags.compat.c
Normal file
@ -0,0 +1,31 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/**
|
||||
* Constants shared by multiple CSS Box Alignment properties
|
||||
* These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t bits;
|
||||
} AlignFlags;
|
||||
#define AlignFlags_AUTO (AlignFlags){ .bits = 0 }
|
||||
#define AlignFlags_NORMAL (AlignFlags){ .bits = 1 }
|
||||
#define AlignFlags_START (AlignFlags){ .bits = 1 << 1 }
|
||||
#define AlignFlags_END (AlignFlags){ .bits = 1 << 2 }
|
||||
#define AlignFlags_FLEX_START (AlignFlags){ .bits = 1 << 3 }
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(AlignFlags flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
70
tests/expectations/body.compat.c
Normal file
70
tests/expectations/body.compat.c
Normal file
@ -0,0 +1,70 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef enum {
|
||||
Foo1,
|
||||
Bar1,
|
||||
Baz1,
|
||||
} MyCLikeEnum;
|
||||
#ifndef __cplusplus
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct {
|
||||
int32_t i;
|
||||
#ifdef __cplusplus
|
||||
inline void foo();
|
||||
#endif
|
||||
} MyFancyStruct;
|
||||
|
||||
typedef enum {
|
||||
Foo,
|
||||
Bar,
|
||||
Baz,
|
||||
} MyFancyEnum_Tag;
|
||||
#ifndef __cplusplus
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct {
|
||||
int32_t _0;
|
||||
} Bar_Body;
|
||||
|
||||
typedef struct {
|
||||
int32_t _0;
|
||||
} Baz_Body;
|
||||
|
||||
typedef struct {
|
||||
MyFancyEnum_Tag tag;
|
||||
union {
|
||||
Bar_Body bar;
|
||||
Baz_Body baz;
|
||||
};
|
||||
#ifdef __cplusplus
|
||||
inline void wohoo();
|
||||
#endif
|
||||
} MyFancyEnum;
|
||||
|
||||
typedef union {
|
||||
float f;
|
||||
uint32_t u;
|
||||
int32_t extra_member; // yolo
|
||||
} MyUnion;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(MyFancyStruct s, MyFancyEnum e, MyCLikeEnum c, MyUnion u);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
57
tests/expectations/both/alias.compat.c
Normal file
57
tests/expectations/both/alias.compat.c
Normal file
@ -0,0 +1,57 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
enum Status
|
||||
#ifdef __cplusplus
|
||||
: uint32_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Ok,
|
||||
Err,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint32_t Status;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct Dep {
|
||||
int32_t a;
|
||||
float b;
|
||||
} Dep;
|
||||
|
||||
typedef struct Foo_i32 {
|
||||
int32_t a;
|
||||
int32_t b;
|
||||
Dep c;
|
||||
} Foo_i32;
|
||||
|
||||
typedef Foo_i32 IntFoo;
|
||||
|
||||
typedef struct Foo_f64 {
|
||||
double a;
|
||||
double b;
|
||||
Dep c;
|
||||
} Foo_f64;
|
||||
|
||||
typedef Foo_f64 DoubleFoo;
|
||||
|
||||
typedef int32_t Unit;
|
||||
|
||||
typedef Status SpecialStatus;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(IntFoo x, DoubleFoo y, Unit z, SpecialStatus w);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
105
tests/expectations/both/annotation.compat.c
Normal file
105
tests/expectations/both/annotation.compat.c
Normal file
@ -0,0 +1,105 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
enum C
|
||||
#ifdef __cplusplus
|
||||
: uint32_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
X = 2,
|
||||
Y,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint32_t C;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct A {
|
||||
int32_t m0;
|
||||
} A;
|
||||
|
||||
typedef struct B {
|
||||
int32_t x;
|
||||
float y;
|
||||
} B;
|
||||
|
||||
enum F_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Foo,
|
||||
Bar,
|
||||
Baz,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t F_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct Foo_Body {
|
||||
F_Tag tag;
|
||||
int16_t _0;
|
||||
} Foo_Body;
|
||||
|
||||
typedef struct Bar_Body {
|
||||
F_Tag tag;
|
||||
uint8_t x;
|
||||
int16_t y;
|
||||
} Bar_Body;
|
||||
|
||||
typedef union F {
|
||||
F_Tag tag;
|
||||
Foo_Body foo;
|
||||
Bar_Body bar;
|
||||
} F;
|
||||
|
||||
enum H_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Hello,
|
||||
There,
|
||||
Everyone,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t H_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct Hello_Body {
|
||||
int16_t _0;
|
||||
} Hello_Body;
|
||||
|
||||
typedef struct There_Body {
|
||||
uint8_t x;
|
||||
int16_t y;
|
||||
} There_Body;
|
||||
|
||||
typedef struct H {
|
||||
H_Tag tag;
|
||||
union {
|
||||
Hello_Body hello;
|
||||
There_Body there;
|
||||
};
|
||||
} H;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(A x, B y, C z, F f, H h);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
37
tests/expectations/both/array.compat.c
Normal file
37
tests/expectations/both/array.compat.c
Normal file
@ -0,0 +1,37 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef enum Foo_Tag {
|
||||
A,
|
||||
} Foo_Tag;
|
||||
#ifndef __cplusplus
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct A_Body {
|
||||
float _0[20];
|
||||
} A_Body;
|
||||
|
||||
typedef struct Foo {
|
||||
Foo_Tag tag;
|
||||
union {
|
||||
A_Body a;
|
||||
};
|
||||
} Foo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Foo a);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
119
tests/expectations/both/asserted-cast.compat.c
Normal file
119
tests/expectations/both/asserted-cast.compat.c
Normal file
@ -0,0 +1,119 @@
|
||||
#define MY_ASSERT(...) do { } while (0)
|
||||
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct I I;
|
||||
|
||||
enum H_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
H_Foo,
|
||||
H_Bar,
|
||||
H_Baz,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t H_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct H_Foo_Body {
|
||||
int16_t _0;
|
||||
} H_Foo_Body;
|
||||
|
||||
typedef struct H_Bar_Body {
|
||||
uint8_t x;
|
||||
int16_t y;
|
||||
} H_Bar_Body;
|
||||
|
||||
typedef struct H {
|
||||
H_Tag tag;
|
||||
union {
|
||||
H_Foo_Body foo;
|
||||
H_Bar_Body bar;
|
||||
};
|
||||
} H;
|
||||
|
||||
enum J_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
J_Foo,
|
||||
J_Bar,
|
||||
J_Baz,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t J_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct J_Foo_Body {
|
||||
int16_t _0;
|
||||
} J_Foo_Body;
|
||||
|
||||
typedef struct J_Bar_Body {
|
||||
uint8_t x;
|
||||
int16_t y;
|
||||
} J_Bar_Body;
|
||||
|
||||
typedef struct J {
|
||||
J_Tag tag;
|
||||
union {
|
||||
J_Foo_Body foo;
|
||||
J_Bar_Body bar;
|
||||
};
|
||||
} J;
|
||||
|
||||
enum K_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
K_Foo,
|
||||
K_Bar,
|
||||
K_Baz,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t K_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct K_Foo_Body {
|
||||
K_Tag tag;
|
||||
int16_t _0;
|
||||
} K_Foo_Body;
|
||||
|
||||
typedef struct K_Bar_Body {
|
||||
K_Tag tag;
|
||||
uint8_t x;
|
||||
int16_t y;
|
||||
} K_Bar_Body;
|
||||
|
||||
typedef union K {
|
||||
K_Tag tag;
|
||||
K_Foo_Body foo;
|
||||
K_Bar_Body bar;
|
||||
} K;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void foo(H h, I i, J j, K k);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
6
tests/expectations/both/assoc_const_conflict.compat.c
Normal file
6
tests/expectations/both/assoc_const_conflict.compat.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define Foo_FOO 42
|
24
tests/expectations/both/assoc_constant.compat.c
Normal file
24
tests/expectations/both/assoc_constant.compat.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Foo {
|
||||
|
||||
} Foo;
|
||||
#define Foo_GA 10
|
||||
#define Foo_ZO 3.14
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Foo x);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
31
tests/expectations/both/associated_in_body.compat.c
Normal file
31
tests/expectations/both/associated_in_body.compat.c
Normal file
@ -0,0 +1,31 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/**
|
||||
* Constants shared by multiple CSS Box Alignment properties
|
||||
* These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
|
||||
*/
|
||||
typedef struct StyleAlignFlags {
|
||||
uint8_t bits;
|
||||
} StyleAlignFlags;
|
||||
#define StyleAlignFlags_AUTO (StyleAlignFlags){ .bits = 0 }
|
||||
#define StyleAlignFlags_NORMAL (StyleAlignFlags){ .bits = 1 }
|
||||
#define StyleAlignFlags_START (StyleAlignFlags){ .bits = 1 << 1 }
|
||||
#define StyleAlignFlags_END (StyleAlignFlags){ .bits = 1 << 2 }
|
||||
#define StyleAlignFlags_FLEX_START (StyleAlignFlags){ .bits = 1 << 3 }
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(StyleAlignFlags flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
31
tests/expectations/both/bitflags.compat.c
Normal file
31
tests/expectations/both/bitflags.compat.c
Normal file
@ -0,0 +1,31 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/**
|
||||
* Constants shared by multiple CSS Box Alignment properties
|
||||
* These constants match Gecko's `NS_STYLE_ALIGN_*` constants.
|
||||
*/
|
||||
typedef struct AlignFlags {
|
||||
uint8_t bits;
|
||||
} AlignFlags;
|
||||
#define AlignFlags_AUTO (AlignFlags){ .bits = 0 }
|
||||
#define AlignFlags_NORMAL (AlignFlags){ .bits = 1 }
|
||||
#define AlignFlags_START (AlignFlags){ .bits = 1 << 1 }
|
||||
#define AlignFlags_END (AlignFlags){ .bits = 1 << 2 }
|
||||
#define AlignFlags_FLEX_START (AlignFlags){ .bits = 1 << 3 }
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(AlignFlags flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
70
tests/expectations/both/body.compat.c
Normal file
70
tests/expectations/both/body.compat.c
Normal file
@ -0,0 +1,70 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef enum MyCLikeEnum {
|
||||
Foo1,
|
||||
Bar1,
|
||||
Baz1,
|
||||
} MyCLikeEnum;
|
||||
#ifndef __cplusplus
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct MyFancyStruct {
|
||||
int32_t i;
|
||||
#ifdef __cplusplus
|
||||
inline void foo();
|
||||
#endif
|
||||
} MyFancyStruct;
|
||||
|
||||
typedef enum MyFancyEnum_Tag {
|
||||
Foo,
|
||||
Bar,
|
||||
Baz,
|
||||
} MyFancyEnum_Tag;
|
||||
#ifndef __cplusplus
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct Bar_Body {
|
||||
int32_t _0;
|
||||
} Bar_Body;
|
||||
|
||||
typedef struct Baz_Body {
|
||||
int32_t _0;
|
||||
} Baz_Body;
|
||||
|
||||
typedef struct MyFancyEnum {
|
||||
MyFancyEnum_Tag tag;
|
||||
union {
|
||||
Bar_Body bar;
|
||||
Baz_Body baz;
|
||||
};
|
||||
#ifdef __cplusplus
|
||||
inline void wohoo();
|
||||
#endif
|
||||
} MyFancyEnum;
|
||||
|
||||
typedef union MyUnion {
|
||||
float f;
|
||||
uint32_t u;
|
||||
int32_t extra_member; // yolo
|
||||
} MyUnion;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(MyFancyStruct s, MyFancyEnum e, MyCLikeEnum c, MyUnion u);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
50
tests/expectations/both/cdecl.compat.c
Normal file
50
tests/expectations/both/cdecl.compat.c
Normal file
@ -0,0 +1,50 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef void (*A)();
|
||||
|
||||
typedef void (*B)();
|
||||
|
||||
typedef bool (*C)(int32_t, int32_t);
|
||||
|
||||
typedef bool (*(*D)(int32_t))(float);
|
||||
|
||||
typedef const int32_t (*(*E)())[16];
|
||||
|
||||
typedef const int32_t *F;
|
||||
|
||||
typedef const int32_t *const *G;
|
||||
|
||||
typedef int32_t *const *H;
|
||||
|
||||
typedef const 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);
|
||||
|
||||
typedef void (*P)(int32_t named1st, bool, bool named3rd, int32_t _);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void (*O(void))(void);
|
||||
|
||||
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, P p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
48
tests/expectations/both/cfg-2.compat.c
Normal file
48
tests/expectations/both/cfg-2.compat.c
Normal file
@ -0,0 +1,48 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(NOT_DEFINED)
|
||||
#define DEFAULT_X 8
|
||||
#endif
|
||||
|
||||
#if defined(DEFINED)
|
||||
#define DEFAULT_X 42
|
||||
#endif
|
||||
|
||||
#if (defined(NOT_DEFINED) || defined(DEFINED))
|
||||
typedef struct Foo {
|
||||
int32_t x;
|
||||
} Foo;
|
||||
#endif
|
||||
|
||||
#if defined(NOT_DEFINED)
|
||||
typedef struct Bar {
|
||||
Foo y;
|
||||
} Bar;
|
||||
#endif
|
||||
|
||||
#if defined(DEFINED)
|
||||
typedef struct Bar {
|
||||
Foo z;
|
||||
} Bar;
|
||||
#endif
|
||||
|
||||
typedef struct Root {
|
||||
Bar w;
|
||||
} Root;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Root a);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
4
tests/expectations/both/cfg-field.compat.c
Normal file
4
tests/expectations/both/cfg-field.compat.c
Normal file
@ -0,0 +1,4 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
74
tests/expectations/both/cfg.compat.c
Normal file
74
tests/expectations/both/cfg.compat.c
Normal file
@ -0,0 +1,74 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if (defined(PLATFORM_WIN) || defined(M_32))
|
||||
enum BarType
|
||||
#ifdef __cplusplus
|
||||
: uint32_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
A,
|
||||
B,
|
||||
C,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint32_t BarType;
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
|
||||
#if (defined(PLATFORM_UNIX) && defined(X11))
|
||||
enum FooType
|
||||
#ifdef __cplusplus
|
||||
: uint32_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
A,
|
||||
B,
|
||||
C,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint32_t FooType;
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
|
||||
#if (defined(PLATFORM_UNIX) && defined(X11))
|
||||
typedef struct FooHandle {
|
||||
FooType ty;
|
||||
int32_t x;
|
||||
float y;
|
||||
} FooHandle;
|
||||
#endif
|
||||
|
||||
#if (defined(PLATFORM_WIN) || defined(M_32))
|
||||
typedef struct BarHandle {
|
||||
BarType ty;
|
||||
int32_t x;
|
||||
float y;
|
||||
} BarHandle;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#if (defined(PLATFORM_UNIX) && defined(X11))
|
||||
void root(FooHandle a);
|
||||
#endif
|
||||
|
||||
#if (defined(PLATFORM_WIN) || defined(M_32))
|
||||
void root(BarHandle a);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
6
tests/expectations/both/const_conflict.compat.c
Normal file
6
tests/expectations/both/const_conflict.compat.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define Foo_FOO 42
|
8
tests/expectations/both/const_transparent.compat.c
Normal file
8
tests/expectations/both/const_transparent.compat.c
Normal file
@ -0,0 +1,8 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef uint8_t Transparent;
|
||||
|
||||
#define FOO 0
|
42
tests/expectations/both/constant.compat.c
Normal file
42
tests/expectations/both/constant.compat.c
Normal file
@ -0,0 +1,42 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define DELIMITER ':'
|
||||
|
||||
#define FOO 10
|
||||
|
||||
#define HEART L'\u2764'
|
||||
|
||||
#define LEFTCURLY '{'
|
||||
|
||||
#define NEG_ONE -1
|
||||
|
||||
#define NEWLINE '\n'
|
||||
|
||||
#define POS_ONE 1
|
||||
|
||||
#define QUOTE '\''
|
||||
|
||||
#define TAB '\t'
|
||||
|
||||
#define ZOM 3.14
|
||||
|
||||
typedef struct Foo {
|
||||
int32_t x[FOO];
|
||||
} Foo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Foo x);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
63
tests/expectations/both/derive-eq.compat.c
Normal file
63
tests/expectations/both/derive-eq.compat.c
Normal file
@ -0,0 +1,63 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Foo {
|
||||
bool a;
|
||||
int32_t b;
|
||||
} Foo;
|
||||
|
||||
enum Bar_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Baz,
|
||||
Bazz,
|
||||
FooNamed,
|
||||
FooParen,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t Bar_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct Bazz_Body {
|
||||
Bar_Tag tag;
|
||||
Foo named;
|
||||
} Bazz_Body;
|
||||
|
||||
typedef struct FooNamed_Body {
|
||||
Bar_Tag tag;
|
||||
int32_t different;
|
||||
uint32_t fields;
|
||||
} FooNamed_Body;
|
||||
|
||||
typedef struct FooParen_Body {
|
||||
Bar_Tag tag;
|
||||
int32_t _0;
|
||||
Foo _1;
|
||||
} FooParen_Body;
|
||||
|
||||
typedef union Bar {
|
||||
Bar_Tag tag;
|
||||
Bazz_Body bazz;
|
||||
FooNamed_Body foo_named;
|
||||
FooParen_Body foo_paren;
|
||||
} Bar;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
Foo root(Bar aBar);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
213
tests/expectations/both/destructor-and-copy-ctor.compat.c
Normal file
213
tests/expectations/both/destructor-and-copy-ctor.compat.c
Normal file
@ -0,0 +1,213 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
enum FillRule
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
A,
|
||||
B,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t FillRule;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
/**
|
||||
* This will have a destructor manually implemented via variant_body, and
|
||||
* similarly a Drop impl in Rust.
|
||||
*/
|
||||
typedef struct OwnedSlice_u32 {
|
||||
uintptr_t len;
|
||||
uint32_t *ptr;
|
||||
} OwnedSlice_u32;
|
||||
|
||||
typedef struct Polygon_u32 {
|
||||
FillRule fill;
|
||||
OwnedSlice_u32 coordinates;
|
||||
} Polygon_u32;
|
||||
|
||||
/**
|
||||
* This will have a destructor manually implemented via variant_body, and
|
||||
* similarly a Drop impl in Rust.
|
||||
*/
|
||||
typedef struct OwnedSlice_i32 {
|
||||
uintptr_t len;
|
||||
int32_t *ptr;
|
||||
} OwnedSlice_i32;
|
||||
|
||||
enum Foo_u32_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Bar_u32,
|
||||
Polygon1_u32,
|
||||
Slice1_u32,
|
||||
Slice2_u32,
|
||||
Slice3_u32,
|
||||
Slice4_u32,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t Foo_u32_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct Polygon1_Body_u32 {
|
||||
Polygon_u32 _0;
|
||||
} Polygon1_Body_u32;
|
||||
|
||||
typedef struct Slice1_Body_u32 {
|
||||
OwnedSlice_u32 _0;
|
||||
} Slice1_Body_u32;
|
||||
|
||||
typedef struct Slice2_Body_u32 {
|
||||
OwnedSlice_i32 _0;
|
||||
} Slice2_Body_u32;
|
||||
|
||||
typedef struct Slice3_Body_u32 {
|
||||
FillRule fill;
|
||||
OwnedSlice_u32 coords;
|
||||
} Slice3_Body_u32;
|
||||
|
||||
typedef struct Slice4_Body_u32 {
|
||||
FillRule fill;
|
||||
OwnedSlice_i32 coords;
|
||||
} Slice4_Body_u32;
|
||||
|
||||
typedef struct Foo_u32 {
|
||||
Foo_u32_Tag tag;
|
||||
union {
|
||||
Polygon1_Body_u32 polygon1;
|
||||
Slice1_Body_u32 slice1;
|
||||
Slice2_Body_u32 slice2;
|
||||
Slice3_Body_u32 slice3;
|
||||
Slice4_Body_u32 slice4;
|
||||
};
|
||||
} Foo_u32;
|
||||
|
||||
typedef struct Polygon_i32 {
|
||||
FillRule fill;
|
||||
OwnedSlice_i32 coordinates;
|
||||
} Polygon_i32;
|
||||
|
||||
enum Baz_i32_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Bar2_i32,
|
||||
Polygon21_i32,
|
||||
Slice21_i32,
|
||||
Slice22_i32,
|
||||
Slice23_i32,
|
||||
Slice24_i32,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t Baz_i32_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct Polygon21_Body_i32 {
|
||||
Baz_i32_Tag tag;
|
||||
Polygon_i32 _0;
|
||||
} Polygon21_Body_i32;
|
||||
|
||||
typedef struct Slice21_Body_i32 {
|
||||
Baz_i32_Tag tag;
|
||||
OwnedSlice_i32 _0;
|
||||
} Slice21_Body_i32;
|
||||
|
||||
typedef struct Slice22_Body_i32 {
|
||||
Baz_i32_Tag tag;
|
||||
OwnedSlice_i32 _0;
|
||||
} Slice22_Body_i32;
|
||||
|
||||
typedef struct Slice23_Body_i32 {
|
||||
Baz_i32_Tag tag;
|
||||
FillRule fill;
|
||||
OwnedSlice_i32 coords;
|
||||
} Slice23_Body_i32;
|
||||
|
||||
typedef struct Slice24_Body_i32 {
|
||||
Baz_i32_Tag tag;
|
||||
FillRule fill;
|
||||
OwnedSlice_i32 coords;
|
||||
} Slice24_Body_i32;
|
||||
|
||||
typedef union Baz_i32 {
|
||||
Baz_i32_Tag tag;
|
||||
Polygon21_Body_i32 polygon21;
|
||||
Slice21_Body_i32 slice21;
|
||||
Slice22_Body_i32 slice22;
|
||||
Slice23_Body_i32 slice23;
|
||||
Slice24_Body_i32 slice24;
|
||||
} Baz_i32;
|
||||
|
||||
enum Taz_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Bar3,
|
||||
Taz1,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t Taz_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct Taz1_Body {
|
||||
Taz_Tag tag;
|
||||
int32_t _0;
|
||||
} Taz1_Body;
|
||||
|
||||
typedef union Taz {
|
||||
Taz_Tag tag;
|
||||
Taz1_Body taz1;
|
||||
} Taz;
|
||||
|
||||
enum Tazz_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Bar4,
|
||||
Taz2,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t Tazz_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct Taz2_Body {
|
||||
Tazz_Tag tag;
|
||||
int32_t _0;
|
||||
} Taz2_Body;
|
||||
|
||||
typedef union Tazz {
|
||||
Tazz_Tag tag;
|
||||
Taz2_Body taz2;
|
||||
} Tazz;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(const Foo_u32 *a, const Baz_i32 *b, const Taz *c, Tazz d);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
65
tests/expectations/both/display_list.compat.c
Normal file
65
tests/expectations/both/display_list.compat.c
Normal file
@ -0,0 +1,65 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Rect {
|
||||
float x;
|
||||
float y;
|
||||
float w;
|
||||
float h;
|
||||
} Rect;
|
||||
|
||||
typedef struct Color {
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
uint8_t a;
|
||||
} Color;
|
||||
|
||||
enum DisplayItem_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Fill,
|
||||
Image,
|
||||
ClearScreen,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t DisplayItem_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct Fill_Body {
|
||||
DisplayItem_Tag tag;
|
||||
Rect _0;
|
||||
Color _1;
|
||||
} Fill_Body;
|
||||
|
||||
typedef struct Image_Body {
|
||||
DisplayItem_Tag tag;
|
||||
uint32_t id;
|
||||
Rect bounds;
|
||||
} Image_Body;
|
||||
|
||||
typedef union DisplayItem {
|
||||
DisplayItem_Tag tag;
|
||||
Fill_Body fill;
|
||||
Image_Body image;
|
||||
} DisplayItem;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
bool push_item(DisplayItem item);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
21
tests/expectations/both/docstyle_auto.compat.c
Normal file
21
tests/expectations/both/docstyle_auto.compat.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
/**
|
||||
* The root of all evil.
|
||||
*/
|
||||
void root(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
19
tests/expectations/both/docstyle_c99.compat.c
Normal file
19
tests/expectations/both/docstyle_c99.compat.c
Normal file
@ -0,0 +1,19 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
// The root of all evil.
|
||||
void root(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
21
tests/expectations/both/docstyle_doxy.compat.c
Normal file
21
tests/expectations/both/docstyle_doxy.compat.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
/**
|
||||
* The root of all evil.
|
||||
*/
|
||||
void root(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
221
tests/expectations/both/enum.compat.c
Normal file
221
tests/expectations/both/enum.compat.c
Normal file
@ -0,0 +1,221 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
enum A
|
||||
#ifdef __cplusplus
|
||||
: uint32_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
a1 = 0,
|
||||
a2 = 2,
|
||||
a3,
|
||||
a4 = 5,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint32_t A;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
enum B
|
||||
#ifdef __cplusplus
|
||||
: uint16_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
b1 = 0,
|
||||
b2 = 2,
|
||||
b3,
|
||||
b4 = 5,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint16_t B;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
enum C
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
c1 = 0,
|
||||
c2 = 2,
|
||||
c3,
|
||||
c4 = 5,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t C;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
enum D
|
||||
#ifdef __cplusplus
|
||||
: uintptr_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
d1 = 0,
|
||||
d2 = 2,
|
||||
d3,
|
||||
d4 = 5,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uintptr_t D;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
enum E
|
||||
#ifdef __cplusplus
|
||||
: intptr_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
e1 = 0,
|
||||
e2 = 2,
|
||||
e3,
|
||||
e4 = 5,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef intptr_t E;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef enum K {
|
||||
k1,
|
||||
k2,
|
||||
k3,
|
||||
k4,
|
||||
} K;
|
||||
#ifndef __cplusplus
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
enum L
|
||||
#ifdef __cplusplus
|
||||
: int8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
l1 = -1,
|
||||
l2 = 0,
|
||||
l3 = 1,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef int8_t L;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct I I;
|
||||
|
||||
typedef struct J J;
|
||||
|
||||
typedef struct Opaque Opaque;
|
||||
|
||||
enum F_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Foo,
|
||||
Bar,
|
||||
Baz,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t F_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct Foo_Body {
|
||||
F_Tag tag;
|
||||
int16_t _0;
|
||||
} Foo_Body;
|
||||
|
||||
typedef struct Bar_Body {
|
||||
F_Tag tag;
|
||||
uint8_t x;
|
||||
int16_t y;
|
||||
} Bar_Body;
|
||||
|
||||
typedef union F {
|
||||
F_Tag tag;
|
||||
Foo_Body foo;
|
||||
Bar_Body bar;
|
||||
} F;
|
||||
|
||||
typedef enum G_Tag {
|
||||
G_Foo,
|
||||
G_Bar,
|
||||
G_Baz,
|
||||
} G_Tag;
|
||||
#ifndef __cplusplus
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct G_Foo_Body {
|
||||
int16_t _0;
|
||||
} G_Foo_Body;
|
||||
|
||||
typedef struct G_Bar_Body {
|
||||
uint8_t x;
|
||||
int16_t y;
|
||||
} G_Bar_Body;
|
||||
|
||||
typedef struct G {
|
||||
G_Tag tag;
|
||||
union {
|
||||
G_Foo_Body foo;
|
||||
G_Bar_Body bar;
|
||||
};
|
||||
} G;
|
||||
|
||||
enum H_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
H_Foo,
|
||||
H_Bar,
|
||||
H_Baz,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t H_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct H_Foo_Body {
|
||||
int16_t _0;
|
||||
} H_Foo_Body;
|
||||
|
||||
typedef struct H_Bar_Body {
|
||||
uint8_t x;
|
||||
int16_t y;
|
||||
} H_Bar_Body;
|
||||
|
||||
typedef struct H {
|
||||
H_Tag tag;
|
||||
union {
|
||||
H_Foo_Body foo;
|
||||
H_Bar_Body bar;
|
||||
};
|
||||
} H;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Opaque *o, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
129
tests/expectations/both/euclid.compat.c
Normal file
129
tests/expectations/both/euclid.compat.c
Normal file
@ -0,0 +1,129 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct TypedLength_f32__UnknownUnit {
|
||||
float _0;
|
||||
} TypedLength_f32__UnknownUnit;
|
||||
|
||||
typedef struct TypedLength_f32__LayoutUnit {
|
||||
float _0;
|
||||
} TypedLength_f32__LayoutUnit;
|
||||
|
||||
typedef TypedLength_f32__UnknownUnit Length_f32;
|
||||
|
||||
typedef TypedLength_f32__LayoutUnit LayoutLength;
|
||||
|
||||
typedef struct TypedSideOffsets2D_f32__UnknownUnit {
|
||||
float top;
|
||||
float right;
|
||||
float bottom;
|
||||
float left;
|
||||
} TypedSideOffsets2D_f32__UnknownUnit;
|
||||
|
||||
typedef struct TypedSideOffsets2D_f32__LayoutUnit {
|
||||
float top;
|
||||
float right;
|
||||
float bottom;
|
||||
float left;
|
||||
} TypedSideOffsets2D_f32__LayoutUnit;
|
||||
|
||||
typedef TypedSideOffsets2D_f32__UnknownUnit SideOffsets2D_f32;
|
||||
|
||||
typedef TypedSideOffsets2D_f32__LayoutUnit LayoutSideOffsets2D;
|
||||
|
||||
typedef struct TypedSize2D_f32__UnknownUnit {
|
||||
float width;
|
||||
float height;
|
||||
} TypedSize2D_f32__UnknownUnit;
|
||||
|
||||
typedef struct TypedSize2D_f32__LayoutUnit {
|
||||
float width;
|
||||
float height;
|
||||
} TypedSize2D_f32__LayoutUnit;
|
||||
|
||||
typedef TypedSize2D_f32__UnknownUnit Size2D_f32;
|
||||
|
||||
typedef TypedSize2D_f32__LayoutUnit LayoutSize2D;
|
||||
|
||||
typedef struct TypedPoint2D_f32__UnknownUnit {
|
||||
float x;
|
||||
float y;
|
||||
} TypedPoint2D_f32__UnknownUnit;
|
||||
|
||||
typedef struct TypedPoint2D_f32__LayoutUnit {
|
||||
float x;
|
||||
float y;
|
||||
} TypedPoint2D_f32__LayoutUnit;
|
||||
|
||||
typedef TypedPoint2D_f32__UnknownUnit Point2D_f32;
|
||||
|
||||
typedef TypedPoint2D_f32__LayoutUnit LayoutPoint2D;
|
||||
|
||||
typedef struct TypedRect_f32__UnknownUnit {
|
||||
TypedPoint2D_f32__UnknownUnit origin;
|
||||
TypedSize2D_f32__UnknownUnit size;
|
||||
} TypedRect_f32__UnknownUnit;
|
||||
|
||||
typedef struct TypedRect_f32__LayoutUnit {
|
||||
TypedPoint2D_f32__LayoutUnit origin;
|
||||
TypedSize2D_f32__LayoutUnit size;
|
||||
} TypedRect_f32__LayoutUnit;
|
||||
|
||||
typedef TypedRect_f32__UnknownUnit Rect_f32;
|
||||
|
||||
typedef TypedRect_f32__LayoutUnit LayoutRect;
|
||||
|
||||
typedef struct TypedTransform2D_f32__UnknownUnit__LayoutUnit {
|
||||
float m11;
|
||||
float m12;
|
||||
float m21;
|
||||
float m22;
|
||||
float m31;
|
||||
float m32;
|
||||
} TypedTransform2D_f32__UnknownUnit__LayoutUnit;
|
||||
|
||||
typedef struct TypedTransform2D_f32__LayoutUnit__UnknownUnit {
|
||||
float m11;
|
||||
float m12;
|
||||
float m21;
|
||||
float m22;
|
||||
float m31;
|
||||
float m32;
|
||||
} TypedTransform2D_f32__LayoutUnit__UnknownUnit;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
22
tests/expectations/both/expand.compat.c
Normal file
22
tests/expectations/both/expand.compat.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Foo {
|
||||
|
||||
} Foo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Foo a);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
24
tests/expectations/both/expand_default_features.compat.c
Normal file
24
tests/expectations/both/expand_default_features.compat.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Foo {
|
||||
|
||||
} Foo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void extra_debug_fn(void);
|
||||
|
||||
void root(Foo a);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
26
tests/expectations/both/expand_features.compat.c
Normal file
26
tests/expectations/both/expand_features.compat.c
Normal file
@ -0,0 +1,26 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Foo {
|
||||
|
||||
} Foo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void cbindgen(void);
|
||||
|
||||
void extra_debug_fn(void);
|
||||
|
||||
void root(Foo a);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
22
tests/expectations/both/expand_no_default_features.compat.c
Normal file
22
tests/expectations/both/expand_no_default_features.compat.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Foo {
|
||||
|
||||
} Foo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Foo a);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
20
tests/expectations/both/extern-2.compat.c
Normal file
20
tests/expectations/both/extern-2.compat.c
Normal file
@ -0,0 +1,20 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void first(void);
|
||||
|
||||
void second(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
25
tests/expectations/both/extern.compat.c
Normal file
25
tests/expectations/both/extern.compat.c
Normal file
@ -0,0 +1,25 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Normal {
|
||||
int32_t x;
|
||||
float y;
|
||||
} Normal;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
extern void bar(Normal a);
|
||||
|
||||
extern int32_t foo(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
22
tests/expectations/both/external_workspace_child.compat.c
Normal file
22
tests/expectations/both/external_workspace_child.compat.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct ExtType {
|
||||
uint32_t data;
|
||||
} ExtType;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void consume_ext(ExtType _ext);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
26
tests/expectations/both/fns.compat.c
Normal file
26
tests/expectations/both/fns.compat.c
Normal file
@ -0,0 +1,26 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Fns {
|
||||
void (*noArgs)();
|
||||
void (*anonymousArg)(int32_t);
|
||||
int32_t (*returnsNumber)();
|
||||
int8_t (*namedArgs)(int32_t first, int16_t snd);
|
||||
int8_t (*namedArgsWildcards)(int32_t _, int16_t named, int64_t _1);
|
||||
} Fns;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Fns _fns);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
4
tests/expectations/both/global_attr.compat.c
Normal file
4
tests/expectations/both/global_attr.compat.c
Normal file
@ -0,0 +1,4 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
5
tests/expectations/both/include.compat.c
Normal file
5
tests/expectations/both/include.compat.c
Normal file
@ -0,0 +1,5 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
13
tests/expectations/both/include_item.compat.c
Normal file
13
tests/expectations/both/include_item.compat.c
Normal file
@ -0,0 +1,13 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct A {
|
||||
int32_t x;
|
||||
float y;
|
||||
} A;
|
||||
|
||||
typedef struct B {
|
||||
A data;
|
||||
} B;
|
1
tests/expectations/both/include_specific.compat.c
Normal file
1
tests/expectations/both/include_specific.compat.c
Normal file
@ -0,0 +1 @@
|
||||
#include <math.h>
|
22
tests/expectations/both/inner_mod.compat.c
Normal file
22
tests/expectations/both/inner_mod.compat.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Foo {
|
||||
float x;
|
||||
} Foo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Foo a);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
18
tests/expectations/both/item_types.compat.c
Normal file
18
tests/expectations/both/item_types.compat.c
Normal file
@ -0,0 +1,18 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
enum OnlyThisShouldBeGenerated
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Foo,
|
||||
Bar,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t OnlyThisShouldBeGenerated;
|
||||
#endif // __cplusplus
|
||||
|
18
tests/expectations/both/item_types_renamed.compat.c
Normal file
18
tests/expectations/both/item_types_renamed.compat.c
Normal file
@ -0,0 +1,18 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
enum StyleOnlyThisShouldBeGenerated
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Foo,
|
||||
Bar,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t StyleOnlyThisShouldBeGenerated;
|
||||
#endif // __cplusplus
|
||||
|
22
tests/expectations/both/lifetime_arg.compat.c
Normal file
22
tests/expectations/both/lifetime_arg.compat.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct A {
|
||||
const int32_t *data;
|
||||
} A;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(A _a);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
44
tests/expectations/both/mod_attr.compat.c
Normal file
44
tests/expectations/both/mod_attr.compat.c
Normal file
@ -0,0 +1,44 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(BAR)
|
||||
#define BAR 2
|
||||
#endif
|
||||
|
||||
#if defined(FOO)
|
||||
#define FOO 1
|
||||
#endif
|
||||
|
||||
#if defined(BAR)
|
||||
typedef struct Bar {
|
||||
|
||||
} Bar;
|
||||
#endif
|
||||
|
||||
#if defined(FOO)
|
||||
typedef struct Foo {
|
||||
|
||||
} Foo;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#if defined(BAR)
|
||||
void bar(const Bar *bar);
|
||||
#endif
|
||||
|
||||
#if defined(FOO)
|
||||
void foo(const Foo *foo);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
24
tests/expectations/both/mod_path.compat.c
Normal file
24
tests/expectations/both/mod_path.compat.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define EXPORT_ME_TOO 42
|
||||
|
||||
typedef struct ExportMe {
|
||||
uint64_t val;
|
||||
} ExportMe;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void export_me(ExportMe *val);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
55
tests/expectations/both/monomorph-1.compat.c
Normal file
55
tests/expectations/both/monomorph-1.compat.c
Normal file
@ -0,0 +1,55 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Bar_Bar_f32 Bar_Bar_f32;
|
||||
|
||||
typedef struct Bar_Foo_f32 Bar_Foo_f32;
|
||||
|
||||
typedef struct Bar_f32 Bar_f32;
|
||||
|
||||
typedef struct Foo_i32 {
|
||||
const int32_t *data;
|
||||
} Foo_i32;
|
||||
|
||||
typedef struct Foo_f32 {
|
||||
const float *data;
|
||||
} Foo_f32;
|
||||
|
||||
typedef struct Foo_Bar_f32 {
|
||||
const Bar_f32 *data;
|
||||
} Foo_Bar_f32;
|
||||
|
||||
typedef struct Tuple_Foo_f32_____f32 {
|
||||
const Foo_f32 *a;
|
||||
const float *b;
|
||||
} Tuple_Foo_f32_____f32;
|
||||
|
||||
typedef struct Tuple_f32__f32 {
|
||||
const float *a;
|
||||
const float *b;
|
||||
} Tuple_f32__f32;
|
||||
|
||||
typedef Tuple_f32__f32 Indirection_f32;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
34
tests/expectations/both/monomorph-2.compat.c
Normal file
34
tests/expectations/both/monomorph-2.compat.c
Normal file
@ -0,0 +1,34 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct A A;
|
||||
|
||||
typedef struct B B;
|
||||
|
||||
typedef struct List_B {
|
||||
B *members;
|
||||
uintptr_t count;
|
||||
} List_B;
|
||||
|
||||
typedef struct List_A {
|
||||
A *members;
|
||||
uintptr_t count;
|
||||
} List_A;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void bar(List_B b);
|
||||
|
||||
void foo(List_A a);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
55
tests/expectations/both/monomorph-3.compat.c
Normal file
55
tests/expectations/both/monomorph-3.compat.c
Normal file
@ -0,0 +1,55 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Bar_Bar_f32 Bar_Bar_f32;
|
||||
|
||||
typedef struct Bar_Foo_f32 Bar_Foo_f32;
|
||||
|
||||
typedef struct Bar_f32 Bar_f32;
|
||||
|
||||
typedef union Foo_i32 {
|
||||
const int32_t *data;
|
||||
} Foo_i32;
|
||||
|
||||
typedef union Foo_f32 {
|
||||
const float *data;
|
||||
} Foo_f32;
|
||||
|
||||
typedef union Foo_Bar_f32 {
|
||||
const Bar_f32 *data;
|
||||
} Foo_Bar_f32;
|
||||
|
||||
typedef union Tuple_Foo_f32_____f32 {
|
||||
const Foo_f32 *a;
|
||||
const float *b;
|
||||
} Tuple_Foo_f32_____f32;
|
||||
|
||||
typedef union Tuple_f32__f32 {
|
||||
const float *a;
|
||||
const float *b;
|
||||
} Tuple_f32__f32;
|
||||
|
||||
typedef Tuple_f32__f32 Indirection_f32;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
52
tests/expectations/both/must-use.compat.c
Normal file
52
tests/expectations/both/must-use.compat.c
Normal file
@ -0,0 +1,52 @@
|
||||
#define MUST_USE_FUNC __attribute__((warn_unused_result))
|
||||
#define MUST_USE_STRUCT __attribute__((warn_unused))
|
||||
#define MUST_USE_ENUM /* nothing */
|
||||
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
enum MaybeOwnedPtr_i32_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Owned_i32,
|
||||
None_i32,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t MaybeOwnedPtr_i32_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct Owned_Body_i32 {
|
||||
int32_t *_0;
|
||||
} Owned_Body_i32;
|
||||
|
||||
typedef struct MaybeOwnedPtr_i32 {
|
||||
MaybeOwnedPtr_i32_Tag tag;
|
||||
union {
|
||||
Owned_Body_i32 owned;
|
||||
};
|
||||
} MaybeOwnedPtr_i32;
|
||||
|
||||
typedef struct MUST_USE_STRUCT OwnedPtr_i32 {
|
||||
int32_t *ptr;
|
||||
} OwnedPtr_i32;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
MUST_USE_FUNC MaybeOwnedPtr_i32 maybe_consume(OwnedPtr_i32 input);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
26
tests/expectations/both/namespace_constant.compat.c
Normal file
26
tests/expectations/both/namespace_constant.compat.c
Normal file
@ -0,0 +1,26 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define FOO 10
|
||||
|
||||
#define ZOM 3.14
|
||||
|
||||
typedef struct Foo {
|
||||
int32_t x[FOO];
|
||||
} Foo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Foo x);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
26
tests/expectations/both/namespaces_constant.compat.c
Normal file
26
tests/expectations/both/namespaces_constant.compat.c
Normal file
@ -0,0 +1,26 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define FOO 10
|
||||
|
||||
#define ZOM 3.14
|
||||
|
||||
typedef struct Foo {
|
||||
int32_t x[FOO];
|
||||
} Foo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Foo x);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
4
tests/expectations/both/nested_import.compat.c
Normal file
4
tests/expectations/both/nested_import.compat.c
Normal file
@ -0,0 +1,4 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
13
tests/expectations/both/no_includes.compat.c
Normal file
13
tests/expectations/both/no_includes.compat.c
Normal file
@ -0,0 +1,13 @@
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
32
tests/expectations/both/nonnull.compat.c
Normal file
32
tests/expectations/both/nonnull.compat.c
Normal file
@ -0,0 +1,32 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Opaque Opaque;
|
||||
|
||||
typedef struct Foo_u64 {
|
||||
float *a;
|
||||
uint64_t *b;
|
||||
Opaque *c;
|
||||
uint64_t **d;
|
||||
float **e;
|
||||
Opaque **f;
|
||||
uint64_t *g;
|
||||
int32_t *h;
|
||||
int32_t **i;
|
||||
} Foo_u64;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(int32_t *arg, Foo_u64 *foo, Opaque **d);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
49
tests/expectations/both/prefix.compat.c
Normal file
49
tests/expectations/both/prefix.compat.c
Normal file
@ -0,0 +1,49 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define PREFIX_LEN 42
|
||||
|
||||
typedef int32_t PREFIX_NamedLenArray[PREFIX_LEN];
|
||||
|
||||
typedef int32_t PREFIX_ValuedLenArray[42];
|
||||
|
||||
enum PREFIX_AbsoluteFontWeight_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Weight,
|
||||
Normal,
|
||||
Bold,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t PREFIX_AbsoluteFontWeight_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct PREFIX_Weight_Body {
|
||||
PREFIX_AbsoluteFontWeight_Tag tag;
|
||||
float _0;
|
||||
} PREFIX_Weight_Body;
|
||||
|
||||
typedef union PREFIX_AbsoluteFontWeight {
|
||||
PREFIX_AbsoluteFontWeight_Tag tag;
|
||||
PREFIX_Weight_Body weight;
|
||||
} PREFIX_AbsoluteFontWeight;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(PREFIX_NamedLenArray x, PREFIX_ValuedLenArray y, PREFIX_AbsoluteFontWeight z);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
26
tests/expectations/both/prefixed_struct_literal.compat.c
Normal file
26
tests/expectations/both/prefixed_struct_literal.compat.c
Normal file
@ -0,0 +1,26 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct PREFIXFoo {
|
||||
int32_t a;
|
||||
uint32_t b;
|
||||
} PREFIXFoo;
|
||||
#define PREFIXFoo_FOO (PREFIXFoo){ .a = 42, .b = 47 }
|
||||
|
||||
#define PREFIXBAR (PREFIXFoo){ .a = 42, .b = 1337 }
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(PREFIXFoo x);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
@ -0,0 +1,30 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.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 } }
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(PREFIXFoo x);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
48
tests/expectations/both/rename-crate.compat.c
Normal file
48
tests/expectations/both/rename-crate.compat.c
Normal file
@ -0,0 +1,48 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if !defined(DEFINE_FREEBSD)
|
||||
typedef struct NoExternTy {
|
||||
uint8_t field;
|
||||
} NoExternTy;
|
||||
#endif
|
||||
|
||||
#if !defined(DEFINE_FREEBSD)
|
||||
typedef struct ContainsNoExternTy {
|
||||
NoExternTy field;
|
||||
} ContainsNoExternTy;
|
||||
#endif
|
||||
|
||||
#if defined(DEFINE_FREEBSD)
|
||||
typedef struct ContainsNoExternTy {
|
||||
uint64_t field;
|
||||
} ContainsNoExternTy;
|
||||
#endif
|
||||
|
||||
typedef struct RenamedTy {
|
||||
uint64_t y;
|
||||
} RenamedTy;
|
||||
|
||||
typedef struct Foo {
|
||||
int32_t x;
|
||||
} Foo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void no_extern_func(ContainsNoExternTy a);
|
||||
|
||||
void renamed_func(RenamedTy a);
|
||||
|
||||
void root(Foo a);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
52
tests/expectations/both/rename.compat.c
Normal file
52
tests/expectations/both/rename.compat.c
Normal file
@ -0,0 +1,52 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define C_H 10
|
||||
|
||||
enum C_E
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
x = 0,
|
||||
y = 1,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t C_E;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct C_A C_A;
|
||||
|
||||
typedef struct C_C C_C;
|
||||
|
||||
typedef struct C_AwesomeB {
|
||||
int32_t x;
|
||||
float y;
|
||||
} C_AwesomeB;
|
||||
|
||||
typedef union C_D {
|
||||
int32_t x;
|
||||
float y;
|
||||
} C_D;
|
||||
|
||||
typedef C_A C_F;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
extern const int32_t G;
|
||||
|
||||
void root(const C_A *a, C_AwesomeB b, C_C c, C_D d, C_E e, C_F f);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
@ -0,0 +1,25 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct StyleA StyleA;
|
||||
|
||||
typedef struct B {
|
||||
int32_t x;
|
||||
float y;
|
||||
} B;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(const StyleA *a, B b);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
53
tests/expectations/both/reserved.compat.c
Normal file
53
tests/expectations/both/reserved.compat.c
Normal file
@ -0,0 +1,53 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct A {
|
||||
int32_t namespace_;
|
||||
float float_;
|
||||
} A;
|
||||
|
||||
typedef struct B {
|
||||
int32_t namespace_;
|
||||
float float_;
|
||||
} B;
|
||||
|
||||
enum C_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
D,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t C_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct D_Body {
|
||||
int32_t namespace_;
|
||||
float float_;
|
||||
} D_Body;
|
||||
|
||||
typedef struct C {
|
||||
C_Tag tag;
|
||||
union {
|
||||
D_Body d;
|
||||
};
|
||||
} C;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(A a, B b, C c, int32_t namespace_, float float_);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
32
tests/expectations/both/simplify-option-ptr.compat.c
Normal file
32
tests/expectations/both/simplify-option-ptr.compat.c
Normal file
@ -0,0 +1,32 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Opaque Opaque;
|
||||
|
||||
typedef struct Foo {
|
||||
const Opaque *x;
|
||||
Opaque *y;
|
||||
void (*z)();
|
||||
} Foo;
|
||||
|
||||
typedef union Bar {
|
||||
const Opaque *x;
|
||||
Opaque *y;
|
||||
void (*z)();
|
||||
} Bar;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(const Opaque *a, Opaque *b, Foo c, Bar d);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
30
tests/expectations/both/static.compat.c
Normal file
30
tests/expectations/both/static.compat.c
Normal file
@ -0,0 +1,30 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Bar Bar;
|
||||
|
||||
typedef struct Foo {
|
||||
|
||||
} Foo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
extern const Bar BAR;
|
||||
|
||||
extern Foo FOO;
|
||||
|
||||
extern const int32_t NUMBER;
|
||||
|
||||
void root(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
24
tests/expectations/both/std_lib.compat.c
Normal file
24
tests/expectations/both/std_lib.compat.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Option_i32 Option_i32;
|
||||
|
||||
typedef struct Result_i32__String Result_i32__String;
|
||||
|
||||
typedef struct Vec_String Vec_String;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(const Vec_String *a, const Option_i32 *b, const Result_i32__String *c);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
40
tests/expectations/both/struct.compat.c
Normal file
40
tests/expectations/both/struct.compat.c
Normal file
@ -0,0 +1,40 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Opaque Opaque;
|
||||
|
||||
typedef struct Normal {
|
||||
int32_t x;
|
||||
float y;
|
||||
} Normal;
|
||||
|
||||
typedef struct NormalWithZST {
|
||||
int32_t x;
|
||||
float y;
|
||||
} NormalWithZST;
|
||||
|
||||
typedef struct TupleRenamed {
|
||||
int32_t m0;
|
||||
float m1;
|
||||
} TupleRenamed;
|
||||
|
||||
typedef struct TupleNamed {
|
||||
int32_t x;
|
||||
float y;
|
||||
} TupleNamed;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Opaque *a, Normal b, NormalWithZST c, TupleRenamed d, TupleNamed e);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
33
tests/expectations/both/struct_literal.compat.c
Normal file
33
tests/expectations/both/struct_literal.compat.c
Normal file
@ -0,0 +1,33 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Bar Bar;
|
||||
|
||||
typedef struct Foo {
|
||||
int32_t a;
|
||||
uint32_t b;
|
||||
} Foo;
|
||||
#define Foo_FOO (Foo){ .a = 42, .b = 47 }
|
||||
#define Foo_FOO2 (Foo){ .a = 42, .b = 47 }
|
||||
#define Foo_FOO3 (Foo){ .a = 42, .b = 47 }
|
||||
|
||||
|
||||
#define BAR (Foo){ .a = 42, .b = 1337 }
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Foo x, Bar bar);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
4
tests/expectations/both/style-crash.compat.c
Normal file
4
tests/expectations/both/style-crash.compat.c
Normal file
@ -0,0 +1,4 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
208
tests/expectations/both/transform-op.compat.c
Normal file
208
tests/expectations/both/transform-op.compat.c
Normal file
@ -0,0 +1,208 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct StylePoint_i32 {
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
} StylePoint_i32;
|
||||
|
||||
typedef struct StylePoint_f32 {
|
||||
float x;
|
||||
float y;
|
||||
} StylePoint_f32;
|
||||
|
||||
enum StyleFoo_i32_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Foo_i32,
|
||||
Bar_i32,
|
||||
Baz_i32,
|
||||
Bazz_i32,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t StyleFoo_i32_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct StyleFoo_Body_i32 {
|
||||
StyleFoo_i32_Tag tag;
|
||||
int32_t x;
|
||||
StylePoint_i32 y;
|
||||
StylePoint_f32 z;
|
||||
} StyleFoo_Body_i32;
|
||||
|
||||
typedef struct StyleBar_Body_i32 {
|
||||
StyleFoo_i32_Tag tag;
|
||||
int32_t _0;
|
||||
} StyleBar_Body_i32;
|
||||
|
||||
typedef struct StyleBaz_Body_i32 {
|
||||
StyleFoo_i32_Tag tag;
|
||||
StylePoint_i32 _0;
|
||||
} StyleBaz_Body_i32;
|
||||
|
||||
typedef union StyleFoo_i32 {
|
||||
StyleFoo_i32_Tag tag;
|
||||
StyleFoo_Body_i32 foo;
|
||||
StyleBar_Body_i32 bar;
|
||||
StyleBaz_Body_i32 baz;
|
||||
} StyleFoo_i32;
|
||||
|
||||
typedef enum StyleBar_i32_Tag {
|
||||
Bar1_i32,
|
||||
Bar2_i32,
|
||||
Bar3_i32,
|
||||
Bar4_i32,
|
||||
} StyleBar_i32_Tag;
|
||||
#ifndef __cplusplus
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct StyleBar1_Body_i32 {
|
||||
int32_t x;
|
||||
StylePoint_i32 y;
|
||||
StylePoint_f32 z;
|
||||
int32_t (*u)(int32_t);
|
||||
} StyleBar1_Body_i32;
|
||||
|
||||
typedef struct StyleBar2_Body_i32 {
|
||||
int32_t _0;
|
||||
} StyleBar2_Body_i32;
|
||||
|
||||
typedef struct StyleBar3_Body_i32 {
|
||||
StylePoint_i32 _0;
|
||||
} StyleBar3_Body_i32;
|
||||
|
||||
typedef struct StyleBar_i32 {
|
||||
StyleBar_i32_Tag tag;
|
||||
union {
|
||||
StyleBar1_Body_i32 bar1;
|
||||
StyleBar2_Body_i32 bar2;
|
||||
StyleBar3_Body_i32 bar3;
|
||||
};
|
||||
} StyleBar_i32;
|
||||
|
||||
typedef struct StylePoint_u32 {
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
} StylePoint_u32;
|
||||
|
||||
typedef enum StyleBar_u32_Tag {
|
||||
Bar1_u32,
|
||||
Bar2_u32,
|
||||
Bar3_u32,
|
||||
Bar4_u32,
|
||||
} StyleBar_u32_Tag;
|
||||
#ifndef __cplusplus
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct StyleBar1_Body_u32 {
|
||||
int32_t x;
|
||||
StylePoint_u32 y;
|
||||
StylePoint_f32 z;
|
||||
int32_t (*u)(int32_t);
|
||||
} StyleBar1_Body_u32;
|
||||
|
||||
typedef struct StyleBar2_Body_u32 {
|
||||
uint32_t _0;
|
||||
} StyleBar2_Body_u32;
|
||||
|
||||
typedef struct StyleBar3_Body_u32 {
|
||||
StylePoint_u32 _0;
|
||||
} StyleBar3_Body_u32;
|
||||
|
||||
typedef struct StyleBar_u32 {
|
||||
StyleBar_u32_Tag tag;
|
||||
union {
|
||||
StyleBar1_Body_u32 bar1;
|
||||
StyleBar2_Body_u32 bar2;
|
||||
StyleBar3_Body_u32 bar3;
|
||||
};
|
||||
} StyleBar_u32;
|
||||
|
||||
enum StyleBaz_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Baz1,
|
||||
Baz2,
|
||||
Baz3,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t StyleBaz_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct StyleBaz1_Body {
|
||||
StyleBaz_Tag tag;
|
||||
StyleBar_u32 _0;
|
||||
} StyleBaz1_Body;
|
||||
|
||||
typedef struct StyleBaz2_Body {
|
||||
StyleBaz_Tag tag;
|
||||
StylePoint_i32 _0;
|
||||
} StyleBaz2_Body;
|
||||
|
||||
typedef union StyleBaz {
|
||||
StyleBaz_Tag tag;
|
||||
StyleBaz1_Body baz1;
|
||||
StyleBaz2_Body baz2;
|
||||
} StyleBaz;
|
||||
|
||||
enum StyleTaz_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Taz1,
|
||||
Taz2,
|
||||
Taz3,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t StyleTaz_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct StyleTaz1_Body {
|
||||
StyleBar_u32 _0;
|
||||
} StyleTaz1_Body;
|
||||
|
||||
typedef struct StyleTaz2_Body {
|
||||
StyleBaz _0;
|
||||
} StyleTaz2_Body;
|
||||
|
||||
typedef struct StyleTaz {
|
||||
StyleTaz_Tag tag;
|
||||
union {
|
||||
StyleTaz1_Body taz1;
|
||||
StyleTaz2_Body taz2;
|
||||
};
|
||||
} StyleTaz;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void foo(const StyleFoo_i32 *foo,
|
||||
const StyleBar_i32 *bar,
|
||||
const StyleBaz *baz,
|
||||
const StyleTaz *taz);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
47
tests/expectations/both/transparent.compat.c
Normal file
47
tests/expectations/both/transparent.compat.c
Normal file
@ -0,0 +1,47 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct DummyStruct DummyStruct;
|
||||
|
||||
typedef struct EnumWithAssociatedConstantInImpl EnumWithAssociatedConstantInImpl;
|
||||
|
||||
typedef DummyStruct TransparentComplexWrappingStructTuple;
|
||||
|
||||
typedef uint32_t TransparentPrimitiveWrappingStructTuple;
|
||||
|
||||
typedef DummyStruct TransparentComplexWrappingStructure;
|
||||
|
||||
typedef uint32_t TransparentPrimitiveWrappingStructure;
|
||||
|
||||
typedef DummyStruct TransparentComplexWrapper_i32;
|
||||
|
||||
typedef uint32_t TransparentPrimitiveWrapper_i32;
|
||||
|
||||
typedef uint32_t TransparentPrimitiveWithAssociatedConstants;
|
||||
#define TransparentPrimitiveWithAssociatedConstants_ZERO 0
|
||||
#define TransparentPrimitiveWithAssociatedConstants_ONE 1
|
||||
|
||||
#define EnumWithAssociatedConstantInImpl_TEN 10
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(TransparentComplexWrappingStructTuple a,
|
||||
TransparentPrimitiveWrappingStructTuple b,
|
||||
TransparentComplexWrappingStructure c,
|
||||
TransparentPrimitiveWrappingStructure d,
|
||||
TransparentComplexWrapper_i32 e,
|
||||
TransparentPrimitiveWrapper_i32 f,
|
||||
TransparentPrimitiveWithAssociatedConstants g,
|
||||
EnumWithAssociatedConstantInImpl h);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
25
tests/expectations/both/typedef.compat.c
Normal file
25
tests/expectations/both/typedef.compat.c
Normal file
@ -0,0 +1,25 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Foo_i32__i32 {
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
} Foo_i32__i32;
|
||||
|
||||
typedef Foo_i32__i32 IntFoo_i32;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(IntFoo_i32 a);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
30
tests/expectations/both/union.compat.c
Normal file
30
tests/expectations/both/union.compat.c
Normal file
@ -0,0 +1,30 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Opaque Opaque;
|
||||
|
||||
typedef union Normal {
|
||||
int32_t x;
|
||||
float y;
|
||||
} Normal;
|
||||
|
||||
typedef union NormalWithZST {
|
||||
int32_t x;
|
||||
float y;
|
||||
} NormalWithZST;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Opaque *a, Normal b, NormalWithZST c);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
18
tests/expectations/both/va_list.compat.c
Normal file
18
tests/expectations/both/va_list.compat.c
Normal file
@ -0,0 +1,18 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
int32_t va_list_test(va_list ap);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
22
tests/expectations/both/workspace.compat.c
Normal file
22
tests/expectations/both/workspace.compat.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct ExtType {
|
||||
uint32_t data;
|
||||
} ExtType;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void consume_ext(ExtType _ext);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
50
tests/expectations/cdecl.compat.c
Normal file
50
tests/expectations/cdecl.compat.c
Normal file
@ -0,0 +1,50 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef void (*A)();
|
||||
|
||||
typedef void (*B)();
|
||||
|
||||
typedef bool (*C)(int32_t, int32_t);
|
||||
|
||||
typedef bool (*(*D)(int32_t))(float);
|
||||
|
||||
typedef const int32_t (*(*E)())[16];
|
||||
|
||||
typedef const int32_t *F;
|
||||
|
||||
typedef const int32_t *const *G;
|
||||
|
||||
typedef int32_t *const *H;
|
||||
|
||||
typedef const 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);
|
||||
|
||||
typedef void (*P)(int32_t named1st, bool, bool named3rd, int32_t _);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void (*O(void))(void);
|
||||
|
||||
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, P p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
48
tests/expectations/cfg-2.compat.c
Normal file
48
tests/expectations/cfg-2.compat.c
Normal file
@ -0,0 +1,48 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(NOT_DEFINED)
|
||||
#define DEFAULT_X 8
|
||||
#endif
|
||||
|
||||
#if defined(DEFINED)
|
||||
#define DEFAULT_X 42
|
||||
#endif
|
||||
|
||||
#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;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Root a);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
4
tests/expectations/cfg-field.compat.c
Normal file
4
tests/expectations/cfg-field.compat.c
Normal file
@ -0,0 +1,4 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
74
tests/expectations/cfg.compat.c
Normal file
74
tests/expectations/cfg.compat.c
Normal file
@ -0,0 +1,74 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if (defined(PLATFORM_WIN) || defined(M_32))
|
||||
enum BarType
|
||||
#ifdef __cplusplus
|
||||
: uint32_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
A,
|
||||
B,
|
||||
C,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint32_t BarType;
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
|
||||
#if (defined(PLATFORM_UNIX) && defined(X11))
|
||||
enum FooType
|
||||
#ifdef __cplusplus
|
||||
: uint32_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
A,
|
||||
B,
|
||||
C,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint32_t FooType;
|
||||
#endif // __cplusplus
|
||||
|
||||
#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
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#if (defined(PLATFORM_UNIX) && defined(X11))
|
||||
void root(FooHandle a);
|
||||
#endif
|
||||
|
||||
#if (defined(PLATFORM_WIN) || defined(M_32))
|
||||
void root(BarHandle a);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
6
tests/expectations/const_conflict.compat.c
Normal file
6
tests/expectations/const_conflict.compat.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define Foo_FOO 42
|
8
tests/expectations/const_transparent.compat.c
Normal file
8
tests/expectations/const_transparent.compat.c
Normal file
@ -0,0 +1,8 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef uint8_t Transparent;
|
||||
|
||||
#define FOO 0
|
42
tests/expectations/constant.compat.c
Normal file
42
tests/expectations/constant.compat.c
Normal file
@ -0,0 +1,42 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define DELIMITER ':'
|
||||
|
||||
#define FOO 10
|
||||
|
||||
#define HEART L'\u2764'
|
||||
|
||||
#define LEFTCURLY '{'
|
||||
|
||||
#define NEG_ONE -1
|
||||
|
||||
#define NEWLINE '\n'
|
||||
|
||||
#define POS_ONE 1
|
||||
|
||||
#define QUOTE '\''
|
||||
|
||||
#define TAB '\t'
|
||||
|
||||
#define ZOM 3.14
|
||||
|
||||
typedef struct {
|
||||
int32_t x[FOO];
|
||||
} Foo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Foo x);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
63
tests/expectations/derive-eq.compat.c
Normal file
63
tests/expectations/derive-eq.compat.c
Normal file
@ -0,0 +1,63 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct {
|
||||
bool a;
|
||||
int32_t b;
|
||||
} Foo;
|
||||
|
||||
enum Bar_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Baz,
|
||||
Bazz,
|
||||
FooNamed,
|
||||
FooParen,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t Bar_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct {
|
||||
Bar_Tag tag;
|
||||
Foo named;
|
||||
} Bazz_Body;
|
||||
|
||||
typedef struct {
|
||||
Bar_Tag tag;
|
||||
int32_t different;
|
||||
uint32_t fields;
|
||||
} FooNamed_Body;
|
||||
|
||||
typedef struct {
|
||||
Bar_Tag tag;
|
||||
int32_t _0;
|
||||
Foo _1;
|
||||
} FooParen_Body;
|
||||
|
||||
typedef union {
|
||||
Bar_Tag tag;
|
||||
Bazz_Body bazz;
|
||||
FooNamed_Body foo_named;
|
||||
FooParen_Body foo_paren;
|
||||
} Bar;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
Foo root(Bar aBar);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
213
tests/expectations/destructor-and-copy-ctor.compat.c
Normal file
213
tests/expectations/destructor-and-copy-ctor.compat.c
Normal file
@ -0,0 +1,213 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
enum FillRule
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
A,
|
||||
B,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t FillRule;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
/**
|
||||
* This will have a destructor manually implemented via variant_body, and
|
||||
* similarly a Drop impl in Rust.
|
||||
*/
|
||||
typedef struct {
|
||||
uintptr_t len;
|
||||
uint32_t *ptr;
|
||||
} OwnedSlice_u32;
|
||||
|
||||
typedef struct {
|
||||
FillRule fill;
|
||||
OwnedSlice_u32 coordinates;
|
||||
} Polygon_u32;
|
||||
|
||||
/**
|
||||
* This will have a destructor manually implemented via variant_body, and
|
||||
* similarly a Drop impl in Rust.
|
||||
*/
|
||||
typedef struct {
|
||||
uintptr_t len;
|
||||
int32_t *ptr;
|
||||
} OwnedSlice_i32;
|
||||
|
||||
enum Foo_u32_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Bar_u32,
|
||||
Polygon1_u32,
|
||||
Slice1_u32,
|
||||
Slice2_u32,
|
||||
Slice3_u32,
|
||||
Slice4_u32,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t Foo_u32_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct {
|
||||
Polygon_u32 _0;
|
||||
} Polygon1_Body_u32;
|
||||
|
||||
typedef struct {
|
||||
OwnedSlice_u32 _0;
|
||||
} Slice1_Body_u32;
|
||||
|
||||
typedef struct {
|
||||
OwnedSlice_i32 _0;
|
||||
} Slice2_Body_u32;
|
||||
|
||||
typedef struct {
|
||||
FillRule fill;
|
||||
OwnedSlice_u32 coords;
|
||||
} Slice3_Body_u32;
|
||||
|
||||
typedef struct {
|
||||
FillRule fill;
|
||||
OwnedSlice_i32 coords;
|
||||
} Slice4_Body_u32;
|
||||
|
||||
typedef struct {
|
||||
Foo_u32_Tag tag;
|
||||
union {
|
||||
Polygon1_Body_u32 polygon1;
|
||||
Slice1_Body_u32 slice1;
|
||||
Slice2_Body_u32 slice2;
|
||||
Slice3_Body_u32 slice3;
|
||||
Slice4_Body_u32 slice4;
|
||||
};
|
||||
} Foo_u32;
|
||||
|
||||
typedef struct {
|
||||
FillRule fill;
|
||||
OwnedSlice_i32 coordinates;
|
||||
} Polygon_i32;
|
||||
|
||||
enum Baz_i32_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Bar2_i32,
|
||||
Polygon21_i32,
|
||||
Slice21_i32,
|
||||
Slice22_i32,
|
||||
Slice23_i32,
|
||||
Slice24_i32,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t Baz_i32_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct {
|
||||
Baz_i32_Tag tag;
|
||||
Polygon_i32 _0;
|
||||
} Polygon21_Body_i32;
|
||||
|
||||
typedef struct {
|
||||
Baz_i32_Tag tag;
|
||||
OwnedSlice_i32 _0;
|
||||
} Slice21_Body_i32;
|
||||
|
||||
typedef struct {
|
||||
Baz_i32_Tag tag;
|
||||
OwnedSlice_i32 _0;
|
||||
} Slice22_Body_i32;
|
||||
|
||||
typedef struct {
|
||||
Baz_i32_Tag tag;
|
||||
FillRule fill;
|
||||
OwnedSlice_i32 coords;
|
||||
} Slice23_Body_i32;
|
||||
|
||||
typedef struct {
|
||||
Baz_i32_Tag tag;
|
||||
FillRule fill;
|
||||
OwnedSlice_i32 coords;
|
||||
} Slice24_Body_i32;
|
||||
|
||||
typedef union {
|
||||
Baz_i32_Tag tag;
|
||||
Polygon21_Body_i32 polygon21;
|
||||
Slice21_Body_i32 slice21;
|
||||
Slice22_Body_i32 slice22;
|
||||
Slice23_Body_i32 slice23;
|
||||
Slice24_Body_i32 slice24;
|
||||
} Baz_i32;
|
||||
|
||||
enum Taz_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Bar3,
|
||||
Taz1,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t Taz_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct {
|
||||
Taz_Tag tag;
|
||||
int32_t _0;
|
||||
} Taz1_Body;
|
||||
|
||||
typedef union {
|
||||
Taz_Tag tag;
|
||||
Taz1_Body taz1;
|
||||
} Taz;
|
||||
|
||||
enum Tazz_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Bar4,
|
||||
Taz2,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t Tazz_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct {
|
||||
Tazz_Tag tag;
|
||||
int32_t _0;
|
||||
} Taz2_Body;
|
||||
|
||||
typedef union {
|
||||
Tazz_Tag tag;
|
||||
Taz2_Body taz2;
|
||||
} Tazz;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(const Foo_u32 *a, const Baz_i32 *b, const Taz *c, Tazz d);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
65
tests/expectations/display_list.compat.c
Normal file
65
tests/expectations/display_list.compat.c
Normal file
@ -0,0 +1,65 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct {
|
||||
float x;
|
||||
float y;
|
||||
float w;
|
||||
float h;
|
||||
} Rect;
|
||||
|
||||
typedef struct {
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
uint8_t a;
|
||||
} Color;
|
||||
|
||||
enum DisplayItem_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Fill,
|
||||
Image,
|
||||
ClearScreen,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t DisplayItem_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct {
|
||||
DisplayItem_Tag tag;
|
||||
Rect _0;
|
||||
Color _1;
|
||||
} Fill_Body;
|
||||
|
||||
typedef struct {
|
||||
DisplayItem_Tag tag;
|
||||
uint32_t id;
|
||||
Rect bounds;
|
||||
} Image_Body;
|
||||
|
||||
typedef union {
|
||||
DisplayItem_Tag tag;
|
||||
Fill_Body fill;
|
||||
Image_Body image;
|
||||
} DisplayItem;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
bool push_item(DisplayItem item);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
21
tests/expectations/docstyle_auto.compat.c
Normal file
21
tests/expectations/docstyle_auto.compat.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
/**
|
||||
* The root of all evil.
|
||||
*/
|
||||
void root(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
19
tests/expectations/docstyle_c99.compat.c
Normal file
19
tests/expectations/docstyle_c99.compat.c
Normal file
@ -0,0 +1,19 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
// The root of all evil.
|
||||
void root(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
21
tests/expectations/docstyle_doxy.compat.c
Normal file
21
tests/expectations/docstyle_doxy.compat.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
/**
|
||||
* The root of all evil.
|
||||
*/
|
||||
void root(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
221
tests/expectations/enum.compat.c
Normal file
221
tests/expectations/enum.compat.c
Normal file
@ -0,0 +1,221 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
enum A
|
||||
#ifdef __cplusplus
|
||||
: uint32_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
a1 = 0,
|
||||
a2 = 2,
|
||||
a3,
|
||||
a4 = 5,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint32_t A;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
enum B
|
||||
#ifdef __cplusplus
|
||||
: uint16_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
b1 = 0,
|
||||
b2 = 2,
|
||||
b3,
|
||||
b4 = 5,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint16_t B;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
enum C
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
c1 = 0,
|
||||
c2 = 2,
|
||||
c3,
|
||||
c4 = 5,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t C;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
enum D
|
||||
#ifdef __cplusplus
|
||||
: uintptr_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
d1 = 0,
|
||||
d2 = 2,
|
||||
d3,
|
||||
d4 = 5,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uintptr_t D;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
enum E
|
||||
#ifdef __cplusplus
|
||||
: intptr_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
e1 = 0,
|
||||
e2 = 2,
|
||||
e3,
|
||||
e4 = 5,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef intptr_t E;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef enum {
|
||||
k1,
|
||||
k2,
|
||||
k3,
|
||||
k4,
|
||||
} K;
|
||||
#ifndef __cplusplus
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
enum L
|
||||
#ifdef __cplusplus
|
||||
: int8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
l1 = -1,
|
||||
l2 = 0,
|
||||
l3 = 1,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef int8_t L;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct I I;
|
||||
|
||||
typedef struct J J;
|
||||
|
||||
typedef struct Opaque Opaque;
|
||||
|
||||
enum F_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
Foo,
|
||||
Bar,
|
||||
Baz,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t F_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct {
|
||||
F_Tag tag;
|
||||
int16_t _0;
|
||||
} Foo_Body;
|
||||
|
||||
typedef struct {
|
||||
F_Tag tag;
|
||||
uint8_t x;
|
||||
int16_t y;
|
||||
} Bar_Body;
|
||||
|
||||
typedef union {
|
||||
F_Tag tag;
|
||||
Foo_Body foo;
|
||||
Bar_Body bar;
|
||||
} F;
|
||||
|
||||
typedef enum {
|
||||
G_Foo,
|
||||
G_Bar,
|
||||
G_Baz,
|
||||
} G_Tag;
|
||||
#ifndef __cplusplus
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct {
|
||||
int16_t _0;
|
||||
} G_Foo_Body;
|
||||
|
||||
typedef struct {
|
||||
uint8_t x;
|
||||
int16_t y;
|
||||
} G_Bar_Body;
|
||||
|
||||
typedef struct {
|
||||
G_Tag tag;
|
||||
union {
|
||||
G_Foo_Body foo;
|
||||
G_Bar_Body bar;
|
||||
};
|
||||
} G;
|
||||
|
||||
enum H_Tag
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
H_Foo,
|
||||
H_Bar,
|
||||
H_Baz,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
|
||||
typedef uint8_t H_Tag;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
typedef struct {
|
||||
int16_t _0;
|
||||
} H_Foo_Body;
|
||||
|
||||
typedef struct {
|
||||
uint8_t x;
|
||||
int16_t y;
|
||||
} H_Bar_Body;
|
||||
|
||||
typedef struct {
|
||||
H_Tag tag;
|
||||
union {
|
||||
H_Foo_Body foo;
|
||||
H_Bar_Body bar;
|
||||
};
|
||||
} H;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Opaque *o, A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
129
tests/expectations/euclid.compat.c
Normal file
129
tests/expectations/euclid.compat.c
Normal file
@ -0,0 +1,129 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct {
|
||||
float _0;
|
||||
} TypedLength_f32__UnknownUnit;
|
||||
|
||||
typedef struct {
|
||||
float _0;
|
||||
} TypedLength_f32__LayoutUnit;
|
||||
|
||||
typedef TypedLength_f32__UnknownUnit 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 TypedSideOffsets2D_f32__UnknownUnit 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 TypedSize2D_f32__UnknownUnit 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 TypedPoint2D_f32__UnknownUnit 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 TypedRect_f32__UnknownUnit 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;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
22
tests/expectations/expand.compat.c
Normal file
22
tests/expectations/expand.compat.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct {
|
||||
|
||||
} Foo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Foo a);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
24
tests/expectations/expand_default_features.compat.c
Normal file
24
tests/expectations/expand_default_features.compat.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct {
|
||||
|
||||
} Foo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void extra_debug_fn(void);
|
||||
|
||||
void root(Foo a);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
26
tests/expectations/expand_features.compat.c
Normal file
26
tests/expectations/expand_features.compat.c
Normal file
@ -0,0 +1,26 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct {
|
||||
|
||||
} Foo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void cbindgen(void);
|
||||
|
||||
void extra_debug_fn(void);
|
||||
|
||||
void root(Foo a);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
22
tests/expectations/expand_no_default_features.compat.c
Normal file
22
tests/expectations/expand_no_default_features.compat.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct {
|
||||
|
||||
} Foo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void root(Foo a);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
20
tests/expectations/extern-2.compat.c
Normal file
20
tests/expectations/extern-2.compat.c
Normal file
@ -0,0 +1,20 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
void first(void);
|
||||
|
||||
void second(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
25
tests/expectations/extern.compat.c
Normal file
25
tests/expectations/extern.compat.c
Normal file
@ -0,0 +1,25 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct {
|
||||
int32_t x;
|
||||
float y;
|
||||
} Normal;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
extern "C" {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
extern void bar(Normal a);
|
||||
|
||||
extern int32_t foo(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // __cplusplus
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user