parser: Treat omitted ABI in extern block as "C".

As per https://doc.rust-lang.org/reference/items/external-blocks.html#abi

Closes #709
This commit is contained in:
Emilio Cobos Álvarez 2024-04-14 21:39:23 -04:00
parent 92f9d3b073
commit e2114642ae
11 changed files with 23 additions and 1 deletions

View File

@ -600,7 +600,7 @@ impl Parse {
mod_cfg: Option<&Cfg>,
item: &syn::ItemForeignMod,
) {
if !item.abi.is_c() {
if !item.abi.is_c() && !item.abi.is_omitted() {
info!("Skip {} - (extern block must be extern C).", crate_name);
return;
}

View File

@ -11,3 +11,5 @@ typedef struct {
extern int32_t foo(void);
extern void bar(Normal a);
extern int32_t baz(void);

View File

@ -16,6 +16,8 @@ extern int32_t foo(void);
extern void bar(Normal a);
extern int32_t baz(void);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

View File

@ -15,4 +15,6 @@ extern int32_t foo();
extern void bar(Normal a);
extern int32_t baz();
} // extern "C"

View File

@ -13,3 +13,5 @@ cdef extern from *:
extern int32_t foo();
extern void bar(Normal a);
extern int32_t baz();

View File

@ -11,3 +11,5 @@ typedef struct Normal {
extern int32_t foo(void);
extern void bar(struct Normal a);
extern int32_t baz(void);

View File

@ -16,6 +16,8 @@ extern int32_t foo(void);
extern void bar(struct Normal a);
extern int32_t baz(void);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

View File

@ -11,3 +11,5 @@ struct Normal {
extern int32_t foo(void);
extern void bar(struct Normal a);
extern int32_t baz(void);

View File

@ -16,6 +16,8 @@ extern int32_t foo(void);
extern void bar(struct Normal a);
extern int32_t baz(void);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

View File

@ -13,3 +13,5 @@ cdef extern from *:
extern int32_t foo();
extern void bar(Normal a);
extern int32_t baz();

View File

@ -9,3 +9,7 @@ extern "C" {
fn bar(a: Normal);
}
extern {
fn baz() -> i32;
}