From nobody Fri Jul 4 15:22:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524487581767376.8246718406399; Mon, 23 Apr 2018 05:46:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 49CBC30043E8; Mon, 23 Apr 2018 12:46:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 02CFC6609D; Mon, 23 Apr 2018 12:46:20 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 93F75180BAF0; Mon, 23 Apr 2018 12:46:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3NCjC82011950 for ; Mon, 23 Apr 2018 08:45:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6E41F7C28; Mon, 23 Apr 2018 12:45:12 +0000 (UTC) Received: from caroline.localdomain (unknown [10.43.2.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C9AE83B92 for ; Mon, 23 Apr 2018 12:45:12 +0000 (UTC) Received: from caroline.brq.redhat.com (caroline.usersys.redhat.com [127.0.0.1]) by caroline.localdomain (Postfix) with ESMTP id CC28812006B for ; Mon, 23 Apr 2018 14:45:08 +0200 (CEST) From: Martin Kletzander To: libvir-list@redhat.com Date: Mon, 23 Apr 2018 14:44:57 +0200 Message-Id: <1bca3c0795e0e0f317145027a356e89c69527c96.1524487472.git.mkletzan@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 29/29] Require space after cast X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Mon, 23 Apr 2018 12:46:20 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Let's make a rule out of it and document it. This is based on few sources: 1) Most of the code [1] used spaces after casts, so the patch to change it = this way rather than the other way around is smaller 2) I asked the first libvirt developer on my left when deciding, they prefe= rred spaces 3) My own preference. 4) The fact that this is clearly the superior way of casting =3DD [1] 54.85% is more than 50%, plus it is increasing as it was 52.96% during = the first draft of this clean-up. Signed-off-by: Martin Kletzander --- cfg.mk | 6 ++++++ docs/hacking.html.in | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/cfg.mk b/cfg.mk index 902178dd1c3a..967f99202481 100644 --- a/cfg.mk +++ b/cfg.mk @@ -1050,6 +1050,12 @@ sc_prohibit_backslash_alignment: halt=3D'Do not attempt to right-align backslashes' \ $(_sc_search_regexp) =20 +sc_require_space_after_cast: + @prohibit=3D'(\([a-zA-Z _]+ \*+|\(((signed|unsigned|long|short|int|char|s= ?size_t|void) ?)+|switch \(\(vir[a-zA-Z]*Type)\)([^ );,])' \ + in_vc_files=3D'*\.[chx]$$' \ + halt=3D'Use space after cast' \ + $(_sc_search_regexp) + # We don't use this feature of maint.mk. prev_version_file =3D /dev/null =20 diff --git a/docs/hacking.html.in b/docs/hacking.html.in index fbeea3eb751d..df3821aa3084 100644 --- a/docs/hacking.html.in +++ b/docs/hacking.html.in @@ -579,6 +579,15 @@ int foo(int wizz); // Good =20 +

+ There must be a single whitespace immediately following a cast to any + type. E.g. +

+
+      foo =3D (int)bar;  // Bad
+      foo =3D (int) bar; // Good
+
+

Commas

=20

--=20 2.17.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list