Skip to content

Commit be7ca8d

Browse files
authored
Merge pull request #35 from zedar/add_gcc_jit_supports_target_dependent_type
Extend context and target info with function to check if target dependent types is supported
2 parents 82e65eb + ed8045c commit be7ca8d

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

gccjit_sys/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,9 @@ extern {
658658
#[cfg(feature="master")]
659659
pub fn gcc_jit_target_info_supports_128bit_int(info: *mut gcc_jit_target_info) -> c_int;
660660

661+
#[cfg(feature="master")]
662+
pub fn gcc_jit_target_info_supports_target_dependent_type(info: *mut gcc_jit_target_info, ty: gcc_jit_types) -> c_int;
663+
661664
#[cfg(feature="master")]
662665
pub fn gcc_jit_context_new_sizeof(ctxt: *mut gcc_jit_context, typ: *mut gcc_jit_type) -> *mut gcc_jit_rvalue;
663666

src/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ pub enum CType {
13391339
}
13401340

13411341
impl CType {
1342-
fn to_sys(self) -> gccjit_sys::gcc_jit_types {
1342+
pub(crate) fn to_sys(self) -> gccjit_sys::gcc_jit_types {
13431343
use gccjit_sys::gcc_jit_types::*;
13441344
use self::CType::*;
13451345

src/target_info.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use context::CType;
12
use std::{ffi::{CStr, CString}, fmt};
23

34
pub struct TargetInfo {
@@ -40,6 +41,13 @@ impl TargetInfo {
4041
gccjit_sys::gcc_jit_target_info_supports_128bit_int(self.ptr) != 0
4142
}
4243
}
44+
45+
#[cfg(feature="master")]
46+
pub fn supports_target_dependent_type(&self, c_type: CType) -> bool {
47+
unsafe {
48+
gccjit_sys::gcc_jit_target_info_supports_target_dependent_type(self.ptr, c_type.to_sys()) != 0
49+
}
50+
}
4351
}
4452

4553
impl Drop for TargetInfo {

0 commit comments

Comments
 (0)