boards: posix: fix double promotion warnings

With -Wdouble-promotion added to the warning base, posix gives warnings
when compiled with this on. Cast the constants to long doubles, and the
print %f variable to a double.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
This commit is contained in:
Ryan McClelland 2021-10-03 10:40:57 -07:00 committed by Christopher Friedt
commit a612fbd1dc
3 changed files with 7 additions and 7 deletions

View file

@ -213,7 +213,7 @@ void cmd_args_set_defaults(struct args_struct_t args_struct[])
*(int64_t *)args_struct[count].dest = INT64_MAX;
break;
case 'd':
*(double *)args_struct[count].dest = NAN;
*(double *)args_struct[count].dest = (double)NAN;
break;
default:
posix_print_error_and_exit(CMD_TYPE_ERROR,

View file

@ -114,7 +114,7 @@ static void hwm_sleep_until_next_timer(void)
if (signaled_end || (simu_time > end_of_time)) {
posix_print_trace("\nStopped at %.3Lfs\n",
((long double)simu_time)/1.0e6);
((long double)simu_time)/1.0e6L);
posix_exit(0);
}
}

View file

@ -401,12 +401,12 @@ void hwtimer_get_pseudohost_rtc_time(uint32_t *nsec, uint64_t *sec)
uint32_t rt_ns = tv.tv_nsec % 1000;
long double drt_us = (long double)rt_us - last_radj_rtime;
long double drt_ns = drt_us * 1000.0 + (long double)rt_ns;
long double st = drt_ns * clock_ratio +
(long double)(last_radj_stime + rtc_offset) * 1000.0;
long double drt_ns = drt_us * 1000.0L + (long double)rt_ns;
long double st = drt_ns * (long double)clock_ratio +
(long double)(last_radj_stime + rtc_offset) * 1000.0L;
*nsec = fmodl(st, 1e9);
*sec = st / 1e9;
*nsec = fmodl(st, 1e9L);
*sec = st / 1e9L;
}
static struct {