Various fixes to get a clean compile with the SDCC compiler. Compile is 'almost' clean.

This commit is contained in:
Gregory Nutt
2019-06-03 16:53:11 -06:00
parent fd4436f559
commit 7ab149d8e9
19 changed files with 136 additions and 46 deletions
+8 -8
View File
@@ -142,14 +142,14 @@ static FAR bigint_t *g_freelist[KMAX + 1];
static FAR bigint_t *g_p5s;
#ifdef IEEE_ARITH
static const double g_bigtens[] =
static const double_t g_bigtens[] =
{
1e16, 1e32, 1e64, 1e128, 1e256
};
# define n_bigtens 5
#else
static const double g_bigtens[] =
static const double_t g_bigtens[] =
{
1e16, 1e32
};
@@ -767,7 +767,7 @@ static FAR bigint_t *diff(FAR bigint_t *a, FAR bigint_t *b)
return c;
}
static FAR bigint_t *d2b(double d, int *e, int *bits)
static FAR bigint_t *d2b(double_t d, int *e, int *bits)
{
FAR bigint_t *b;
FAR unsigned long *x;
@@ -900,7 +900,7 @@ static FAR bigint_t *d2b(double d, int *e, int *bits)
return b;
}
static const double tens[] =
static const double_t tens[] =
{
1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
@@ -1082,7 +1082,7 @@ static int quorem(FAR bigint_t *b, FAR bigint_t *s)
* calculation.
*/
FAR char *__dtoa(double d, int mode, int ndigits, FAR int *decpt,
FAR char *__dtoa(double_t d, int mode, int ndigits, FAR int *decpt,
FAR int *sign, FAR char **rve)
{
/* Arguments ndigits, decpt, sign are similar to those of ecvt and fcvt;
@@ -1120,9 +1120,9 @@ FAR char *__dtoa(double d, int mode, int ndigits, FAR int *decpt,
FAR bigint_t *s;
FAR char *st;
FAR char *st0;
double d2;
double ds;
double eps;
double_t d2;
double_t ds;
double_t eps;
long l;
unsigned long x;
int denorm;
+3 -2
View File
@@ -39,6 +39,7 @@
#include <nuttx/compiler.h>
#include <sys/types.h>
#include <wchar.h>
#include <stdint.h>
#include <stdbool.h>
@@ -505,7 +506,7 @@ static int getusize(uint8_t fmt, uint16_t flags, unsigned int n)
****************************************************************************/
#ifdef CONFIG_LIBC_FLOATINGPOINT
static int getdblsize(uint8_t fmt, int trunc, uint16_t flags, double n)
static int getdblsize(uint8_t fmt, int trunc, uint16_t flags, double_t n)
{
struct lib_outstream_s nulloutstream;
lib_nulloutstream(&nulloutstream);
@@ -1561,7 +1562,7 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, FAR const IPTR char *src,
#ifdef CONFIG_LIBC_FLOATINGPOINT
else if (strchr("eEfgG", FMT_CHAR))
{
double dblval = va_arg(ap, double);
double_t dblval = va_arg(ap, double_t);
int dblsize;
if (FMT_CHAR == 'g' || FMT_CHAR == 'G')
+4 -3
View File
@@ -37,6 +37,7 @@
* Included Files
****************************************************************************/
#include <sys/types.h>
#include "lib_dtoa_engine.h"
/****************************************************************************
@@ -68,7 +69,7 @@
* Public Data
****************************************************************************/
const double g_dtoa_scale_up[] =
const double_t g_dtoa_scale_up[] =
{
#if DBL_MAX_10_EXP >= 1
1e1,
@@ -123,7 +124,7 @@ const double g_dtoa_scale_up[] =
#endif
};
const double g_dtoa_scale_down[] =
const double_t g_dtoa_scale_down[] =
{
#if DBL_MIN_10_EXP <= -1
1e-1,
@@ -178,7 +179,7 @@ const double g_dtoa_scale_down[] =
#endif
};
const double g_dtoa_round[] =
const double_t g_dtoa_round[] =
{
#if DBL_DIG >= 30
5e30,
+3 -2
View File
@@ -37,6 +37,7 @@
* Included Files
****************************************************************************/
#include <sys/types.h>
#include <math.h>
#include "lib_dtoa_engine.h"
@@ -63,7 +64,7 @@
* Public Functions
****************************************************************************/
int __dtoa_engine(double x, FAR struct dtoa_s *dtoa, int max_digits,
int __dtoa_engine(double_t x, FAR struct dtoa_s *dtoa, int max_digits,
int max_decimals)
{
int32_t exp = 0;
@@ -92,7 +93,7 @@ int __dtoa_engine(double x, FAR struct dtoa_s *dtoa, int max_digits,
}
else
{
double y;
double_t y;
exp = MIN_MANT_EXP;
+7 -4
View File
@@ -40,9 +40,12 @@
* Included Files
****************************************************************************/
#include <sys/types.h>
#include <stdint.h>
#include <float.h>
#include <nuttx/lib/float.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -175,15 +178,15 @@ struct dtoa_s
* Public Data
****************************************************************************/
extern const double g_dtoa_scale_up[];
extern const double g_dtoa_scale_down[];
extern const double g_dtoa_round[];
extern const double_t g_dtoa_scale_up[];
extern const double_t g_dtoa_scale_down[];
extern const double_t g_dtoa_round[];
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
int __dtoa_engine(double x, FAR struct dtoa_s *dtoa, int max_digits,
int __dtoa_engine(double_t x, FAR struct dtoa_s *dtoa, int max_digits,
int max_decimals);
#endif /* __LIBS_LIBC_STDIO_LIB_DTOA_ENGINE_H */
+2 -1
View File
@@ -46,6 +46,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdbool.h>
#include <math.h>
#include <assert.h>
@@ -158,7 +159,7 @@ static void lib_dtoa_string(FAR struct lib_outstream_s *obj, const char *str)
****************************************************************************/
static void lib_dtoa(FAR struct lib_outstream_s *obj, int fmt, int prec,
uint16_t flags, double value)
uint16_t flags, double_t value)
{
FAR char *digits; /* String returned by __dtoa */
FAR char *rve; /* Points to the end of the return value */
+8 -7
View File
@@ -43,6 +43,7 @@
#include <sys/types.h>
#include <sys/types.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdbool.h>
@@ -917,7 +918,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
else if (strchr("aAfFeEgG", *fmt) != NULL)
{
#ifdef CONFIG_HAVE_DOUBLE
FAR double *pd = NULL;
FAR double_t *pd = NULL;
#endif
FAR float *pf = NULL;
@@ -937,7 +938,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
#ifdef CONFIG_HAVE_DOUBLE
if (modifier >= L_MOD)
{
pd = va_arg(ap, FAR double *);
pd = va_arg(ap, FAR double_t *);
*pd = 0.0;
}
else
@@ -970,7 +971,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
bool stopconv;
int errsave;
# ifdef CONFIG_HAVE_DOUBLE
double dvalue;
double_t dvalue;
# endif
float fvalue;
@@ -1055,7 +1056,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
# ifdef CONFIG_HAVE_DOUBLE
if (modifier >= L_MOD)
{
/* Get the converted double value */
/* Get the converted double_t value */
dvalue = strtod(tmp, &endptr);
}
@@ -1079,13 +1080,13 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
{
/* We have to check whether we need to return a float or
* a double.
* a double_t.
*/
# ifdef CONFIG_HAVE_DOUBLE
if (modifier >= L_MOD)
{
/* Return the double value */
/* Return the double_t value */
linfo("Return %f to %p\n", dvalue, pd);
*pd = dvalue;
@@ -1095,7 +1096,7 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
{
/* Return the float value */
linfo("Return %f to %p\n", (double)fvalue, pf);
linfo("Return %f to %p\n", (double_t)fvalue, pf);
*pf = fvalue;
}
+8 -7
View File
@@ -42,6 +42,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@@ -131,7 +132,7 @@ struct arg
#ifdef CONFIG_LIBC_LONG_LONG
unsigned long long ull;
#endif
double d;
double_t d;
FAR char *cp;
} value;
};
@@ -493,7 +494,7 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream,
}
else if (c >= 'e' && c <= 'g')
{
double value;
double_t value;
int exp; /* Exponent of master decimal digit */
int n;
uint8_t sign; /* Sign character (or 0) */
@@ -542,14 +543,14 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream,
}
else
{
value = va_arg(ap, double);
value = va_arg(ap, double_t);
}
#else
value = va_arg(ap, double);
value = va_arg(ap, double_t);
#endif
ndigs = __dtoa_engine(value, &_dtoa, ndigs,
ndecimal);
ndecimal);
exp = _dtoa.exp;
sign = 0;
@@ -812,7 +813,7 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream,
#else /* !CONFIG_LIBC_FLOATINGPOINT */
if ((c >= 'E' && c <= 'G') || (c >= 'e' && c <= 'g'))
{
(void)va_arg(ap, double);
(void)va_arg(ap, double_t);
pnt = "*float*";
size = sizeof("*float*") - 1;
goto str_lpad;
@@ -1228,7 +1229,7 @@ int lib_vsprintf(FAR struct lib_outstream_s *stream,
break;
case TYPE_DOUBLE:
arglist[i].value.d = va_arg(ap, double);
arglist[i].value.d = va_arg(ap, double_t);
break;
case TYPE_CHAR_POINTER: