From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CCB018030F for ; Wed, 22 Mar 2017 20:26:16 -0700 (PDT) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP; 22 Mar 2017 20:26:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,208,1486454400"; d="scan'208";a="79657812" Received: from orsmsx105.amr.corp.intel.com ([10.22.225.132]) by fmsmga005.fm.intel.com with ESMTP; 22 Mar 2017 20:26:16 -0700 Received: from orsmsx158.amr.corp.intel.com (10.22.240.20) by ORSMSX105.amr.corp.intel.com (10.22.225.132) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 22 Mar 2017 20:26:16 -0700 Received: from orsmsx113.amr.corp.intel.com ([169.254.9.211]) by ORSMSX158.amr.corp.intel.com ([169.254.10.84]) with mapi id 14.03.0319.002; Wed, 22 Mar 2017 20:26:15 -0700 From: "Kinney, Michael D" To: Guoheyi , "edk2-devel@lists.01.org" , "Kinney, Michael D" Thread-Topic: [edk2] How to auto format source file to be EDK2 code style? Thread-Index: AdKjegX06CJvetc8SPeGfbozMaLLNQAAZdeA Date: Thu, 23 Mar 2017 03:26:14 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzkyMGFhOWYtNjU3MC00OThmLTg3NjUtNGQwNzg3OWVkZTg1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IitcL1wvZTZIR09kTXJuS09FU0xXVWFWRlRrcjdFREk4VGloa1d6V052ODEzQT0ifQ== x-originating-ip: [10.22.254.139] MIME-Version: 1.0 Subject: Re: How to auto format source file to be EDK2 code style? X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Mar 2017 03:26:16 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Gary, I have experimented with Astyle too. The best set of flags I have found so= far are: --style=3Dkr --indent=3Dspaces=3D2 --add-brackets --lineend=3Dwindows --indent-continuation=3D1 --indent-col1-comments --pad-oper --pad-comma --pad-first-paren-out --pad-header --align-pointer=3Dname --convert-tabs --max-code-length=3D120 This gets close, but there are minor issues with 1) Space around '*','&','~','&&','!' operators. 2) Indenting ');' at end of function declaration 3) Aligning arguments and return values in function header comment blocks 4) Aligning arguments in function declarations 5) Aligning local variable declarations. Mike > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Gu= oheyi > Sent: Wednesday, March 22, 2017 7:06 PM > To: edk2-devel@lists.01.org > Subject: [edk2] How to auto format source file to be EDK2 code style? >=20 > Hi folks, >=20 >=20 > A number of our existing source code files are in really bad format and I= 'm trying to > find a quick way to re-style them. I found the tool called "astyle" almos= t meets edk2 > code style with certain settings, except it will remove the indent before= closing > parenthesis ")" in a new line. E.g. it will change code like below: >=20 > @@ -116,7 +116,7 @@ EhciPciIoPollIo ( > IN UINT64 Value, > IN UINT64 Delay, > OUT UINT64 *Result > - ) > +) >=20 > Any suggestion? >=20 > And this is my "astyle" configuration: >=20 > #--indent-switches > --indent-cases > --indent-namespaces > --indent-preprocessor > --indent-col1-comments >=20 >=20 > --pad-oper >=20 > --pad-header >=20 > --add-brackets > #--pad-comma >=20 > --convert-tabs >=20 > --indent-classes > --style=3D1tbs > --indent=3Dspaces=3D2 > --min-conditional-indent=3D1 > --max-instatement-indent=3D40 > --align-pointer=3Dname > --align-reference=3Dname > --max-code-length=3D80 >=20 > Thanks and regards, >=20 > Gary (Heyi Guo) >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel