From nobody Sat Nov 30 01:33:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1620636120; cv=none; d=zohomail.com; s=zohoarc; b=H/5Z/3S31WMxzknLYXJkQPXSMv9FU2eo9bmsg+VpAwCEi5nn4v3I2TxkH/1IABA7PmHMhloKvgzGrm6tjBVl+WPCzFpyofrd2KPjpasY3FzFgc5ejCqQvy2/um3cKQLqm14ObJP9Z471guN9019top3lQMnfnhSNcOSeE2a1yzg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620636120; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=Veq5bN2ToXlmg1K1kpjPAFmqYcZ7SlFGvKOJgWWapQg=; b=OUGndnVBef7exycH6J/s+lpT1GsIlsZTn09bz8/1ssU8lsnRwhfWlfAiBAtcInHF0eCmqtBMLgfWR/4c6+wk+J+1NLWi0dCIYPj26CoOShvQUEQBKxbPoFCbqAv6efA3F+XcsRG6BYxLmgZxYOQ2QW4hPkZJyG6f8VW+ew1SSU4= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1620636120745462.61243204527364; Mon, 10 May 2021 01:42:00 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.124971.235335 (Exim 4.92) (envelope-from ) id 1lg1U3-0003BY-8j; Mon, 10 May 2021 08:41:47 +0000 Received: by outflank-mailman (output) from mailman id 124971.235335; Mon, 10 May 2021 08:41:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lg1U3-0003Ak-2g; Mon, 10 May 2021 08:41:47 +0000 Received: by outflank-mailman (input) for mailman id 124971; Mon, 10 May 2021 08:41:45 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lg1U1-0008L0-OB for xen-devel@lists.xenproject.org; Mon, 10 May 2021 08:41:45 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id 120380b4-d6db-4857-8ba4-6d056083678d; Mon, 10 May 2021 08:41:23 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8A29411FB; Mon, 10 May 2021 01:41:23 -0700 (PDT) Received: from e125770.cambridge.arm.com (e125770.cambridge.arm.com [10.1.197.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2A3F33F719; Mon, 10 May 2021 01:41:22 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 120380b4-d6db-4857-8ba4-6d056083678d From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: bertrand.marquis@arm.com, wei.chen@arm.com, Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH v6 6/9] docs: add doxygen preprocessor and related files Date: Mon, 10 May 2021 09:41:02 +0100 Message-Id: <20210510084105.17108-7-luca.fancellu@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210510084105.17108-1-luca.fancellu@arm.com> References: <20210510084105.17108-1-luca.fancellu@arm.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add preprocessor called by doxygen before parsing headers, it will include in every header a doxygen_include.h file that provides missing defines and includes that are usually passed by the compiler. Add doxy_input.list that is a text file containing the relative path to the source code file to be parsed by doxygen. The path sould be relative to the xen folder: E.g. xen/include/public/grant_table.h Signed-off-by: Luca Fancellu --- docs/xen-doxygen/doxy-preprocessor.py | 110 ++++++++++++++++++++++++++ docs/xen-doxygen/doxy_input.list | 0 docs/xen-doxygen/doxygen_include.h.in | 32 ++++++++ 3 files changed, 142 insertions(+) create mode 100755 docs/xen-doxygen/doxy-preprocessor.py create mode 100644 docs/xen-doxygen/doxy_input.list create mode 100644 docs/xen-doxygen/doxygen_include.h.in diff --git a/docs/xen-doxygen/doxy-preprocessor.py b/docs/xen-doxygen/doxy-= preprocessor.py new file mode 100755 index 0000000000..496899d8e6 --- /dev/null +++ b/docs/xen-doxygen/doxy-preprocessor.py @@ -0,0 +1,110 @@ +#!/usr/bin/python3 +# +# Copyright (c) 2021, Arm Limited. +# +# SPDX-License-Identifier: GPL-2.0 +# + +import os, sys, re + + +# Variables that holds the preprocessed header text +output_text =3D "" +header_file_name =3D "" + +# Variables to enumerate the anonymous structs/unions +anonymous_struct_count =3D 0 +anonymous_union_count =3D 0 + + +def error(text): + sys.stderr.write("{}\n".format(text)) + sys.exit(1) + + +def write_to_output(text): + sys.stdout.write(text) + + +def insert_doxygen_header(text): + # Here the strategy is to insert the #include in t= he + # first line of the header + abspath =3D os.path.dirname(os.path.abspath(__file__)) + text +=3D "#include \"{}/doxygen_include.h\"\n".format(abspath) + + return text + + +def enumerate_anonymous(match): + global anonymous_struct_count + global anonymous_union_count + + if "struct" in match.group(1): + label =3D "anonymous_struct_%d" % anonymous_struct_count + anonymous_struct_count +=3D 1 + else: + label =3D "anonymous_union_%d" % anonymous_union_count + anonymous_union_count +=3D 1 + + return match.group(1) + " " + label + " {" + + +def manage_anonymous_structs_unions(text): + # Match anonymous unions/structs with this pattern: + # struct/union { + # [...] + # + # and substitute it in this way: + # + # struct anonymous_struct_# { + # [...] + # or + # union anonymous_union_# { + # [...] + # where # is a counter starting from zero, different between structs a= nd + # unions + # + # We don't count anonymous union/struct that are part of a typedef bec= ause + # they don't create any issue for doxygen + text =3D re.sub( + "(? + * + * SPDX-License-Identifier: GPL-2.0 + */ + +#include "@XEN_BASE@/xen/include/xen/config.h" + +#if defined(CONFIG_X86_64) + +#define __x86_64__ 1 + +#elif defined(CONFIG_ARM_64) + +#define __aarch64__ 1 + +#elif defined(CONFIG_ARM_32) + +#define __arm__ 1 + +#else + +#error Architecture not supported/recognized. + +#endif --=20 2.17.1