Re: How to auto format source file to be EDK2 code style?

Michael D Kinney


I have experimented with Astyle too. The best set of flags I have found so far are:


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.


-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@...] On Behalf Of Guoheyi
Sent: Wednesday, March 22, 2017 7:06 PM
To: edk2-devel@...
Subject: [edk2] How to auto format source file to be EDK2 code style?

Hi folks,

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" almost 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:

@@ -116,7 +116,7 @@ EhciPciIoPollIo (
IN UINT64 Value,
IN UINT64 Delay,
OUT UINT64 *Result
- )

Any suggestion?

And this is my "astyle" configuration:







Thanks and regards,

Gary (Heyi Guo)

edk2-devel mailing list

Join to automatically receive all group messages.