From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BE58C4727E for ; Wed, 30 Sep 2020 09:58:14 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 298D62075F for ; Wed, 30 Sep 2020 09:58:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="QXUHftJ5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 298D62075F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.528.1721 (Exim 4.92) (envelope-from ) id 1kNYry-0004KD-FH; Wed, 30 Sep 2020 09:57:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 528.1721; Wed, 30 Sep 2020 09:57:54 +0000 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" Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kNYry-0004K6-An; Wed, 30 Sep 2020 09:57:54 +0000 Received: by outflank-mailman (input) for mailman id 528; Wed, 30 Sep 2020 09:57:52 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kNYrw-0004K1-Ih for xen-devel@lists.xenproject.org; Wed, 30 Sep 2020 09:57:52 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 09c56cf6-f6c1-4eaf-afd0-e1230204f5a7; Wed, 30 Sep 2020 09:57:50 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1B367AC4D; Wed, 30 Sep 2020 09:57:50 +0000 (UTC) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kNYrw-0004K1-Ih for xen-devel@lists.xenproject.org; Wed, 30 Sep 2020 09:57:52 +0000 X-Inumbo-ID: 09c56cf6-f6c1-4eaf-afd0-e1230204f5a7 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 09c56cf6-f6c1-4eaf-afd0-e1230204f5a7; Wed, 30 Sep 2020 09:57:50 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1601459870; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kt3YXb4HhDyXS4vTh23c8nxczbuf8QnZhcX1+DRh45I=; b=QXUHftJ5SzpKPCc0s9kk4M4X5LVrARwpNde1IYET6Pj4Q1J9fwZgfjPn439bP64pauYHkL mW2tm5KZ1khErDv0cQ8c3bW8re6oC1UaWzVEfi3qs9DEbRh4XbEAeg3gPEcol5JgX9PjRF JZhUK3C9W6xefElerueTNwaHsxkkH1o= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1B367AC4D; Wed, 30 Sep 2020 09:57:50 +0000 (UTC) Subject: Re: Xen Coding style and clang-format To: Anastasiia Lukianenko Cc: "xen-devel@lists.xenproject.org" , Artem Mygaiev , "committers@xenproject.org" , "julien@xen.org" , "vicooodin@gmail.com" , "viktor.mitin.19@gmail.com" , Volodymyr Babchuk References: <300923eb27aea4d19bff3c21bc51d749c315f8e3.camel@epam.com> From: Jan Beulich Message-ID: <4238269c-3bf4-3acb-7464-3d753f377eef@suse.com> Date: Wed, 30 Sep 2020 11:57:50 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <300923eb27aea4d19bff3c21bc51d749c315f8e3.camel@epam.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 30.09.2020 11:18, Anastasiia Lukianenko wrote: > I would like to know your opinion on the following coding style cases. > Which option do you think is correct? > 1) Function prototype when the string length is longer than the allowed > one > -static int __init > -acpi_parse_gic_cpu_interface(struct acpi_subtable_header *header, > - const unsigned long end) > +static int __init acpi_parse_gic_cpu_interface( > + struct acpi_subtable_header *header, const unsigned long end) Both variants are deemed valid style, I think (same also goes for function calls with this same problem). In fact you mix two different style aspects together (placement of parameter declarations and placement of return type etc) - for each individually both forms are deemed acceptable, I think. > 2) Wrapping an operator to a new line when the length of the line is > longer than the allowed one > - if ( table->revision > 6 > - || (table->revision == 6 && fadt->minor_revision >= 0) ) > + if ( table->revision > 6 || > + (table->revision == 6 && fadt->minor_revision >= 0) ) Only the latter variant is correct. > 3) define code style > -#define ALLREGS \ > - C(r0,r0_usr); C(r1,r1_usr); C(r2,r2_usr); C(r3,r3_usr); \ > - C(cpsr,cpsr) > +#define ALLREGS \ > + C(r0, r0_usr); \ > + C(r1, r1_usr); \ > + C(r2, r2_usr); \ You're again mixing multiple style aspects together: There definitely should be a blank after the comma, but I don't think we require every item to be on its own line. But this latter aspect is a little bogus here anyway - generally, macros better wouldn't contain embedded semicolons, unless e.g. in a compound statement. I also don't think we require backslashes (not) to be aligned; this has typically been left to the author's taste so far, I guess. > 4) Comment style > - /* PC should be always a multiple of 4, as Xen is using ARM > instruction set */ > + /* PC should be always a multiple of 4, as Xen is using ARM > instruction set > + */ For a single line comment, only the former variant is correct. In a multi-line comment neither would be. But comment style is described well in ./CODING_STYLE, I think, so I'm not sure why the question arose in the first place. Jan