Make our "__builtin_va_arg()" thing a bit closer to real.
[smatch.git] / compat-solaris.c
blobd8fa1d9e8db9d4ab8a3aefcf049eef1ebb6f05e3
1 #include "lib.h"
3 #include "compat/id-files-stat.c"
4 #include "compat/mmap-blob.c"
7 #include <floatingpoint.h>
8 #include <limits.h>
9 #include <errno.h>
11 long double string_to_ld(const char *str, char **endptr)
13 long double res;
14 decimal_record dr;
15 enum decimal_string_form form;
16 decimal_mode dm;
17 fp_exception_field_type excp;
18 char *echar;
20 string_to_decimal ((char **)&str, INT_MAX, 0,
21 &dr, &form, &echar);
22 if (endptr) *endptr = (char *)str;
24 if (form == invalid_form) {
25 errno = EINVAL;
26 return 0.0;
29 dm.rd = fp_nearest;
30 decimal_to_quadruple (&res, &dm, &dr, &excp);
31 if (excp & ((1 << fp_overflow) | (1 << fp_underflow)))
32 errno = ERANGE;
33 return res;