From patchwork Fri Nov 5 09:36:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tangmeng X-Patchwork-Id: 47097 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 9A330385803A for ; Fri, 5 Nov 2021 09:37:47 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from smtpbgbr2.qq.com (smtpbgbr2.qq.com [54.207.22.56]) by sourceware.org (Postfix) with ESMTPS id 15D4D3857C72 for ; Fri, 5 Nov 2021 09:37:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 15D4D3857C72 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: bizesmtp51t1636105023tn7rl2kf Received: from localhost.localdomain (unknown [58.240.82.166]) by esmtp6.qq.com (ESMTP) with id ; Fri, 05 Nov 2021 17:36:58 +0800 (CST) X-QQ-SSF: 0140000000200040C000000A0000000 X-QQ-FEAT: ZHWZeLXy+8ehqrCzzXaDTEOoEaWSs+gTlI9ooorANgjWICihMAh7dD3ScULAg 4XUpqXDgkuLSrBA67CT/OK9XEd0E4UyqBDkOA0m+9Fq8i46gpTCeMeUIWmkCIbOw9FBjZ5n 4fTfdxDkvF0VCovnizpuw1TFZswLOcqG3RGk2CbmKOuRxWETwVt9+o3OID58oWTEdKPjODZ jUiXeao2HVQaKq4W8E6zsOFvblq6FxubktYQhlFEe4ckq1+0vHeXN3myWt+457iidDKhODj s2iuQ3I/nLBXa/bO94ZzLQEpQT1r3tf7/WwJMUn5X4GKqgkHsRtEtIosns0n3HTUXaJBsZf FF0C2TllNUu9tQjnLGejkRKrjjB0suQw7ZnfwxV X-QQ-GoodBg: 2 From: tangmeng To: libabigail@sourceware.org Subject: [PATCH] abicompat: Add prompt message for abnormal operation Date: Fri, 5 Nov 2021 17:36:57 +0800 Message-Id: <20211105093657.15126-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:qybgforeign1 X-QQ-Bgrelay: 1 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_ABUSEAT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_XBL, 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 (main): Notify the user when --redundant and --no-redundant are used at the same time Signed-off-by: tangmeng --- 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;