Hans Petter Selasky schrieb:
On Monday 09 February 2009, Christoph Mallon wrote:
Hans Petter Selasky schrieb:
On Monday 09 February 2009, Christoph Mallon wrote:
Christoph Mallon schrieb:
are named "err" or "error". This should be investigated, so here's the
complete list:
Sorry, my MUA seems to have damaged the list. You can get the list here:
http://tron.homeunix.org/usb2.unread.log
I think some of these errors depend if you have USB debugging compiled or
not. At least GCC does not warn?
No, it does not depend on USB debugging.
GCC has no warning at all for variables which are only assigned to.
It only can warn about variables, which are only initialised.

{
   int x = 23; // GCC warns here ...
   int y;      // ... but not here - cparser does
   y = 42;
   y++;
}

cparser has an analysis, which can warn about "y", too.

I manually verified all 40 warnings and I cannot find any users (i.e.
readers) for these variables.

What is the correct way to discard the return argument of a function? That's basically what most of the warnings are about.

1) (void)my_fn() cast
2) if (my_fn()) { }
3) err = my_fn();
4) my_fn();

Just to understand this correctly: You want to discard error codes?


Basically I see four categories:

1) Getting the softc and not using it.
This can be removed completely.
Example:
  sc = ATMEGA_BUS2SC(xfer->xroot->bus);

2) calling mtx_owned() and discarding the return value.
Can be removed, too, after checking that the value is really unnecessary.
Example:
  use_polling = mtx_owned(xfer->xroot->xfer_mtx) ? 1 : 0;

3) Getting some value and not using it.
Can be removed, too, after checking that the value is really unnecessary.
Example:
  ep_no = (xfer->endpoint & UE_ADDR);

4) The rest are return values of functions, which contain error codes.
Discarding them is questionable at best.
Example: (err is not read)
    if (udev->flags.suspended) {
      err = DEVICE_SUSPEND(iface->subdev);
      device_printf(iface->subdev, "Suspend failed\n");
    }
    return (0);   /* success */
_______________________________________________
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"

Reply via email to