Header inclusion ordering style addition

William Kennington wak at google.com
Wed Aug 29 04:11:46 AEST 2018


As long as this can be done automatically with clang format it sounds
good to me. It seems like the trivial alphabetical ordering built-in
to clang-format works fine for the consistency element. We should get
rid of all local includes and use system includes if the headers get
installed as part of the packaging process.
On Tue, Aug 28, 2018 at 10:54 AM James Feist
<james.feist at linux.intel.com> wrote:
>
> On 08/28/2018 10:35 AM, Patrick Venture wrote:
> > Each file in each daemon attempts to order the headers in a consistent
> > way.  Typically, alphabetically.  However, I propose here a more
> > explicit ordering:
> >
> > https://gerrit.openbmc-project.xyz/12180
> >
> > As an example of the ordering:
> >
> > https://gerrit.openbmc-project.xyz/11421
> >
>
> This can be enforced in clang-format with SortIncludes
> https://clang.llvm.org/docs/ClangFormatStyleOptions.html and
> IncludeCategories regex for specific ordering.
>
> > I feel that having a consistent ordering that deals with the various
> > types of header files included provides a couple benefits:
> > * header files are included where you expect to find them
> > * easily can see that there are c-headers included in a clean group
> > * defines that the phosphor library headers are treated as normal cpp
> > libraries and included in that grouping making the headers come across
> > as system libraries and not something different.
> >
> > Please take a look.
> >
> > Patrick
> >


More information about the openbmc mailing list