From 6335775c58db3341981a8d0c29340bb3b2fae75a Mon Sep 17 00:00:00 2001 From: Ladislas de Toldi Date: Wed, 10 Mar 2021 10:41:31 +0100 Subject: [PATCH] Fix sys/stat.h issue for unit tests on macOS --- UNITTESTS/target_h/platform/mbed_retarget.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/UNITTESTS/target_h/platform/mbed_retarget.h b/UNITTESTS/target_h/platform/mbed_retarget.h index aea425ed7f..e99d42150a 100644 --- a/UNITTESTS/target_h/platform/mbed_retarget.h +++ b/UNITTESTS/target_h/platform/mbed_retarget.h @@ -24,6 +24,14 @@ #include +#if defined __has_include +# if __has_include () +# include +# define HAVE_SYS_STAT_H +# endif +#endif + + namespace mbed { #define NAME_MAX 255 @@ -362,7 +370,7 @@ namespace mbed { #define STDOUT_FILENO 1 #define STDERR_FILENO 2 -#ifndef _STAT_VER +#ifndef HAVE_SYS_STAT_H struct stat { dev_t st_dev; ///< Device ID containing file ino_t st_ino; ///< File serial number