From e93cb86903d54f463aed2a5e7f6fb3dbf1636b77 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 1 Feb 2018 07:37:16 -0600 Subject: [PATCH] libc/stdio: in dtoa(), up_interrupt_context() is used in a debug assertion. up_interrupt_context() is not available in the user-mode phase of the PROTECTED or KERNEL build configurations. In those configurations, enabling libc floating point support and debug assertions will result in an undefined reference to up_interrupt_context(). --- libc/stdio/lib_libdtoa.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libc/stdio/lib_libdtoa.c b/libc/stdio/lib_libdtoa.c index 6dff3bc0e9..80c9723d15 100644 --- a/libc/stdio/lib_libdtoa.c +++ b/libc/stdio/lib_libdtoa.c @@ -138,6 +138,7 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec, int dsgn; /* Unused sign indicator */ int i; +#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) /* This function may *NOT* be called within interrupt level logic. That is * because the logic in __dtoa may attempt to allocate memory. That will * lead to cryptic failures down the road within the memory manager. @@ -146,6 +147,7 @@ static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec, */ DEBUGASSERT(up_interrupt_context() == false); +#endif /* Special handling for NaN and Infinity */