From ac612b54228308756da0afd8654f503c70a1edc0 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 8 Mar 2019 15:16:26 +0800 Subject: [PATCH] newlib: enable timeradd, timersub, and similar macros This uses a hack (temporarily defining __rtems__ from a wrapper header file) to include timeradd, timersub, and similar macros, without modifying newlib headers. --- components/newlib/platform_include/sys/time.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 components/newlib/platform_include/sys/time.h diff --git a/components/newlib/platform_include/sys/time.h b/components/newlib/platform_include/sys/time.h new file mode 100644 index 0000000000..ecf3f70e74 --- /dev/null +++ b/components/newlib/platform_include/sys/time.h @@ -0,0 +1,17 @@ +#pragma once +/* Newlib sys/time.h defines timerisset, timerclear, timercmp, timeradd, timersub macros + for __CYGWIN__ and __rtems__. We want to define these macros in IDF as well. + Since we wish to use un-modified newlib headers until a patched newlib version is + available, temporarily define __rtems__ here before including sys/time.h. + __rtems__ is chosen instead of __CYGWIN__ since there are no other checks in sys/time.h + which depend on __rtems__. + + Also, so that __rtems__ define does not affect other headers included from sys/time.h, + we include them here in advance (_ansi.h and sys/types.h). + */ + +#include <_ansi.h> +#include +#define __rtems__ +#include_next +#undef __rtems__