qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/6] hw/usb/quirks: Use smaller types to reduce .rodata by 10


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 3/6] hw/usb/quirks: Use smaller types to reduce .rodata by 10KiB
Date: Thu, 5 Mar 2020 11:49:20 +0100

On Thu, Mar 5, 2020 at 11:41 AM Philippe Mathieu-Daudé
<address@hidden> wrote:
> On 3/5/20 9:02 AM, Gerd Hoffmann wrote:
> >>   struct usb_device_id {
> >> -    int vendor_id;
> >> -    int product_id;
> >> -    int interface_class;
> >> -    int interface_subclass;
> >> -    int interface_protocol;
> >> +    int16_t vendor_id;
> >> +    int16_t product_id;
> >> +    int8_t interface_class;
> >> +    int8_t interface_subclass;
> >> +    int8_t interface_protocol;
> >
> > I guess we should better use the uint variants here ...
>
> I tried it first but I got:
>
>    CC      hw/usb/quirks.o
> hw/usb/quirks.c:25:34: error: result of comparison of constant -1 with
> expression of type 'const uint16_t' (aka 'const unsigned short') is
> always true [-Werror,-Wtautological-constant-out-of-range-compare]
>      for (i = 0; ids[i].vendor_id != -1; i++) {
>                  ~~~~~~~~~~~~~~~~ ^  ~~
> hw/usb/quirks.c:28:37: error: result of comparison of constant -1 with
> expression of type 'const uint8_t' (aka 'const unsigned char') is always
> false [-Werror,-Wtautological-constant-out-of-range-compare]
>              (ids[i].interface_class == -1 ||
>               ~~~~~~~~~~~~~~~~~~~~~~ ^  ~~
>
> And went this less intrusive way.
>
> I'll respin with s/-1/UINT8_MAX/.

Problem, now this entry is ignored (interface_class==-1):

    { USB_DEVICE_AND_INTERFACE_INFO(MICROCHIP_VID, MICROCHIP_USB_BOARD_PID,
                                    0xff, 0xff, 0x00) },




reply via email to

[Prev in Thread] Current Thread [Next in Thread]