Add config to enable floating point support

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2542 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2010-03-14 17:54:16 +00:00
parent dabb0c8f8e
commit 2915dbf9c2
4 changed files with 14 additions and 5 deletions

View File

@ -2397,6 +2397,10 @@ extern void up_ledoff(int led);
<code>CONFIG_NOPRINTF_FIELDWIDTH</code>: sprintf-related logic is a <code>CONFIG_NOPRINTF_FIELDWIDTH</code>: sprintf-related logic is a
little smaller if we do not support fieldwidthes little smaller if we do not support fieldwidthes
</li> </li>
<li>
<code>CONFIG_LIBC_FLOATINGPOINT</code>: By default, floating point
support in printf, sscanf, etc. is disabled.
</li>
</ul> </ul>
<h2>Allow for architecture optimized implementations</h2> <h2>Allow for architecture optimized implementations</h2>

View File

@ -282,6 +282,8 @@ defconfig -- This is a configuration file similar to the Linux
CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a
little smaller if we do not support fieldwidthes 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 Allow for architecture optimized implementations

View File

@ -1465,12 +1465,14 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, const char *src, va_list ap)
/* Handle floating point conversions */ /* Handle floating point conversions */
#ifdef CONFIG_LIBC_FLOATINGPOINT
else if (strchr("eEfgG", *src)) else if (strchr("eEfgG", *src))
{ {
#ifdef CONFIG_CPP_HAVE_WARNING #ifdef CONFIG_CPP_HAVE_WARNING
# warning "No floating point support" # warning "No floating point support"
#endif #endif
} }
#endif
} }
return obj->nput; return obj->nput;

View File

@ -260,10 +260,9 @@ int vsscanf(char *buf, const char *s, va_list ap)
else if (*s == 'f') else if (*s == 'f')
{ {
#if 1 #ifndef CONFIG_LIBC_FLOATINGPOINT
# ifdef CONFIG_CPP_HAVE_WARNING /* No floating point conversions */
# warning "No floating point conversions"
# endif
void *pv = va_arg(ap, void*); void *pv = va_arg(ap, void*);
lvdbg("vsscanf: Return 0.0 to %p\n", pv); 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) if (!noassign)
{
count++; count++;
}
width = noassign = lflag = 0; width = noassign = lflag = 0;
s++; s++;
} }