From 1f2587fe3e0da8a901be51d4999da12f0b793786 Mon Sep 17 00:00:00 2001 From: Yuval Tassa Date: Mon, 16 Mar 2026 09:03:08 -0700 Subject: [PATCH] Make preprocessor checks for `ADDRESS_SANITIZER` compatible with GCC PiperOrigin-RevId: 884468086 Change-Id: I5742f023689fd8cc1747df1af5f0a9687a0e77ac --- include/mujoco/mjsan.h | 6 +++++- src/engine/engine_crossplatform.h | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/mujoco/mjsan.h b/include/mujoco/mjsan.h index db00fb91..880dc88b 100644 --- a/include/mujoco/mjsan.h +++ b/include/mujoco/mjsan.h @@ -17,8 +17,12 @@ // Define ADDRESS_SANITIZER if implied by other macros. #if !defined(ADDRESS_SANITIZER) - #if defined(__SANITIZE_ADDRESS__) || (defined(__has_feature) && __has_feature(address_sanitizer)) + #if defined(__SANITIZE_ADDRESS__) #define ADDRESS_SANITIZER + #elif defined(__has_feature) + #if __has_feature(address_sanitizer) + #define ADDRESS_SANITIZER + #endif #endif #endif diff --git a/src/engine/engine_crossplatform.h b/src/engine/engine_crossplatform.h index 2fcebefc..ee9ad61c 100644 --- a/src/engine/engine_crossplatform.h +++ b/src/engine/engine_crossplatform.h @@ -60,8 +60,12 @@ // Define ADDRESS_SANITIZER if implied by other macros. #if !defined(ADDRESS_SANITIZER) - #if defined(__SANITIZE_ADDRESS__) || (defined(__has_feature) && __has_feature(address_sanitizer)) + #if defined(__SANITIZE_ADDRESS__) #define ADDRESS_SANITIZER + #elif defined(__has_feature) + #if __has_feature(address_sanitizer) + #define ADDRESS_SANITIZER + #endif #endif #endif