diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html index 6770709efb..0d00497b9c 100644 --- a/Documentation/NuttxPortingGuide.html +++ b/Documentation/NuttxPortingGuide.html @@ -2397,6 +2397,10 @@ extern void up_ledoff(int led); CONFIG_NOPRINTF_FIELDWIDTH: sprintf-related logic is a little smaller if we do not support fieldwidthes +
  • + CONFIG_LIBC_FLOATINGPOINT: By default, floating point + support in printf, sscanf, etc. is disabled. +
  • Allow for architecture optimized implementations

    diff --git a/configs/README.txt b/configs/README.txt index 9a74324cb5..863cdf52d6 100644 --- a/configs/README.txt +++ b/configs/README.txt @@ -282,6 +282,8 @@ defconfig -- This is a configuration file similar to the Linux CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a little smaller if we do not support fieldwidthes + CONFIG_LIBC_FLOATINGPOINT - By default, floating point + support in printf, sscanf, etc. is disabled. Allow for architecture optimized implementations diff --git a/lib/lib_libvsprintf.c b/lib/lib_libvsprintf.c index dff0015457..1d28c1a6c6 100644 --- a/lib/lib_libvsprintf.c +++ b/lib/lib_libvsprintf.c @@ -1465,12 +1465,14 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, const char *src, va_list ap) /* Handle floating point conversions */ +#ifdef CONFIG_LIBC_FLOATINGPOINT else if (strchr("eEfgG", *src)) { #ifdef CONFIG_CPP_HAVE_WARNING # warning "No floating point support" #endif } +#endif } return obj->nput; diff --git a/lib/lib_sscanf.c b/lib/lib_sscanf.c index b02515da7d..c6110bdb0b 100644 --- a/lib/lib_sscanf.c +++ b/lib/lib_sscanf.c @@ -260,10 +260,9 @@ int vsscanf(char *buf, const char *s, va_list ap) else if (*s == 'f') { -#if 1 -# ifdef CONFIG_CPP_HAVE_WARNING -# warning "No floating point conversions" -# endif +#ifndef CONFIG_LIBC_FLOATINGPOINT + /* No floating point conversions */ + void *pv = va_arg(ap, void*); lvdbg("vsscanf: Return 0.0 to %p\n", pv); @@ -331,7 +330,9 @@ int vsscanf(char *buf, const char *s, va_list ap) } if (!noassign) - count++; + { + count++; + } width = noassign = lflag = 0; s++; }