On 06/13/12 12:50, Paolo Bonzini wrote:
> Il 13/06/2012 10:22, Laszlo Ersek ha scritto:
>> +static void
>> +opts_type_uint64(Visitor *v, uint64_t *obj, const char *name, Error **errp)
>> +{
>> + OptsVisitor *ov = DO_UPCAST(OptsVisitor, visitor, v);
>> + const QemuOpt *opt;
>> + const char *str;
>> +
>> + opt = lookup_scalar(ov, name, errp);
>> + if (!opt) {
>> + return;
>> + }
>> +
>> + str = opt->str;
>> + if (str != NULL) {
>> + while (isspace((unsigned char)*str)) {
>> + ++str;
>> + }
>> +
>> + if (*str != '-' && *str != '\0') {
>> + unsigned long long val;
>> + char *endptr;
>> +
>> + /* non-empty, non-negative subject sequence */
>> + errno = 0;
>> + val = strtoull(str, &endptr, 0);
>> + if (*endptr == '\0' && errno == 0 && val <= UINT64_MAX) {
>
> I would have expected a warning from GCC here, but obviously that's not
> the case?
Right, same surprise here. Maybe gcc has seen the light and it realizes
now "long long" can be wider than 64 bits, theoretically.
Thanks for the review!
Laszlo