Skip to content

Commit

Permalink
[fix] fix error for unsafe attr and bump to v0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Azure-stars committed Jan 25, 2025
1 parent 4ed9851 commit 92810a7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ members = [
]

[workspace.package]
version = "0.2.0"
version = "0.2.1"
edition = "2024"
authors = ["Youjie Zheng <[email protected]>"]
license = "GPL-3.0-or-later OR Apache-2.0 OR MulanPSL-2.0"
Expand Down
2 changes: 1 addition & 1 deletion ctor_bare/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ categories.workspace = true
readme = "README.md"

[dependencies]
ctor_bare_macros = "0.1"
ctor_bare_macros = "0.2"
3 changes: 1 addition & 2 deletions ctor_bare/tests/test_ctor.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use ctor_bare::register_ctor;
use std::sync::{Mutex, atomic::AtomicUsize};

use ctor_bare::*;

static INIT_NUM: AtomicUsize = AtomicUsize::new(0);

#[register_ctor]
Expand Down
4 changes: 2 additions & 2 deletions ctor_bare_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ pub fn register_ctor(attr: TokenStream, function: TokenStream) -> TokenStream {
let block = &func.block;

quote! {
#[link_section = ".init_array"]
#[unsafe(link_section = ".init_array")]
#[used]
#[allow(non_upper_case_globals)]
static #name_ident: extern "C" fn() = #name;

#[no_mangle]
#[unsafe(no_mangle)]
#[allow(non_upper_case_globals)]
pub extern "C" fn #name() {
#block
Expand Down

0 comments on commit 92810a7

Please sign in to comment.