qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

util/cutils: Turn FIXME comment into QEMU_BUILD_BUG_ON()

qemu_strtoi64() assumes int64_t is long long. This is marked FIXME.
Replace by a QEMU_BUILD_BUG_ON() to avoid surprises.

Same for qemu_strtou64().

Fix a typo in qemu_strtoul()'s contract while there.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191125133846.27790-2-armbru@redhat.com>
[lv: removed trailing whitespace]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>

authored by

Markus Armbruster and committed by
Laurent Vivier
369276eb f8b345e4

+5 -3
+5 -3
util/cutils.c
··· 542 542 * Convert string @nptr to an int64_t. 543 543 * 544 544 * Works like qemu_strtol(), except it stores INT64_MAX on overflow, 545 - * and INT_MIN on underflow. 545 + * and INT64_MIN on underflow. 546 546 */ 547 547 int qemu_strtoi64(const char *nptr, const char **endptr, int base, 548 548 int64_t *result) ··· 557 557 return -EINVAL; 558 558 } 559 559 560 + /* This assumes int64_t is long long TODO relax */ 561 + QEMU_BUILD_BUG_ON(sizeof(int64_t) != sizeof(long long)); 560 562 errno = 0; 561 - /* FIXME This assumes int64_t is long long */ 562 563 *result = strtoll(nptr, &ep, base); 563 564 return check_strtox_error(nptr, ep, endptr, errno); 564 565 } ··· 581 582 return -EINVAL; 582 583 } 583 584 585 + /* This assumes uint64_t is unsigned long long TODO relax */ 586 + QEMU_BUILD_BUG_ON(sizeof(uint64_t) != sizeof(unsigned long long)); 584 587 errno = 0; 585 - /* FIXME This assumes uint64_t is unsigned long long */ 586 588 *result = strtoull(nptr, &ep, base); 587 589 /* Windows returns 1 for negative out-of-range values. */ 588 590 if (errno == ERANGE) {