Skip to content

Commit dd5bee6

Browse files
authored
Merge pull request #48 from rust-lang/feature/more-calling-conv-attributes
More calling conv attributes
2 parents 25fd931 + fb8d06e commit dd5bee6

File tree

5 files changed

+58
-14
lines changed

5 files changed

+58
-14
lines changed

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "gccjit"
3-
version = "2.5.0"
3+
version = "2.6.0"
44
authors = ["Sean Gillespie <[email protected]>", "Antoni Boucher <[email protected]>"]
55
description = "Higher-level Rust bindings for libgccjit."
66
keywords = ["compiler", "jit", "gcc"]
@@ -13,7 +13,7 @@ readme = "README.md"
1313
master = ["gccjit_sys/master"]
1414

1515
[dependencies]
16-
gccjit_sys = { version = "0.6.0", path = "gccjit_sys" }
16+
gccjit_sys = { version = "0.7.0", path = "gccjit_sys" }
1717

1818
[package.metadata.docs.rs]
1919
features = ["master"]

gccjit_sys/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "gccjit_sys"
3-
version = "0.6.0"
3+
version = "0.7.0"
44
authors = ["Sean Gillespie <[email protected]>", "Antoni Boucher <[email protected]>"]
55
#links = "gccjit"
66
description = "Raw bindings to libgccjit. Companion to the gccjit crate."

gccjit_sys/src/lib.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,19 @@ pub enum gcc_jit_fn_attribute
276276
GCC_JIT_FN_ATTRIBUTE_CONST,
277277
GCC_JIT_FN_ATTRIBUTE_WEAK,
278278
GCC_JIT_FN_ATTRIBUTE_NONNULL,
279-
GCC_JIT_FN_ATTRIBUTE_MS_ABI,
280-
GCC_JIT_FN_ATTRIBUTE_SYSV_ABI,
279+
GCC_JIT_FN_ATTRIBUTE_ARM_PCS,
280+
GCC_JIT_FN_ATTRIBUTE_AVR_INTERRUPT,
281+
GCC_JIT_FN_ATTRIBUTE_AVR_NOBLOCK,
282+
GCC_JIT_FN_ATTRIBUTE_AVR_SIGNAL,
283+
GCC_JIT_FN_ATTRIBUTE_GCN_AMDGPU_HSA_KERNEL,
284+
GCC_JIT_FN_ATTRIBUTE_MSP430_INTERRUPT,
285+
GCC_JIT_FN_ATTRIBUTE_NVPTX_KERNEL,
286+
GCC_JIT_FN_ATTRIBUTE_X86_FAST_CALL,
287+
GCC_JIT_FN_ATTRIBUTE_X86_INTERRUPT,
288+
GCC_JIT_FN_ATTRIBUTE_X86_MS_ABI,
289+
GCC_JIT_FN_ATTRIBUTE_X86_STDCALL,
290+
GCC_JIT_FN_ATTRIBUTE_X86_SYSV_ABI,
291+
GCC_JIT_FN_ATTRIBUTE_X86_THIS_CALL,
281292
}
282293

283294
#[cfg(feature="master")]
@@ -289,7 +300,7 @@ pub enum gcc_jit_variable_attribute
289300
}
290301

