Skip to content

Commit 1d2b579

Browse files
tshepangpvdrz
andauthored
account for system abi (#2586)
* account for system abi Closes #2576 * add test for system abi * Update changelog --------- Co-authored-by: Christian Poveda <[email protected]>
1 parent 97e29b4 commit 1d2b579

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@
171171
# Unreleased
172172

173173
## Added
174+
- The `system` ABI is now supported as an option for the `--override-abi` flag.
174175
## Changed
175176
- The `Clone` implementation for `_BindgenUnionField` has been changed to pass
176177
the `incorrect_clone_impl_on_copy_type` Clippy lint.

bindgen-tests/tests/expectations/tests/abi-override.rs

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
// bindgen-flags: --override-abi=foo=fastcall --override-abi=bar=stdcall --override-abi=boo=efiapi --override-abi=foobar=efiapi
1+
// bindgen-flags: --override-abi=foo=fastcall --override-abi=bar=stdcall --override-abi=boo=efiapi --override-abi=foobar=efiapi --override-abi qux=system
22

33
void foo();
44
void bar();
55
void baz();
6+
void qux();
67

78
typedef void (*boo)();
89
typedef void (*foobar)(boo boo);

bindgen/ir/function.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ pub enum Abi {
190190
Win64,
191191
/// The "C-unwind" ABI.
192192
CUnwind,
193+
/// The "system" ABI.
194+
System,
193195
}
194196

195197
impl FromStr for Abi {
@@ -206,6 +208,7 @@ impl FromStr for Abi {
206208
"aapcs" => Ok(Self::Aapcs),
207209
"win64" => Ok(Self::Win64),
208210
"C-unwind" => Ok(Self::CUnwind),
211+
"system" => Ok(Self::System),
209212
_ => Err(format!("Invalid or unknown ABI {:?}", s)),
210213
}
211214
}
@@ -223,6 +226,7 @@ impl std::fmt::Display for Abi {
223226
Self::Aapcs => "aapcs",
224227
Self::Win64 => "win64",
225228
Self::CUnwind => "C-unwind",
229+
Abi::System => "system",
226230
};
227231

228232
s.fmt(f)

0 commit comments

Comments
 (0)