Propose to use clang-format to enforce hotspot codestyle

Volker Simonis volker.simonis at gmail.com
Wed Mar 11 12:06:16 UTC 2020


Liu, Xin <xxinliu at amazon.com> schrieb am Mi., 11. März 2020, 09:50:

> 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?
>

Have you already checked how big this first change will be? I'm afraid it
will be huge because we have a lot of manually formatted code which doesn't
confirm to any specific style (e.g. macros). We also have consistent but
different code styles in various parts of HS. So changing all the sources
to conform to a single style will necessarily be quite invasive and I'm not
sure if we want that?


> Reference:
> [1] https://clang.llvm.org/docs/ClangFormat.html
> Thanks,
> --lx
>
>
>


More information about the hotspot-dev mailing list