linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Christopher Li <sparse@chrisli.org>
Cc: Josh Triplett <josh@joshtriplett.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] lib.c: skip --param parameters
Date: Mon, 30 Jun 2014 11:56:52 +0300	[thread overview]
Message-ID: <1404118612.5102.4.camel@smile.fi.intel.com> (raw)
In-Reply-To: <CANeU7Qk6e-CAK_aRTzq=ev_esQ9uGsbc6ihH7m-0=ngoPotVzg@mail.gmail.com>

On Mon, 2014-06-30 at 01:51 -0700, Christopher Li wrote:
> On Mon, Jun 30, 2014 at 1:32 AM, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > Hmm... I'd just added test printf to the handle_param() and see if I
> > print *next, it is either --param or --param=*. So, using return (next +
> > 2) helps, otherwise we end up with the same situation as before patch.
> 
> The return value from handle_switch() is a bit tricky. It is actually points to
> the current args which about to be expired.
> 
> Take a look at this code which invoke the handle_switch().
>     for (;;) {
>         char *arg = *++args;      <---------------- notice the ++
> before the fetch
>         if (!arg)
>             break;
> 
>         if (arg[0] == '-' && arg[1]) {
>             args = handle_switch(arg+1, args); <-------- args return here.
>             continue;
>         }
>         add_ptr_list_notag(filelist, arg);
>     }
> 
> >
> > What did I miss?
> 
> So the caller loop will perform 1 pointer advance before fetch.
> Your code can advance 2 pointer, so that is  total 3 pointer advance.

Yeah, thanks for explanation. Just noticed this after send a message.

> 
> >
> > Which was explicitly mentioned in the commit message.
> 
> Sorry about that, I jump to the code first. I later notice that  in
> the commit message as well.
> 
> Any way, the change I push should fix all that.

Yup. Thank you.


-- 
Andy Shevchenko <andriy.shevchenko@intel.com>
Intel Finland Oy


      reply	other threads:[~2014-06-30  8:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-17  9:11 [PATCH v2 0/2] fix for --param GCC's command line option Andy Shevchenko
2014-06-17  9:11 ` [PATCH v2 1/2] lib.c: introduce split_value_from_arg helper Andy Shevchenko
2014-06-17  9:11 ` [PATCH v2 2/2] lib.c: skip --param parameters Andy Shevchenko
2014-06-28 16:23   ` Christopher Li
2014-06-28 16:59   ` Christopher Li
2014-06-29  7:19     ` Christopher Li
2014-06-29 19:01       ` Christopher Li
2014-06-30  8:32     ` Andy Shevchenko
2014-06-30  8:51       ` Christopher Li
2014-06-30  8:56         ` Andy Shevchenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1404118612.5102.4.camel@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).