From 62b6ed9689f8cd5924be64cc86e38e50fcb9527f Mon Sep 17 00:00:00 2001 From: Nuno Marques Date: Thu, 7 May 2026 17:51:23 -0700 Subject: [PATCH] fix(windows-shim): widen pthread.h MSVC gate to include clang-cl The MSVC-only branch of the pthread shim was gated on `_MSC_VER && !defined(__clang__)`, which excluded clang-cl. Under clang-cl on the MSVC environment that meant the `#else` branch ran and tried to forward to a real `` via `#include_next`, but clang-cl has no winpthreads on its search path so the include failed with `'pthread.h' file not found`. Widen the gate to `defined(_MSC_VER)` so clang-cl uses the same from-scratch shim as MSVC. Only true MinGW (where `_MSC_VER` is not defined) keeps the `#include_next` forward to winpthreads. Same change applied to the inner gate on `px4_pthread_cond_notify_callback_t` for consistency. Signed-off-by: Nuno Marques --- platforms/posix/include/windows_shim/pthread.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platforms/posix/include/windows_shim/pthread.h b/platforms/posix/include/windows_shim/pthread.h index 74071408c3..653fc0004d 100644 --- a/platforms/posix/include/windows_shim/pthread.h +++ b/platforms/posix/include/windows_shim/pthread.h @@ -42,7 +42,7 @@ */ #pragma once -#if defined(_MSC_VER) && !defined(__clang__) +#if defined(_MSC_VER) #include #include #include @@ -178,7 +178,7 @@ int pthread_cond_signal(pthread_cond_t *cond); int pthread_cond_broadcast(pthread_cond_t *cond); /** @} */ -#if defined(_MSC_VER) && !defined(__clang__) +#if defined(_MSC_VER) typedef void (*px4_pthread_cond_notify_callback_t)(pthread_cond_t *cond, int broadcast); int px4_pthread_cond_set_notify_callback(px4_pthread_cond_notify_callback_t callback); #endif