summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-03-14 17:54:16 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-03-14 17:54:16 +0000
commitaff5322d8d9bf10f227507321dcc76c6b6ec9055 (patch)
tree5ec50c09a63fe359aef85d271570df5c4d37953f
parent322c1c68cb1ccd33f4a24a662bc5189fc581d7b9 (diff)
downloadnuttx-aff5322d8d9bf10f227507321dcc76c6b6ec9055.tar.gz
nuttx-aff5322d8d9bf10f227507321dcc76c6b6ec9055.tar.bz2
nuttx-aff5322d8d9bf10f227507321dcc76c6b6ec9055.zip
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
-rw-r--r--nuttx/Documentation/NuttxPortingGuide.html4
-rw-r--r--nuttx/configs/README.txt2
-rw-r--r--nuttx/lib/lib_libvsprintf.c2
-rw-r--r--nuttx/lib/lib_sscanf.c11
4 files changed, 14 insertions, 5 deletions
diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html
index 6770709ef..0d00497b9 100644
--- a/nuttx/Documentation/NuttxPortingGuide.html
+++ b/nuttx/Documentation/NuttxPortingGuide.html
@@ -2397,6 +2397,10 @@ extern void up_ledoff(int led);
<code>CONFIG_NOPRINTF_FIELDWIDTH</code>: sprintf-related logic is a
little smaller if we do not support fieldwidthes
</li>
+ <li>
+ <code>CONFIG_LIBC_FLOATINGPOINT</code>: By default, floating point
+ support in printf, sscanf, etc. is disabled.
+ </li>
</ul>
<h2>Allow for architecture optimized implementations</h2>
diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt
index 9a74324cb..863cdf52d 100644
--- a/nuttx/configs/README.txt
+++ b/nuttx/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/nuttx/lib/lib_libvsprintf.c b/nuttx/lib/lib_libvsprintf.c
index dff001545..1d28c1a6c 100644
--- a/nuttx/lib/lib_libvsprintf.c
+++ b/nuttx/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/nuttx/lib/lib_sscanf.c b/nuttx/lib/lib_sscanf.c
index b02515da7..c6110bdb0 100644
--- a/nuttx/lib/lib_sscanf.c
+++ b/nuttx/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++;
}