unraw the identifiers
Fixes https://github.com/eqrion/cbindgen/issues/410
This commit is contained in:
committed by
Emilio Cobos Álvarez
parent
11228f6b6f
commit
ed8d94619f
@@ -0,0 +1,18 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
enum Enum {
|
||||
a,
|
||||
b,
|
||||
};
|
||||
typedef uint8_t Enum;
|
||||
|
||||
typedef struct Struct {
|
||||
Enum field;
|
||||
} Struct;
|
||||
|
||||
extern const Enum STATIC;
|
||||
|
||||
void fn(struct Struct arg);
|
||||
@@ -0,0 +1,32 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
enum Enum
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
a,
|
||||
b,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
typedef uint8_t Enum;
|
||||
#endif // __cplusplus
|
||||
|
||||
typedef struct Struct {
|
||||
Enum field;
|
||||
} Struct;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
extern const Enum STATIC;
|
||||
|
||||
void fn(struct Struct arg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
@@ -0,0 +1,18 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
enum Enum {
|
||||
a,
|
||||
b,
|
||||
};
|
||||
typedef uint8_t Enum;
|
||||
|
||||
typedef struct {
|
||||
Enum field;
|
||||
} Struct;
|
||||
|
||||
extern const Enum STATIC;
|
||||
|
||||
void fn(Struct arg);
|
||||
@@ -0,0 +1,32 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
enum Enum
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
a,
|
||||
b,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
typedef uint8_t Enum;
|
||||
#endif // __cplusplus
|
||||
|
||||
typedef struct {
|
||||
Enum field;
|
||||
} Struct;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
extern const Enum STATIC;
|
||||
|
||||
void fn(Struct arg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
@@ -0,0 +1,22 @@
|
||||
#include <cstdarg>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <ostream>
|
||||
#include <new>
|
||||
|
||||
enum class Enum : uint8_t {
|
||||
a,
|
||||
b,
|
||||
};
|
||||
|
||||
struct Struct {
|
||||
Enum field;
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
|
||||
extern const Enum STATIC;
|
||||
|
||||
void fn(Struct arg);
|
||||
|
||||
} // extern "C"
|
||||
@@ -0,0 +1,19 @@
|
||||
from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
|
||||
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
|
||||
cdef extern from *:
|
||||
ctypedef bint bool
|
||||
ctypedef struct va_list
|
||||
|
||||
cdef extern from *:
|
||||
|
||||
cdef enum:
|
||||
a,
|
||||
b,
|
||||
ctypedef uint8_t Enum;
|
||||
|
||||
ctypedef struct Struct:
|
||||
Enum field;
|
||||
|
||||
extern const Enum STATIC;
|
||||
|
||||
void fn(Struct arg);
|
||||
@@ -0,0 +1,18 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
enum Enum {
|
||||
a,
|
||||
b,
|
||||
};
|
||||
typedef uint8_t Enum;
|
||||
|
||||
struct Struct {
|
||||
Enum field;
|
||||
};
|
||||
|
||||
extern const Enum STATIC;
|
||||
|
||||
void fn(struct Struct arg);
|
||||
@@ -0,0 +1,32 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
enum Enum
|
||||
#ifdef __cplusplus
|
||||
: uint8_t
|
||||
#endif // __cplusplus
|
||||
{
|
||||
a,
|
||||
b,
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
typedef uint8_t Enum;
|
||||
#endif // __cplusplus
|
||||
|
||||
struct Struct {
|
||||
Enum field;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
extern const Enum STATIC;
|
||||
|
||||
void fn(struct Struct arg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
@@ -0,0 +1,19 @@
|
||||
from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
|
||||
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
|
||||
cdef extern from *:
|
||||
ctypedef bint bool
|
||||
ctypedef struct va_list
|
||||
|
||||
cdef extern from *:
|
||||
|
||||
cdef enum:
|
||||
a,
|
||||
b,
|
||||
ctypedef uint8_t Enum;
|
||||
|
||||
cdef struct Struct:
|
||||
Enum field;
|
||||
|
||||
extern const Enum STATIC;
|
||||
|
||||
void fn(Struct arg);
|
||||
@@ -0,0 +1,20 @@
|
||||
#[repr(u8)]
|
||||
pub enum r#Enum {
|
||||
r#a,
|
||||
r#b,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct r#Struct {
|
||||
r#field: r#Enum,
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn r#fn(r#arg: r#Struct) {
|
||||
println!("Hello world");
|
||||
}
|
||||
|
||||
pub mod r#mod {
|
||||
#[no_mangle]
|
||||
pub static r#STATIC: r#Enum = r#Enum::r#b;
|
||||
}
|
||||
Reference in New Issue
Block a user