From patchwork Fri Dec 1 14:54:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 81115 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 348DB3857340 for ; Fri, 1 Dec 2023 14:54:22 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id BD4893858C62 for ; Fri, 1 Dec 2023 14:54:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BD4893858C62 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BD4893858C62 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701442460; cv=none; b=jf/pMGSjqxr8Gmqv1oEu04Czb2604Te/wEkRVKGC66nwP4F1pgeXt873BsDgUMEkgYDpl7Z9Sm1UZz6kgNW4YaAo/nzd8alfZynVG9r1HReREbNQZko8hbw5Hwd090/RPo6VbXsgrT2YGo22hohvHsl6bTWwv8DuMxzGj/l0J3I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701442460; c=relaxed/simple; bh=V80be66E/aW07AJ7zg4xOLaICvibSR2yCRe31Woa/iw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=KIBIUqZe0PBDKeTowpwpAmnr5KdbtnCcav0xnyEX0xC+MUwxiSd5CFg+YJ4J1jjIMJC8DAX6M17ap7uYS2KujFjFpZ3K0g1kJCpI1LqY2qW5AAc34y6K2q1ZiWMiMXVbWre2mcDq4hX/QKDCtMk8vJfPY5ww3VwdSmUmsBgzl2E= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701442458; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=rvXy/Xdab6cod4cxiNOa8y/ySj+JbEZH88XmnjhaXO0=; b=DTf5CABKRj0Nj+IHIMIQ3QOVg069maWdV4vwr1kJMLi6sN3OWgEbyRz6o6fQTpxFkvgF91 6XIkjKhjhZlFi6eGS1Ac3nA4pvlQ8ilq8k/olCx3L2VNvR2XqtHNRN5txzHcQ1JduEgcTe bBYvGNGmwvq+BvvuTSSMPaNOZ0KMoV4= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-202-orfH1BMVPJa0EbmNbsp1mQ-1; Fri, 01 Dec 2023 09:54:17 -0500 X-MC-Unique: orfH1BMVPJa0EbmNbsp1mQ-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-333354a9242so61531f8f.1 for ; Fri, 01 Dec 2023 06:54:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701442454; x=1702047254; h=mime-version:user-agent:message-id:date:organization:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rvXy/Xdab6cod4cxiNOa8y/ySj+JbEZH88XmnjhaXO0=; b=Ix/JLXVE8PRSUuELEN/S/r4aCYLH0zNlR+XiJHzhdCjjnUbgJPXdO+aYHFMIrlVC40 M5dGKwpFHzLdcsTPNeUtyepmUle6VvmzDnnVXrCxPGgdG59BjbqlyCelkLS700MflcGV oGfENKvAVdc5i+ySzPHjisTSB2VZduvfk/nLBWnGVZLaSF5aUfgq+HsGY2D1bADutDYy f5WGq4eo97wJqqYQp+ntLbJIWVzqnWRKr2ACzHKhUK2NteGLYJFM9hIA5ZTsjZb3kLNn JxyYIjPHKNvU+gK6L4/5jaAMpJamQLdJPJcfNaMRKZ8zI4dGBljd43Db5qOGqQ2lrddB Tt/Q== X-Gm-Message-State: AOJu0YxWAeKAAdB/82O/o0p6OR3YjikEmz08aSz/IuHM+8r79y6ybz4U RNTnxGRIo06dN7/EIHfyrU4YWc6OundNUBTYJPiDbQhBF7YoEnR6jTKvYHXCPVU78HnMyOcyfP+ wul5pgFtipRMNcPx+n75H60lHQtHp X-Received: by 2002:a05:600c:1d12:b0:401:c8b9:4b86 with SMTP id l18-20020a05600c1d1200b00401c8b94b86mr725595wms.9.1701442454494; Fri, 01 Dec 2023 06:54:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IGSsTPFslzkTf1ope7ceTaJ1yNHuP+pNc2D0CGEGrm1SCvKGgRst80yT2hH36AsU8l6tQtckQ== X-Received: by 2002:a05:600c:1d12:b0:401:c8b9:4b86 with SMTP id l18-20020a05600c1d1200b00401c8b94b86mr725587wms.9.1701442454152; Fri, 01 Dec 2023 06:54:14 -0800 (PST) Received: from localhost ([37.169.169.39]) by smtp.gmail.com with ESMTPSA id c4-20020a05600c0a4400b0040b4ccdcffbsm5670608wmq.2.2023.12.01.06.54.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 06:54:13 -0800 (PST) Received: by localhost (Postfix, from userid 1000) id 55AC15077C43; Fri, 1 Dec 2023 15:54:12 +0100 (CET) From: Dodji Seketeli To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH, applied] abilint: Support --annotate Organization: Red Hat / France X-Operating-System: AlmaLinux 9.2 X-URL: http://www.redhat.com Date: Fri, 01 Dec 2023 15:54:12 +0100 Message-ID: <87leaenfcb.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Hello, It turns out abilint doesn't support the "--annotate" option like abidw does. Annoying. Added thus. * tools/abilint.cc (options::annotate): Define new data member. (options::options): Initialize. (display_usage): Add help string. (parse_command): Support the --annotate command options. (main): Set the annotate option on the context. Signed-off-by: Dodji Seketeli Applied to master. --- doc/manuals/abilint.rst | 7 +++++++ tools/abilint.cc | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/doc/manuals/abilint.rst b/doc/manuals/abilint.rst index 4213a22e..594dd4c2 100644 --- a/doc/manuals/abilint.rst +++ b/doc/manuals/abilint.rst @@ -27,6 +27,13 @@ Invocation Options ======= + * ``--annotate`` + + Annotate the ABIXML output with comments above most elements. The + comments are made of the pretty-printed form of types, declaration + or even ELF symbols. The purpose is to make the ABIXML output + more human-readable for debugging or documenting purposes. + * ``--help`` Display a short help message and exits. diff --git a/tools/abilint.cc b/tools/abilint.cc index 91718067..9c6ed897 100644 --- a/tools/abilint.cc +++ b/tools/abilint.cc @@ -81,6 +81,7 @@ struct options bool read_tu; bool diff; bool noout; + bool annotate; #ifdef WITH_CTF bool use_ctf; #endif @@ -97,7 +98,8 @@ struct options read_from_stdin(false), read_tu(false), diff(false), - noout(false) + noout(false), + annotate(false) #ifdef WITH_CTF , use_ctf(false) @@ -493,6 +495,7 @@ display_usage(const string& prog_name, ostream& out) << " --diff for xml inputs, perform a text diff between " "the input and the memory model saved back to disk\n" << " --noout do not display anything on stdout\n" + << " --annotate annotate the ABI artifacts emitted in the output\n" << " --stdin read abi-file content from stdin\n" << " --tu expect a single translation unit file\n" #ifdef WITH_CTF @@ -583,6 +586,8 @@ parse_command_line(int argc, char* argv[], options& opts) opts.diff = true; else if (!strcmp(argv[i], "--noout")) opts.noout = true; + else if (!strcmp(argv[i], "--annotate")) + opts.annotate = true; #ifdef WITH_SHOW_TYPE_USE_IN_ABILINT else if (!strcmp(argv[i], "--show-type-use")) { @@ -723,6 +728,7 @@ main(int argc, char* argv[]) { const write_context_sptr& ctxt = create_write_context(env, cout); + set_annotate(*ctxt, opts.annotate); write_translation_unit(*ctxt, *tu, 0); } return 0; @@ -739,6 +745,7 @@ main(int argc, char* argv[]) { const write_context_sptr& ctxt = create_write_context(env, cout); + set_annotate(*ctxt, opts.annotate); write_corpus(*ctxt, corp, /*indent=*/0); } return 0; @@ -879,6 +886,7 @@ main(int argc, char* argv[]) { if (!opts.noout) { + set_annotate(*ctxt, opts.annotate); if (corp) is_ok = write_corpus(*ctxt, corp, 0); else if (group)