From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966038AbbLRIxN (ORCPT ); Fri, 18 Dec 2015 03:53:13 -0500 Received: from terminus.zytor.com ([198.137.202.10]:51950 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965192AbbLRIxL (ORCPT ); Fri, 18 Dec 2015 03:53:11 -0500 Date: Fri, 18 Dec 2015 00:52:40 -0800 From: tip-bot for Josh Poimboeuf Message-ID: Cc: peterz@infradead.org, tglx@linutronix.de, acme@redhat.com, linux-kernel@vger.kernel.org, mingo@kernel.org, namhyung@kernel.org, jolsa@redhat.com, hpa@zytor.com, jpoimboe@redhat.com Reply-To: jolsa@redhat.com, jpoimboe@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org, acme@redhat.com, namhyung@kernel.org, mingo@kernel.org, tglx@linutronix.de, peterz@infradead.org In-Reply-To: <97b1af06cc3b18dd0f49e655d6d659eaa64ecde5.1450193761.git.jpoimboe@redhat.com> References: <97b1af06cc3b18dd0f49e655d6d659eaa64ecde5.1450193761.git.jpoimboe@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf tools: Document the fact that parse_options* () may exit Git-Commit-ID: 24a88bdd05d5de32f3a56a4dcc5070c97d4a514f X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 24a88bdd05d5de32f3a56a4dcc5070c97d4a514f Gitweb: http://git.kernel.org/tip/24a88bdd05d5de32f3a56a4dcc5070c97d4a514f Author: Josh Poimboeuf AuthorDate: Tue, 15 Dec 2015 09:39:34 -0600 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 16 Dec 2015 16:16:49 -0300 perf tools: Document the fact that parse_options*() may exit Generally, calling exit() from a library is bad practice. Eventually these functions might be redesigned so that they don't exit. For now, just document the fact that they do. Signed-off-by: Josh Poimboeuf Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/97b1af06cc3b18dd0f49e655d6d659eaa64ecde5.1450193761.git.jpoimboe@redhat.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/parse-options.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/util/parse-options.h b/tools/perf/util/parse-options.h index 1231960..d1544069 100644 --- a/tools/perf/util/parse-options.h +++ b/tools/perf/util/parse-options.h @@ -152,6 +152,9 @@ struct option { /* parse_options() will filter out the processed options and leave the * non-option argments in argv[]. * Returns the number of arguments left in argv[]. + * + * NOTE: parse_options() and parse_options_subcommand() may call exit() in the + * case of an error (or for 'special' options like --list-cmds or --list-opts). */ extern int parse_options(int argc, const char **argv, const struct option *options,