291302
#[link(name = "gccjit")]
292-
extern {
303+
extern "C" {
293304
// context operations
294305
pub fn gcc_jit_context_acquire() -> *mut gcc_jit_context;
295306
pub fn gcc_jit_context_release(ctx: *mut gcc_jit_context);

src/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,7 @@ impl<'ctx> Context<'ctx> {
11801180
pub fn set_logfile<S: AsRef<str>>(&self, _logfile: S) {
11811181
use std::os::raw::c_void;
11821182

1183-
extern {
1183+
extern "C" {
11841184
static stderr: *mut c_void;
11851185
}
11861186

src/function.rs

+40-7
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,27 @@ pub enum FnAttribute<'a> {
6060
Const,
6161
Weak,
6262
NonNull(Vec<std::ffi::c_int>),
63-
MsAbi,
64-
SysvAbi,
63+
ArmPcs(&'a str),
64+
AvrInterrupt,
65+
AvrNoblock,
66+
AvrSignal,
67+
GcnAmdGpuHsaKernel,
68+
Msp430Interrupt,
69+
NvptxKernel,
70+
X86FastCall,
71+
X86Interrupt,
72+
X86MsAbi,
73+
X86Stdcall,
74+
X86SysvAbi,
75+
X86ThisCall,
6576
}
6677

6778
#[cfg(feature="master")]
6879
impl<'a> FnAttribute<'a> {
6980
fn get_value(&self) -> AttributeValue {
7081
match *self {
71-
FnAttribute::Alias(value) | FnAttribute::Target(value) => AttributeValue::String(value),
82+
FnAttribute::Alias(value) | FnAttribute::ArmPcs(value) | FnAttribute::Target(value) =>
83+
AttributeValue::String(value),
7284
FnAttribute::Visibility(visibility) => AttributeValue::String(visibility.as_str()),
7385
FnAttribute::AlwaysInline
7486
| FnAttribute::Inline
@@ -79,8 +91,18 @@ impl<'a> FnAttribute<'a> {
7991
| FnAttribute::Pure
8092
| FnAttribute::Const
8193
| FnAttribute::Weak
82-
| FnAttribute::MsAbi
83-
| FnAttribute::SysvAbi => AttributeValue::None,
94+
| FnAttribute::AvrInterrupt
95+
| FnAttribute::AvrNoblock
96+
| FnAttribute::AvrSignal
97+
| FnAttribute::GcnAmdGpuHsaKernel
98+
| FnAttribute::Msp430Interrupt
99+
| FnAttribute::NvptxKernel
100+
| FnAttribute::X86FastCall
101+
| FnAttribute::X86Interrupt
102+
| FnAttribute::X86MsAbi
103+
| FnAttribute::X86Stdcall
104+
| FnAttribute::X86SysvAbi
105+
| FnAttribute::X86ThisCall => AttributeValue::None,
84106
FnAttribute::NonNull(ref value) => {
85107
debug_assert!(
86108
value.iter().all(|attr| *attr > 0),
@@ -106,8 +128,19 @@ impl<'a> FnAttribute<'a> {
106128
FnAttribute::Const => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_CONST,
107129
FnAttribute::Weak => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_WEAK,
108130
FnAttribute::NonNull(_) => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_NONNULL,
109-
FnAttribute::MsAbi => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_MS_ABI,
110-
FnAttribute::SysvAbi => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_SYSV_ABI,
131+
FnAttribute::ArmPcs(_) => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_ARM_PCS,
132+
FnAttribute::AvrInterrupt => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_AVR_INTERRUPT,
133+
FnAttribute::AvrNoblock => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_AVR_NOBLOCK,
134+
FnAttribute::AvrSignal => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_AVR_SIGNAL,
135+
FnAttribute::GcnAmdGpuHsaKernel => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_GCN_AMDGPU_HSA_KERNEL,
136+
FnAttribute::Msp430Interrupt => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_MSP430_INTERRUPT,
137+
FnAttribute::NvptxKernel => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_NVPTX_KERNEL,
138+
FnAttribute::X86FastCall => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_X86_FAST_CALL,
139+
FnAttribute::X86Interrupt => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_X86_INTERRUPT,
140+
FnAttribute::X86MsAbi => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_X86_MS_ABI,
141+
FnAttribute::X86Stdcall => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_X86_STDCALL,
142+
FnAttribute::X86SysvAbi => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_X86_SYSV_ABI,
143+
FnAttribute::X86ThisCall => gccjit_sys::gcc_jit_fn_attribute::GCC_JIT_FN_ATTRIBUTE_X86_THIS_CALL,
111144
}
112145
}
113146
}

0 commit comments

Comments
 (0)