Propose to use clang-format to enforce hotspot codestyle

Liu, Xin xxinliu at amazon.com
Wed Mar 11 08:50:03 UTC 2020


Hi, 

I just filed a JBS issue JDK-8240834 about hotspot codestyle(https://wiki.openjdk.java.net/display/HotSpot/StyleGuide). I found many  inconsistent code in hotspot so I propose to use clang-format[1] to enforce it. 
 
I know you’re all very experienced developers, but sometimes wrong indentations or tailing whitespaces creep in.  it's hard to catch them in webrev.  Even though we can, new contributors still need to contact their sponsors for formatting changes.   I think it's a good idea to have lint thing done at first place. 

Clang is powerful enough to parse modern C/C++ code and it's very handy to format code. clang-format should be available on all supporting platforms. It's still okay even if it is absent on some platforms because nightly build and submit repo will cover unsupported platforms.

I plan to have  a .clang-format and correcting styles in the 1st patch. We can bring auto clang-format check to hotspot's makefile in the second patch.  Does it sound like a plan? 
 
Reference: 
[1] https://clang.llvm.org/docs/ClangFormat.html
Thanks,
--lx
	



More information about the hotspot-dev mailing list