Skip to content

Commit

Permalink
account for system abi (#2586)
Browse files Browse the repository at this point in the history
* account for system abi

Closes #2576

* add test for system abi

* Update changelog

---------

Co-authored-by: Christian Poveda <christian.poveda@ferrous-systems.com>
  • Loading branch information
tshepang and pvdrz committed Jul 19, 2023
1 parent 97e29b4 commit 1d2b579
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -171,6 +171,7 @@
# Unreleased

## Added
- The `system` ABI is now supported as an option for the `--override-abi` flag.
## Changed
- The `Clone` implementation for `_BindgenUnionField` has been changed to pass
the `incorrect_clone_impl_on_copy_type` Clippy lint.
Expand Down
3 changes: 3 additions & 0 deletions bindgen-tests/tests/expectations/tests/abi-override.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion bindgen-tests/tests/headers/abi-override.h
@@ -1,8 +1,9 @@
// bindgen-flags: --override-abi=foo=fastcall --override-abi=bar=stdcall --override-abi=boo=efiapi --override-abi=foobar=efiapi
// bindgen-flags: --override-abi=foo=fastcall --override-abi=bar=stdcall --override-abi=boo=efiapi --override-abi=foobar=efiapi --override-abi qux=system

void foo();
void bar();
void baz();
void qux();

typedef void (*boo)();
typedef void (*foobar)(boo boo);
4 changes: 4 additions & 0 deletions bindgen/ir/function.rs
Expand Up @@ -190,6 +190,8 @@ pub enum Abi {
Win64,
/// The "C-unwind" ABI.
CUnwind,
/// The "system" ABI.
System,
}

impl FromStr for Abi {
Expand All @@ -206,6 +208,7 @@ impl FromStr for Abi {
"aapcs" => Ok(Self::Aapcs),
"win64" => Ok(Self::Win64),
"C-unwind" => Ok(Self::CUnwind),
"system" => Ok(Self::System),
_ => Err(format!("Invalid or unknown ABI {:?}", s)),
}
}
Expand All @@ -223,6 +226,7 @@ impl std::fmt::Display for Abi {
Self::Aapcs => "aapcs",
Self::Win64 => "win64",
Self::CUnwind => "C-unwind",
Abi::System => "system",
};

s.fmt(f)
Expand Down

0 comments on commit 1d2b579

Please sign in to comment.