bindgen: enable "void prototype" while writing struct field
This fixs typedef's signature in C as well because a typedef statement is constructed like, "typedef " + field_like_string.
This commit is contained in:
parent
c6809b00fb
commit
0163b83d76
@ -286,7 +286,7 @@ pub fn write_func<F: Write>(
|
||||
}
|
||||
|
||||
pub fn write_field<F: Write>(out: &mut SourceWriter<F>, t: &Type, ident: &str) {
|
||||
CDecl::from_type(t).write(out, Some(ident), false);
|
||||
CDecl::from_type(t).write(out, Some(ident), true);
|
||||
}
|
||||
|
||||
pub fn write_type<F: Write>(out: &mut SourceWriter<F>, t: &Type) {
|
||||
|
@ -3,15 +3,15 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef void (*A)();
|
||||
typedef void (*A)(void);
|
||||
|
||||
typedef void (*B)();
|
||||
typedef void (*B)(void);
|
||||
|
||||
typedef bool (*C)(int32_t, int32_t);
|
||||
|
||||
typedef bool (*(*D)(int32_t))(float);
|
||||
|
||||
typedef const int32_t (*(*E)())[16];
|
||||
typedef const int32_t (*(*E)(void))[16];
|
||||
|
||||
typedef const int32_t *F;
|
||||
|
||||
|
@ -3,15 +3,15 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef void (*A)();
|
||||
typedef void (*A)(void);
|
||||
|
||||
typedef void (*B)();
|
||||
typedef void (*B)(void);
|
||||
|
||||
typedef bool (*C)(int32_t, int32_t);
|
||||
|
||||
typedef bool (*(*D)(int32_t))(float);
|
||||
|
||||
typedef const int32_t (*(*E)())[16];
|
||||
typedef const int32_t (*(*E)(void))[16];
|
||||
|
||||
typedef const int32_t *F;
|
||||
|
||||
|
@ -4,9 +4,9 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Fns {
|
||||
void (*noArgs)();
|
||||
void (*noArgs)(void);
|
||||
void (*anonymousArg)(int32_t);
|
||||
int32_t (*returnsNumber)();
|
||||
int32_t (*returnsNumber)(void);
|
||||
int8_t (*namedArgs)(int32_t first, int16_t snd);
|
||||
int8_t (*namedArgsWildcards)(int32_t _, int16_t named, int64_t _1);
|
||||
} Fns;
|
||||
|
@ -4,9 +4,9 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Fns {
|
||||
void (*noArgs)();
|
||||
void (*noArgs)(void);
|
||||
void (*anonymousArg)(int32_t);
|
||||
int32_t (*returnsNumber)();
|
||||
int32_t (*returnsNumber)(void);
|
||||
int8_t (*namedArgs)(int32_t first, int16_t snd);
|
||||
int8_t (*namedArgsWildcards)(int32_t _, int16_t named, int64_t _1);
|
||||
} Fns;
|
||||
|
@ -8,13 +8,13 @@ typedef struct Opaque Opaque;
|
||||
typedef struct Foo {
|
||||
const Opaque *x;
|
||||
Opaque *y;
|
||||
void (*z)();
|
||||
void (*z)(void);
|
||||
} Foo;
|
||||
|
||||
typedef union Bar {
|
||||
const Opaque *x;
|
||||
Opaque *y;
|
||||
void (*z)();
|
||||
void (*z)(void);
|
||||
} Bar;
|
||||
|
||||
void root(const Opaque *a, Opaque *b, Foo c, Bar d);
|
||||
|
@ -8,13 +8,13 @@ typedef struct Opaque Opaque;
|
||||
typedef struct Foo {
|
||||
const Opaque *x;
|
||||
Opaque *y;
|
||||
void (*z)();
|
||||
void (*z)(void);
|
||||
} Foo;
|
||||
|
||||
typedef union Bar {
|
||||
const Opaque *x;
|
||||
Opaque *y;
|
||||
void (*z)();
|
||||
void (*z)(void);
|
||||
} Bar;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -3,15 +3,15 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef void (*A)();
|
||||
typedef void (*A)(void);
|
||||
|
||||
typedef void (*B)();
|
||||
typedef void (*B)(void);
|
||||
|
||||
typedef bool (*C)(int32_t, int32_t);
|
||||
|
||||
typedef bool (*(*D)(int32_t))(float);
|
||||
|
||||
typedef const int32_t (*(*E)())[16];
|
||||
typedef const int32_t (*(*E)(void))[16];
|
||||
|
||||
typedef const int32_t *F;
|
||||
|
||||
|
@ -3,15 +3,15 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef void (*A)();
|
||||
typedef void (*A)(void);
|
||||
|
||||
typedef void (*B)();
|
||||
typedef void (*B)(void);
|
||||
|
||||
typedef bool (*C)(int32_t, int32_t);
|
||||
|
||||
typedef bool (*(*D)(int32_t))(float);
|
||||
|
||||
typedef const int32_t (*(*E)())[16];
|
||||
typedef const int32_t (*(*E)(void))[16];
|
||||
|
||||
typedef const int32_t *F;
|
||||
|
||||
|
@ -4,9 +4,9 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct {
|
||||
void (*noArgs)();
|
||||
void (*noArgs)(void);
|
||||
void (*anonymousArg)(int32_t);
|
||||
int32_t (*returnsNumber)();
|
||||
int32_t (*returnsNumber)(void);
|
||||
int8_t (*namedArgs)(int32_t first, int16_t snd);
|
||||
int8_t (*namedArgsWildcards)(int32_t _, int16_t named, int64_t _1);
|
||||
} Fns;
|
||||
|
@ -4,9 +4,9 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct {
|
||||
void (*noArgs)();
|
||||
void (*noArgs)(void);
|
||||
void (*anonymousArg)(int32_t);
|
||||
int32_t (*returnsNumber)();
|
||||
int32_t (*returnsNumber)(void);
|
||||
int8_t (*namedArgs)(int32_t first, int16_t snd);
|
||||
int8_t (*namedArgsWildcards)(int32_t _, int16_t named, int64_t _1);
|
||||
} Fns;
|
||||
|
@ -4,9 +4,9 @@
|
||||
#include <new>
|
||||
|
||||
struct Fns {
|
||||
void (*noArgs)();
|
||||
void (*noArgs)(void);
|
||||
void (*anonymousArg)(int32_t);
|
||||
int32_t (*returnsNumber)();
|
||||
int32_t (*returnsNumber)(void);
|
||||
int8_t (*namedArgs)(int32_t first, int16_t snd);
|
||||
int8_t (*namedArgsWildcards)(int32_t _, int16_t named, int64_t _1);
|
||||
};
|
||||
|
@ -8,13 +8,13 @@ typedef struct Opaque Opaque;
|
||||
typedef struct {
|
||||
const Opaque *x;
|
||||
Opaque *y;
|
||||
void (*z)();
|
||||
void (*z)(void);
|
||||
} Foo;
|
||||
|
||||
typedef union {
|
||||
const Opaque *x;
|
||||
Opaque *y;
|
||||
void (*z)();
|
||||
void (*z)(void);
|
||||
} Bar;
|
||||
|
||||
void root(const Opaque *a, Opaque *b, Foo c, Bar d);
|
||||
|
@ -8,13 +8,13 @@ typedef struct Opaque Opaque;
|
||||
typedef struct {
|
||||
const Opaque *x;
|
||||
Opaque *y;
|
||||
void (*z)();
|
||||
void (*z)(void);
|
||||
} Foo;
|
||||
|
||||
typedef union {
|
||||
const Opaque *x;
|
||||
Opaque *y;
|
||||
void (*z)();
|
||||
void (*z)(void);
|
||||
} Bar;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -8,13 +8,13 @@ struct Opaque;
|
||||
struct Foo {
|
||||
const Opaque *x;
|
||||
Opaque *y;
|
||||
void (*z)();
|
||||
void (*z)(void);
|
||||
};
|
||||
|
||||
union Bar {
|
||||
const Opaque *x;
|
||||
Opaque *y;
|
||||
void (*z)();
|
||||
void (*z)(void);
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
|
@ -3,15 +3,15 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef void (*A)();
|
||||
typedef void (*A)(void);
|
||||
|
||||
typedef void (*B)();
|
||||
typedef void (*B)(void);
|
||||
|
||||
typedef bool (*C)(int32_t, int32_t);
|
||||
|
||||
typedef bool (*(*D)(int32_t))(float);
|
||||
|
||||
typedef const int32_t (*(*E)())[16];
|
||||
typedef const int32_t (*(*E)(void))[16];
|
||||
|
||||
typedef const int32_t *F;
|
||||
|
||||
|
@ -3,15 +3,15 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef void (*A)();
|
||||
typedef void (*A)(void);
|
||||
|
||||
typedef void (*B)();
|
||||
typedef void (*B)(void);
|
||||
|
||||
typedef bool (*C)(int32_t, int32_t);
|
||||
|
||||
typedef bool (*(*D)(int32_t))(float);
|
||||
|
||||
typedef const int32_t (*(*E)())[16];
|
||||
typedef const int32_t (*(*E)(void))[16];
|
||||
|
||||
typedef const int32_t *F;
|
||||
|
||||
|
@ -4,9 +4,9 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
struct Fns {
|
||||
void (*noArgs)();
|
||||
void (*noArgs)(void);
|
||||
void (*anonymousArg)(int32_t);
|
||||
int32_t (*returnsNumber)();
|
||||
int32_t (*returnsNumber)(void);
|
||||
int8_t (*namedArgs)(int32_t first, int16_t snd);
|
||||
int8_t (*namedArgsWildcards)(int32_t _, int16_t named, int64_t _1);
|
||||
};
|
||||
|
@ -4,9 +4,9 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
struct Fns {
|
||||
void (*noArgs)();
|
||||
void (*noArgs)(void);
|
||||
void (*anonymousArg)(int32_t);
|
||||
int32_t (*returnsNumber)();
|
||||
int32_t (*returnsNumber)(void);
|
||||
int8_t (*namedArgs)(int32_t first, int16_t snd);
|
||||
int8_t (*namedArgsWildcards)(int32_t _, int16_t named, int64_t _1);
|
||||
};
|
||||
|
@ -8,13 +8,13 @@ struct Opaque;
|
||||
struct Foo {
|
||||
const struct Opaque *x;
|
||||
struct Opaque *y;
|
||||
void (*z)();
|
||||
void (*z)(void);
|
||||
};
|
||||
|
||||
union Bar {
|
||||
const struct Opaque *x;
|
||||
struct Opaque *y;
|
||||
void (*z)();
|
||||
void (*z)(void);
|
||||
};
|
||||
|
||||
void root(const struct Opaque *a, struct Opaque *b, struct Foo c, union Bar d);
|
||||
|
@ -8,13 +8,13 @@ struct Opaque;
|
||||
struct Foo {
|
||||
const struct Opaque *x;
|
||||
struct Opaque *y;
|
||||
void (*z)();
|
||||
void (*z)(void);
|
||||
};
|
||||
|
||||
union Bar {
|
||||
const struct Opaque *x;
|
||||
struct Opaque *y;
|
||||
void (*z)();
|
||||
void (*z)(void);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
x
Reference in New Issue
Block a user