Re: [PATCH v3 11/11] built-in add -i: implement the `help` command

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

 



On Fri, Aug 02, 2019 at 02:04:09PM -0700, Junio C Hamano wrote:

> > +static int run_help(struct add_i_state *s, const struct pathspec *ps,
> > +		    struct file_list *files, struct list_options *opts)
> [...]
> 
> As we do not allow the command names to get translated, this makes
> sense.
> 
> Have we adopted the convention to name callback parameters that have
> to stay unused (because the callback function must have a function
> signature that accepts the union of what everybody needs to take)
> differently from the parameters that actually get used?  It may make
> sense to use it in a function like this, to prevent readers from
> wasting time by wondering how pathspec is used in this function, for
> example.

I haven't yet[1] polished up the remainder of my patches to make us
-Wunused-parameter clean, but the pattern there would look like:

  void some_function(const char *foo, void *UNUSED(bar))
  {
     ... use foo but not bar ...
  }

which both tells the compiler that "bar" may be unused, and renames it
behind the scenes to unused_bar so that it cannot be accidentally used
(or more importantly, so that we can drop the annotation when it does
get used).

All of which is to say that I'm fine if you call it "unused_bar"
manually for now, but I'd switch it to the above in my series. So it may
not matter all that much in the meantime.

-Peff

[1] The sticking point is a few more cases I found where it's unclear to
    me whether they should be marked, or if it's a latent bug.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux