Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1288943

Re: [PATCH v2 14/14] perf tools: Move subcommand framework and related utils to libapi

From Josh Poimboeuf <jpoimboe@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 14/14] perf tools: Move subcommand framework and related utils to libapi
Date 2015-12-10 22:40 +0100
Message-ID <qEh6q-3f7-31@gated-at.bofh.it> (permalink)
References (5 earlier) <qDMci-8ov-9@gated-at.bofh.it> <qDPjR-1RQ-43@gated-at.bofh.it> <qDS81-3Fq-1@gated-at.bofh.it> <qDZCx-8tE-9@gated-at.bofh.it> <qEaRk-7yx-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Dec 10, 2015 at 08:54:45AM -0600, Josh Poimboeuf wrote:
> On Thu, Dec 10, 2015 at 10:40:39AM +0900, Namhyung Kim wrote:
> > > - usage.c: used in several places for die() and error(), but these are
> > >   trivial functions which can be duplicated.
> > 
> > Not sure it's ok to call die() or similar in a library.  The error
> > should be reported to the caller rather than exiting inside unless
> > explicitly requested like in usage_with_options() IMHO.
> 
> Thanks, good point.  I'll try to remove all exits from the library
> (except for the explicit requests).

As it turns out, some special options like '--list-opts' and
'--list-cmds' are implemented within parse_options_subcommand(), which
then does an exit().  If those exit()'s were replaced with negative
return codes, we'd have to provide a way for callers to distinguish
between a normal early exit and a real error (in which the usage
printout might be appropriate).  That would be a disruptive change and
require the 40+ callers of the parse_options*() functions to have more
complexity (because they'd need to check for more return conditions).

So I'm thinking I'll leave the code as it is for now and just document
the fact that these functions can exit().

-- 
Josh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 00/14] perf tools: Move perf subcommand framework into lib/tools Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-08 05:30 +0100
  [PATCH v2 02/14] perf: Use -iquote for local include paths Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-08 05:30 +0100
  [PATCH v2 10/14] perf: Move cmd_version() to builtin-version.c Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-08 05:30 +0100
    [tip:perf/core] perf tools: Move cmd_version()   to builtin-version.c tip-bot for Josh Poimboeuf <tipbot@zytor.com> - 2015-12-10 09:20 +0100
  [PATCH v2 11/14] perf: Move help_unknown_cmd() to its own file Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-08 05:30 +0100
  [PATCH v2 09/14] perf: Remove check for unused PERF_PAGER_IN_USE Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-08 05:30 +0100
  [PATCH v2 06/14] perf: Split up cache.h Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-08 05:30 +0100
  [PATCH v2 04/14] perf: Move term functions out of util.c Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-08 05:30 +0100
    Re: [PATCH v2 04/14] perf: Move term functions out of util.c Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-12-09 17:00 +0100
    [tip:perf/core] perf tools: Move term functions out of util.c tip-bot for Josh Poimboeuf <tipbot@zytor.com> - 2015-12-10 09:20 +0100
  [PATCH v2 08/14] perf: Save cmdline arguments earlier Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-08 05:30 +0100
    [tip:perf/core] perf tools: Save cmdline arguments earlier tip-bot for Josh Poimboeuf <tipbot@zytor.com> - 2015-12-10 09:20 +0100
  [PATCH v2 07/14] perf: Remove cache.h Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-08 05:30 +0100
  [PATCH v2 13/14] perf tools: Move tools/lib/string.c to libapi Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-08 05:30 +0100
  Re: [PATCH v2 14/14] perf tools: Move subcommand framework and  related utils to libapi Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-08 20:20 +0100
    Re: [PATCH v2 14/14] perf tools: Move subcommand framework and  related utils to libapi Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-12-08 20:50 +0100
      Re: [PATCH v2 14/14] perf tools: Move subcommand framework and  related utils to libapi Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-08 22:50 +0100
        Re: [PATCH v2 14/14] perf tools: Move subcommand framework and  related utils to libapi Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-12-08 23:30 +0100
          Re: [PATCH v2 14/14] perf tools: Move subcommand framework and  related utils to libapi Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-09 00:10 +0100
            Re: [PATCH v2 14/14] perf tools: Move subcommand framework and  related utils to libapi Ingo Molnar <mingo@kernel.org> - 2015-12-09 09:10 +0100
              Re: [PATCH v2 14/14] perf tools: Move subcommand framework and  related utils to libapi Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-09 13:40 +0100
                Re: [PATCH v2 14/14] perf tools: Move subcommand framework and  related utils to libapi Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-12-09 17:00 +0100
                Re: [PATCH v2 14/14] perf tools: Move subcommand framework and  related utils to libapi Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-09 20:00 +0100
                Re: [PATCH v2 14/14] perf tools: Move subcommand framework and  related utils to libapi Namhyung Kim <namhyung@kernel.org> - 2015-12-10 04:00 +0100
                Re: [PATCH v2 14/14] perf tools: Move subcommand framework and  related utils to libapi Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-10 16:00 +0100
                Re: [PATCH v2 14/14] perf tools: Move subcommand framework and  related utils to libapi Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-10 22:40 +0100
                Re: [PATCH v2 14/14] perf tools: Move subcommand framework and  related utils to libapi Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-12-11 12:30 +0100
                Re: [PATCH v2 14/14] perf tools: Move subcommand framework and  related utils to libapi Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-12-10 14:00 +0100
                Re: [PATCH v2 14/14] perf tools: Move subcommand framework and  related utils to libapi Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-10 16:20 +0100
  Re: [PATCH v2 00/14] perf tools: Move perf subcommand framework into  lib/tools Namhyung Kim <namhyung@kernel.org> - 2015-12-10 05:10 +0100
    Re: [PATCH v2 00/14] perf tools: Move perf subcommand framework into  lib/tools Josh Poimboeuf <jpoimboe@redhat.com> - 2015-12-10 16:20 +0100

csiph-web