From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by sourceware.org (Postfix) with ESMTPS id BA40A3858D39 for ; Tue, 9 Nov 2021 10:18:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BA40A3858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=seketeli.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org Received: (Authenticated sender: dodji@seketeli.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 92B8310000A; Tue, 9 Nov 2021 10:18:24 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id CB2405802B4; Tue, 9 Nov 2021 11:18:23 +0100 (CET) From: Dodji Seketeli To: tangmeng Cc: libabigail@sourceware.org Subject: Re: [PATCH v2] abicompat: Add prompt message for abnormal operation Organization: Me, myself and I References: <20211105093828.15377-1-tangmeng@uniontech.com> X-Operating-System: Fedora 36 X-URL: http://www.seketeli.net/~dodji Date: Tue, 09 Nov 2021 11:18:23 +0100 In-Reply-To: <20211105093828.15377-1-tangmeng@uniontech.com> (tangmeng@uniontech.com's message of "Fri, 5 Nov 2021 17:38:28 +0800") Message-ID: <87bl2t8weo.fsf@seketeli.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Nov 2021 10:18:28 -0000 Hello, tangmeng a =C3=A9crit: > When using abicompat, if the --redundant option and --no-redundant > option are used at the same time, no error will be prompted, the > actual option will prevail. > > This patch provides a error to notify the user that error. > > * tools/abicompat.cc (parse_command_line): Notify the user when -= -redundant > and --no-redundant are used at the same time > > Signed-off-by: tangmeng Thanks for the patch! I have applied a slightly modified version to yours that does essentially the same thing. Only minor nits have been picked. Please find the applied patch below. Thanks again! Cheers, >From 38d883cc7425cc945a8f51fd4cb66e90e2d8d825 Mon Sep 17 00:00:00 2001 From: tangmeng Date: Fri, 5 Nov 2021 17:38:28 +0800 Subject: [PATCH] abicompat: Add prompt message for abnormal operation When using abicompat, if the --redundant option and --no-redundant option are used at the same time, no error is prompted and none of the options have an impact. This patch emits an error message in that case. * tools/abicompat.cc (parse_command_line): Notify the user when --redundant and --no-redundant are used at the same time Signed-off-by: tangmeng Signed-off-by: Dodji Seketeli --- tools/abicompat.cc | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tools/abicompat.cc b/tools/abicompat.cc index cf944a49..addd03a9 100644 --- a/tools/abicompat.cc +++ b/tools/abicompat.cc @@ -71,6 +71,8 @@ public: bool list_undefined_symbols_only; bool show_base_names; bool show_redundant; + bool redundant_opt_set; + bool no_redundant_opt_set; bool show_locs; =20 options(const char* program_name) @@ -81,6 +83,8 @@ public: list_undefined_symbols_only(), show_base_names(), show_redundant(true), + redundant_opt_set(), + no_redundant_opt_set(), show_locs(true) {} }; // end struct options @@ -191,9 +195,15 @@ parse_command_line(int argc, char* argv[], options& op= ts) ++i; } else if (!strcmp(argv[i], "--redundant")) - opts.show_redundant =3D true; + { + opts.show_redundant =3D true; + opts.redundant_opt_set =3D true; + } else if (!strcmp(argv[i], "--no-redundant")) - opts.show_redundant =3D false; + { + opts.show_redundant =3D false; + opts.no_redundant_opt_set =3D true; + } else if (!strcmp(argv[i], "--no-show-locs")) opts.show_locs =3D false; else if (!strcmp(argv[i], "--help") @@ -645,6 +655,14 @@ main(int argc, char* argv[]) << opts.lib2_path << " will be ignored automatically\n"; } =20 + if (opts.redundant_opt_set && opts.no_redundant_opt_set) + { + emit_prefix(argv[0], cerr) + << "ERROR: The \'--redundant\' and '--no-redundant' option are in = conflict. " + << "Please select only one option to use.\n"; + return 1; + } + ABG_ASSERT(!opts.app_path.empty()); if (!abigail::tools_utils::check_file(opts.app_path, cerr, opts.prog_nam= e)) return abigail::tools_utils::ABIDIFF_ERROR; --=20 2.32.0 --=20 Dodji