]> git.ipfire.org Git - thirdparty/systemd.git/commit - CODING_STYLE
CODING_STYLE: mandate alphabetical include order 1161/head
authorDavid Herrmann <dh.herrmann@gmail.com>
Sat, 5 Sep 2015 11:03:59 +0000 (13:03 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Sat, 5 Sep 2015 16:24:26 +0000 (18:24 +0200)
commit54c1f2d761b506132a709a7e8573c7b54d048cf0
treea276c14d170b80ca0d7f8accd366975535b07bd2
parent335250e7bdd09794f9a639c99fbd73b701b2d6e1
CODING_STYLE: mandate alphabetical include order

systemd-internal headers must not rely on include order. That means, they
either must contain forward-declarations of used types/functions, or they
must include all dependencies on their own. Therefore, there is no reason
to mandate an include order on the call-side.

However, global includes should always be ordered first. We don't want
local definitions to leak into global includes, possible changing their
behavior. Apparently, namespacing is a complex problem that people are
incapable of implementing properly..

Apart from "global before local", there is no reason to mandate a random
include order (which we happen to do right now). Instead, mandate
alphabetical ordering. The current rules do not have any benefit at all.
They neither reduce include-complexity, nor allow easy auditing of
include files. But with alphabetical ordering, we get duplicate-detection
for free, it gets *much much* easier to figure out whether a header is
already included, and it is trivial to add new headers.
CODING_STYLE