1mod rt_decls {
2 extern "C" {
3 #![allow(improper_ctypes)]
4 pub fn CVT_calltrace_attach_location(file: &str, line: u64);
6 }
7}
8
9#[cfg(feature = "rt")]
10mod rt_impls {
11 #[no_mangle]
12 pub extern "C" fn CVT_calltrace_attach_location(_tag: &str, v: u64) {}
13}
14
15#[inline(always)]
16pub fn add_loc(file: &str, line: u32) {
17 unsafe {
18 rt_decls::CVT_calltrace_attach_location(file, line as u64);
19 }
20}
21
22#[macro_export]
23macro_rules! add_loc {
24 () => {
25 $crate::log::add_loc(core::file!(), core::line!());
26 };
27}