From patchwork Fri Dec 16 18:25:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?RWR3aW4gVMO2csO2aw==?= X-Patchwork-Id: 13075276 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3919FC001B2 for ; Fri, 16 Dec 2022 18:26:06 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.464889.723483 (Exim 4.92) (envelope-from ) id 1p6FPC-0000Ca-Jp; Fri, 16 Dec 2022 18:25:58 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 464889.723483; Fri, 16 Dec 2022 18:25:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p6FPC-0000Bm-B1; Fri, 16 Dec 2022 18:25:58 +0000 Received: by outflank-mailman (input) for mailman id 464889; Fri, 16 Dec 2022 18:25:56 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p6FPA-0008JE-Go for xen-devel@lists.xenproject.org; Fri, 16 Dec 2022 18:25:56 +0000 Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com [216.71.155.144]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 14374b3e-7d6f-11ed-91b6-6bf2151ebd3b; Fri, 16 Dec 2022 19:25:55 +0100 (CET) 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: 14374b3e-7d6f-11ed-91b6-6bf2151ebd3b DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1671215155; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=671yWeRPfk0fUsd0ZZw8sPwYTi3Pa9dmLi7mGVUNfHg=; b=WyVKpnfLT6VZcv0O1X5oiswfAYtjVFq+qNShSsIi2P1eergdTIjF9mq2 w0BG/pfYZrTrWAGOIL3OGb1LB0UIgfhoxUQiMo2o6NXmHZViu45nbRVhY 3kUR6Xf9ty2vjkIY7wiCXg1YmqBCgGyafo2l+tnV+pUqs6dzsAnv98R+J Q=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 91288387 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:L181mqLfMTS7DoSlFE+R35UlxSXFcZb7ZxGr2PjKsXjdYENS12ZRz zcbWj2Pb/aDM2D0c91yOY+y8E0C7ZPcn4RiTgZlqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAgk/rOHv+kUrWs1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpJrfPdwP9TlK6q4mlB5AVgPaojUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c5pIEMe6 K0ALAwXRRHend+6z5G2TdtF05FLwMnDZOvzu1llxDDdS/0nXYrCU+PB4towMDUY354UW6yEP oxANGQpPE+ojx5nYz/7DLozkPmpgD/jdCdfq3qepLYt4niVxwt0uFToGIuMIIzaHpUK9qqej kec7k3rAxtDDdOwl2Ci3G+Pu/bkxAquDer+E5Xnr6U30TV/3Fc7GBAQEFe2v/S9okq/QM5Eb VwZ/DI0qqo//1DtScPyNzW0qWCJlgQRUN1RF6s98g7l4rXQyxaUAC4DVDEpVTA9nJZoH3pwj AbPxo63Q2w02FGIdZ6D3qm1j2OvaDAREXUpZHIecAcKwNTkkqhm23ojUe1fOKKyi9T0HxT5z DaLsDUyit0vsCIb60mo1QuZ2mzx//AlWiZwv1yKBTz9smuVcab/P+SVBU7nAeGsxWpzZn2Ip zA6lseX94ji5rndxXXWEI3h8FxEjstp0QEwY3Y1R/HNFBz3oRZPmLy8BxkgTHqFyu5eJVfUj Lb74Gu9HqN7MnqwdrNQaImsEcksxqWIPY27CamNNIsXM8gpKFHvEMRSiam4hjCFraTRuftnZ cfznTiEUx729piLPBLpHrxAgNfHNwg1xH/JRICT8vhU+eP2WZJhcp9caAHmRrlgvMu5TPD9r 4432z2il08OD4UTo0D/reYuELz9BSRjVM2r95EJKb7rz8gPMDhJNsI9CIgJI+RN95m5XM+Rl p1hcie0EGbCuEA= IronPort-HdrOrdr: A9a23:cE5k8amlqTf1MuUs0MvLeLX20dDpDfLL3DAbv31ZSRFFG/Fwwf re+sjztCWatN91YhsdcL+7VJVoLUmsjqKdpLNhRYtKPzOJhILLFvAE0WK4+UyDJ8SWzIc06U 4jSdkcNDSXNykesS+Q2njALz9P+rS62ZHtrfrai09wQR1nS4wI1XYCNi+rVmVqQQFdH5owE9 657spD4x6tY24eYMj+JnRtZYn+juyOvI/iaQQdBxYhrC2HjTbt1aXzFAKR1AofVTQK4bpKyw j4ewKQ3NTGjxjq8HTh61M= X-IronPort-AV: E=Sophos;i="5.96,249,1665460800"; d="scan'208";a="91288387" From: =?utf-8?b?RWR3aW4gVMO2csO2aw==?= To: CC: =?utf-8?b?RWR3aW4gVMO2csO2aw==?= , David Scott , Wei Liu , Anthony PERARD , Christian Lindig Subject: [PATCH v4 03/11] CODING_STYLE(tools/ocaml): add 'make format' and remove tabs Date: Fri, 16 Dec 2022 18:25:12 +0000 Message-ID: <81d621cea5975fdd9698992b968dcd7528c637af.1671214525.git.edwin.torok@cloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 See CODING_STYLE: Xen uses spaces, not tabs. * OCaml code: Using `ocp-indent` for now to just make minimal modifications in tabs vs spaces and get the right indentation. We can introduce `ocamlformat` later. * C stubs: just replace tabs with spaces now, using `indent` or `clang-format` would change code too much for 4.17. This avoids perpetuating a formatting style that is inconsistent with the rest of Xen, and that makes preparing and submitting patches more difficult (OCaml indentation tools usually only support spaces, not tabs). No functional change. Signed-off-by: Edwin Török Acked-by: Christian Lindig --- Reason for inclusion: - avoid perpetuating a different coding style (I thought tabs were mandated by Xen, and was about to fix up my editor config to match when I realized Xen already mandates the use of spaces) - should make submitting patches for OCaml easier (OCaml indentation tools know only about spaces, so I either can't use them, or have to manually adjust indentation every time I submit a patch) - it can be verified that the only change here is the Makefile change for the new rule, 'git log -p -1 -w' should be otherwise empty Changes since v3: - this didn't make it into 4.17.0, we'll reconsider for 4.17.1, for now apply just to master which is open again - separate introducing the rule from actual reformatting Cc: Christian Lindig --- tools/ocaml/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/ocaml/Makefile b/tools/ocaml/Makefile index a7c04b6546..274ba15d75 100644 --- a/tools/ocaml/Makefile +++ b/tools/ocaml/Makefile @@ -34,3 +34,8 @@ build-tools-oxenstored: $(MAKE) -s -C libs/xb $(MAKE) -s -C libs/xc $(MAKE) -C xenstored + +.PHONY: format +format: + git ls-files '*.ml' '*.mli' | xargs -n1 ocp-indent -i + git ls-files '*.c' '*.h' | xargs -n1 sed -ie 's/\t/ /g'