libc: improve libc dependencies in case of LIBM_NONE

Currently the code for strtof, strtod and strtold is in the list
of files to compile unconditionally, but when trying to compile
kernel with toolchain without libm support (LIBM_NONE=y) compilation
fails because code refers math.h

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko
2025-12-14 17:29:31 +01:00
committed by Alan C. Assis
parent 8c8a7484ab
commit 11dc1df189
3 changed files with 30 additions and 13 deletions
+18 -8
View File
@@ -44,6 +44,18 @@
# undef CONFIG_LIBC_LONG_LONG
#endif
#ifdef CONFIG_LIBC_SCANSET
# define SCANSET_MODS "["
#else
# define SCANSET_MODS
#endif
#ifdef CONFIG_LIBC_FLOATINGPOINT
# define FLOATINGPOINT_MODS "aAfFeEgG"
#else
# define FLOATINGPOINT_MODS
#endif
#define MAXLN 128
#define HH_MOD -2
@@ -297,11 +309,10 @@ static int vscanf_internal(FAR struct lib_instream_s *stream, FAR int *lastc,
fmt++;
for (; fmt_char(fmt); fmt++)
{
#ifdef CONFIG_LIBC_SCANSET
if (strchr("diboupxXcseEfFgGaAn[%", fmt_char(fmt)))
#else
if (strchr("diboupxXcseEfFgGaAn%", fmt_char(fmt)))
#endif
if (strchr("diboupxXcsn"
FLOATINGPOINT_MODS
SCANSET_MODS
"%", fmt_char(fmt)))
{
if (fmt_char(fmt) != '%')
{
@@ -936,6 +947,7 @@ static int vscanf_internal(FAR struct lib_instream_s *stream, FAR int *lastc,
}
}
#ifdef CONFIG_LIBC_FLOATINGPOINT
/* Process %a, %A, %f, %F, %e, %E, %g, and %G: Floating point
* conversions.
*/
@@ -977,8 +989,6 @@ static int vscanf_internal(FAR struct lib_instream_s *stream, FAR int *lastc,
#endif
}
#ifdef CONFIG_LIBC_FLOATINGPOINT
/* Skip over any white space before the real string */
while (isspace(c))
@@ -1138,8 +1148,8 @@ static int vscanf_internal(FAR struct lib_instream_s *stream, FAR int *lastc,
count++;
}
#endif
}
#endif
/* Process %n: Character count */