Hi Mike,

On 03/02/18 01:33, Kinney, Michael D wrote:
> Laszlo,
> Sorting #includes looks strange to me.
> We usually include the top level environment include
> first (e.g. <PiPei.h>) and then the libs, protocols,
> ppis, GUIDs grouped together.
> If it is a lib module, the produced libs are listed
> first followed by the consumed libs.

What you describe is the optimal structuring of the includes, and I do
my best to comply with it when I post patches for core modules (MdePkg,
MdeModulePkg, UefiCpuPkg, ...)

However, under OvmfPkg and ArmVirtPkg, I have to disagree strongly. Many
contributors lack either the knowledge or the discipline to follow the
model that you describe. (Enforcing the model as a reviewer is also
quite tedious.) Over time we end up with a mess of #include directives
and LibraryClasses entries, where:

- included library class headers, end entries under [LibraryClasses], do
not match each other (or maybe they do, but it's hard to see because
they are both sort of randomly ordered)

- some headers are included "just to be safe" (they are not kept at a

- especially after code removal and code movement, these parts are
littered with dead entries.

Keeping the lists sorted, while not entirely logical, greatly eases
review and maintenance for me. (The sorting also happens to group
Library/, Protocol/, Ppi/, Guid/, IndustryStandard/, Register/, etc
includes "tightly", so at least those aren't intermixed.)

edk2-devel mailing list

Reply via email to