Skip to content

Commit 775c4c4

Browse files
committed
Windows compile fix commit
1 parent 1f3a878 commit 775c4c4

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

datadog-crashtracker-ffi/src/runtime_callback.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ use datadog_crashtracker::{
1515
pub use datadog_crashtracker::RuntimeStackFrame as ddog_RuntimeStackFrame;
1616

1717
/// Result type for runtime callback registration
18+
#[cfg(unix)]
1819
#[repr(C)]
1920
#[derive(Debug, PartialEq, Eq)]
2021
pub enum CallbackResult {
2122
Ok,
2223
Error,
2324
}
2425

26+
#[cfg(unix)]
2527
impl From<CallbackError> for CallbackResult {
2628
fn from(_error: CallbackError) -> Self {
2729
CallbackResult::Error
@@ -147,7 +149,7 @@ pub unsafe extern "C" fn ddog_crasht_get_registered_callback_type() -> *const st
147149
get_registered_callback_type_ptr()
148150
}
149151

150-
#[cfg(test)]
152+
#[cfg(all(test, unix))]
151153
mod tests {
152154
use super::*;
153155
use datadog_crashtracker::{clear_runtime_callback, RuntimeStackFrame};

datadog-crashtracker/src/runtime_callback.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use ddcommon_ffi::{slice::AsBytes, CharSlice};
1111
use schemars::JsonSchema;
1212
use serde::{Deserialize, Serialize};
1313
use std::ffi::c_char;
14+
1415
#[cfg(unix)]
1516
use std::{
1617
ptr,
@@ -189,7 +190,7 @@ pub fn is_runtime_callback_registered() -> bool {
189190
/// The caller must ensure that no other thread is calling `clear_runtime_callback`
190191
/// or registration functions concurrently, as those could invalidate
191192
/// the pointer between the null check and dereferencing.
192-
#[cfg(unix)]
193+
#[cfg(all(unix, feature = "collector"))]
193194
pub(crate) unsafe fn get_registered_callback_type_internal() -> Option<&'static str> {
194195
let callback_ptr = RUNTIME_CALLBACK.load(Ordering::SeqCst);
195196
if callback_ptr.is_null() {
@@ -264,7 +265,7 @@ pub unsafe fn clear_runtime_callback() {
264265
/// - No other thread is calling `clear_runtime_callback` concurrently
265266
/// - The registered callback function is signal-safe
266267
/// - The writer parameter remains valid for the duration of the call
267-
#[cfg(unix)]
268+
#[cfg(all(unix, feature = "collector"))]
268269
pub(crate) unsafe fn invoke_runtime_callback_with_writer<W: std::io::Write>(
269270
writer: &mut W,
270271
) -> Result<(), std::io::Error> {
@@ -368,7 +369,7 @@ pub(crate) unsafe fn invoke_runtime_callback_with_writer<W: std::io::Write>(
368369
/// The caller must ensure that `frame` is either null or points to a valid, properly
369370
/// initialized RuntimeStackFrame. All C string pointers within the frame must be either
370371
/// null or point to valid, null-terminated C strings.
371-
#[cfg(unix)]
372+
#[cfg(all(unix, feature = "collector"))]
372373
unsafe fn emit_frame_as_json(
373374
writer: &mut dyn std::io::Write,
374375
frame: *const RuntimeStackFrame,
@@ -421,7 +422,7 @@ unsafe fn emit_frame_as_json(
421422
Ok(())
422423
}
423424

424-
#[cfg(all(test, unix))]
425+
#[cfg(test)]
425426
mod tests {
426427
use super::*;
427428
use std::ffi::CString;

0 commit comments

Comments
 (0)