mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Jiri Olsa <jolsa@redhat.com>, David Ahern <dsahern@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Hemant Kumar <hemant@linux.vnet.ibm.com>
Subject: Re: [PATCH 4/5] perf tools: Add support for exclusive option
Date: Thu, 23 Oct 2014 17:29:48 -0300	[thread overview]
Message-ID: <20141023202948.GK14687@kernel.org> (raw)
In-Reply-To: <54488C84.3040408@hitachi.com>

Em Thu, Oct 23, 2014 at 02:05:08PM +0900, Masami Hiramatsu escreveu:
> (2014/10/23 0:15), Namhyung Kim wrote:
> > Some options cannot be used at the same time.  To handle such options
> > add a new PARSE_OPT_EXCLUSIVE flag and show error message if more than
> > one of them is used.
> 
> Looks useful for me :)
> 
> Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> 
> I just have a comment below;
> 
> > @@ -360,19 +378,21 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
> >  		}
> >  
> >  		if (arg[1] != '-') {
> > -			ctx->opt = arg + 1;
> > +			ctx->opt = ++arg;
> >  			if (internal_help && *ctx->opt == 'h')
> >  				return usage_with_options_internal(usagestr, options, 0);
> >  			switch (parse_short_opt(ctx, options)) {
> >  			case -1:
> > -				return parse_options_usage(usagestr, options, arg + 1, 1);
> > +				return parse_options_usage(usagestr, options, arg, 1);
> >  			case -2:
> >  				goto unknown;
> > +			case -3:
> > +				goto exclusive;
> 
> BTW, it may be a time to define return error codes.

Yeah, this thing looks unnecessarily complicated :-\

  reply	other threads:[~2014-10-23 20:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-22 15:15 [PATCHSET 0/5] perf tools: option parsing improvement Namhyung Kim
2014-10-22 15:15 ` [PATCH 1/5] perf tools: Add PARSE_OPT_DISABLED flag Namhyung Kim
2014-10-30  6:43   ` [tip:perf/core] " tip-bot for Namhyung Kim
2014-10-22 15:15 ` [PATCH 2/5] perf tools: Export usage string and option table of perf record Namhyung Kim
2014-10-30  6:44   ` [tip:perf/core] " tip-bot for Namhyung Kim
2014-10-22 15:15 ` [PATCH 3/5] perf kvm: Print kvm specific --help output Namhyung Kim
2014-10-30  6:44   ` [tip:perf/core] " tip-bot for Namhyung Kim
2014-10-22 15:15 ` [PATCH 4/5] perf tools: Add support for exclusive option Namhyung Kim
2014-10-23  5:05   ` Masami Hiramatsu
2014-10-23 20:29     ` Arnaldo Carvalho de Melo [this message]
2014-10-24  0:40       ` Namhyung Kim
2014-10-30  6:44   ` [tip:perf/core] " tip-bot for Namhyung Kim
2014-10-22 15:15 ` [PATCH 5/5] perf probe: Use PARSE_OPT_EXCLUSIVE flag Namhyung Kim
2014-10-23  5:00   ` Masami Hiramatsu
2014-10-30  6:44   ` [tip:perf/core] " tip-bot for Namhyung Kim
2014-10-23  3:06 ` [PATCHSET 0/5] perf tools: option parsing improvement Hemant Kumar
2014-10-23 20:33 ` Arnaldo Carvalho de Melo

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=20141023202948.GK14687@kernel.org \
    --to=acme@kernel.org \
    --cc=dsahern@gmail.com \
    --cc=hemant@linux.vnet.ibm.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.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

Powered by JetHome