Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Download and install GCC fork
if: ${{ matrix.os == 'ubuntu-24.04' }}
run: |
curl -LO https://github.com/antoyo/gcc/releases/latest/download/gcc-15.deb
curl -LO https://github.com/rust-lang/gcc/releases/latest/download/gcc-15.deb
sudo dpkg --force-overwrite -i gcc-15.deb

- name: Set env
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gccjit"
version = "3.1.1"
version = "3.2.0"
authors = ["Sean Gillespie <sean.william.g@gmail.com>", "Antoni Boucher <bouanto@zoho.com>"]
description = "Higher-level Rust bindings for libgccjit."
keywords = ["compiler", "jit", "gcc"]
Expand All @@ -14,7 +14,7 @@ master = ["gccjit_sys/master"]
dlopen = ["gccjit_sys/dlopen"]

[dependencies]
gccjit_sys = { version = "1.1.1", path = "gccjit_sys" }
gccjit_sys = { version = "1.2.0", path = "gccjit_sys" }

[package.metadata.docs.rs]
features = ["master"]
2 changes: 1 addition & 1 deletion gccjit_sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gccjit_sys"
version = "1.1.2"
version = "1.2.0"
authors = ["Sean Gillespie <sean.william.g@gmail.com>", "Antoni Boucher <bouanto@zoho.com>"]
#links = "gccjit"
description = "Raw bindings to libgccjit. Companion to the gccjit crate."
Expand Down
6 changes: 6 additions & 0 deletions gccjit_sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -774,4 +774,10 @@ extern_maybe_dlopen! {

#[cfg(feature="master")]
fn gcc_jit_type_set_addressable(typ: *mut gcc_jit_type);

#[cfg(feature="master")]
fn gcc_jit_set_lang_name(lang_name: *const c_char);

#[cfg(feature="master")]
fn gcc_jit_context_set_filename(ctx: *mut gcc_jit_context, filename: *const c_char);
}
10 changes: 10 additions & 0 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,16 @@ impl<'ctx> Context<'ctx> {
panic!("{}", error);
}
}

#[cfg(feature="master")]
pub fn set_filename(&self, filename: &str) {
let c_str = CString::new(filename).unwrap();
with_lib(|lib| {
unsafe {
lib.gcc_jit_context_set_filename(self.ptr, c_str.as_ptr());
}
})
}
}

impl<'ctx> Drop for Context<'ctx> {
Expand Down
11 changes: 10 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ mod block;
#[cfg(feature="master")]
mod target_info;

#[cfg(feature="dlopen")]
#[cfg(any(feature="dlopen", feature="master"))]
use std::ffi::CStr;
#[cfg(feature="dlopen")]
use std::sync::OnceLock;
Expand Down Expand Up @@ -148,3 +148,12 @@ pub static LIB: OnceLock<Option<Libgccjit>> = OnceLock::new();
// Without the dlopen feature, we avoid using OnceLock as to not have any performance impact.
#[cfg(not(feature="dlopen"))]
static LIB: Libgccjit = Libgccjit::new();

#[cfg(feature="master")]
pub fn set_lang_name(lang_name: &'static CStr) {
unsafe {
with_lib(|lib| {
lib.gcc_jit_set_lang_name(lang_name.as_ptr());
});
}
}
Loading