From patchwork Fri Nov 5 09:38:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tangmeng X-Patchwork-Id: 47098 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 411613858428 for ; Fri, 5 Nov 2021 09:38:44 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from smtpbguseast2.qq.com (smtpbguseast2.qq.com [54.204.34.130]) by sourceware.org (Postfix) with ESMTPS id 3871E3858D35 for ; Fri, 5 Nov 2021 09:38:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3871E3858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=uniontech.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=uniontech.com X-QQ-mid: bizesmtp52t1636105114tmhnb1ws Received: from localhost.localdomain (unknown [58.240.82.166]) by esmtp6.qq.com (ESMTP) with id ; Fri, 05 Nov 2021 17:38:29 +0800 (CST) X-QQ-SSF: 0140000000200040C000000A0000000 X-QQ-FEAT: 1npaVEgjlkKvhkrNzMwcFGiLjZfEBDOtrWpj3e+A1bMdimNGjPUa40ktvqFNO gc449aVA/6oO7FeLuIgfZYmlkWpHIEGf9NZK3JUI/swZtjBlLJCTuFIqIyGcUdrVRV7nDkL u6v6KIboRX1m7FQALcDalRCGl+KdDiXu1I6MlASwGOpfrqM/hTPgjZQeTRtBcLik2lQJeHJ USUaRumfaHMDlPs5DH6+vmJRShQgPzCuuEP5CQ1zqqSUbsvzjuq/sCLKHzMsoGqkqPEKWlO IwiDmGDjvhQxCxR7dmD1B8gaQDnLES3jVvfR0j05vfcbn0HB5J2Bg7FJMKzQZ2XBwrvbN/8 6xjtTlqvRb0jhjWcKUTLqXHAu86w88McNkk/a/l X-QQ-GoodBg: 2 From: tangmeng To: libabigail@sourceware.org Subject: [PATCH v2] abicompat: Add prompt message for abnormal operation Date: Fri, 5 Nov 2021 17:38:28 +0800 Message-Id: <20211105093828.15377-1-tangmeng@uniontech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybgforeign:qybgforeign2 X-QQ-Bgrelay: 1 X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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: , Cc: tangmeng Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" 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 Signed-off-by: tangmeng Signed-off-by: Dodji Seketeli --- tools/abicompat.cc | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tools/abicompat.cc b/tools/abicompat.cc index cf944a49..de5043ea 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 seted_redundant; + bool seted_no_redundant; bool show_locs; options(const char* program_name) @@ -191,9 +193,15 @@ parse_command_line(int argc, char* argv[], options& opts) ++i; } else if (!strcmp(argv[i], "--redundant")) - opts.show_redundant = true; + { + opts.show_redundant = true; + opts.seted_redundant = true; + } else if (!strcmp(argv[i], "--no-redundant")) - opts.show_redundant = false; + { + opts.show_redundant = false; + opts.seted_no_redundant = true; + } else if (!strcmp(argv[i], "--no-show-locs")) opts.show_locs = false; else if (!strcmp(argv[i], "--help") @@ -645,6 +653,14 @@ main(int argc, char* argv[]) << opts.lib2_path << " will be ignored automatically\n"; } + if (opts.seted_redundant && opts.seted_no_redundant) + { + 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_name)) return abigail::tools_utils::ABIDIFF_ERROR;