[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] RFC: Coding style: require alphabetical header file sorting

On 12/03/2012 05:45 PM, Daniel P. Berrange wrote:
Thus far we only have one rule about header files, #include <config.h>
must be first in all .c files.  I'm wondering if it is time to introduce
some new rules

  - All system headers must be grouped to preceed all local headers
why not enforce the current statement in the contributor guidelines:
<config.h>, system includes, conditional system includes, "internal.h",
local includes (is there a need for conditional local includes?).
  - All system headers must be sorted within their group
  - All local headers must be sorted within their group
as a header file is expected to be self-contained this ought to be OK,
although there might special cases requiring different ordering
(config.h is an obvious one, no others come to mind at the moment).

This will require updating pretty much every single source and header
file in the tree. Of course it will need a new syntax check rule to
validate this too.  Since fixing them is a serious amount of work,
syntax-check should allow exceptions to be defined per my
comment above.
I was wondering about people's opinions on this ?

The goal is just standardization to make code a little more readable.
would be a first good step. Maybe out of scope, but I would even
welcome a general source-file structuring rule set (e.g. all static
definitions first, then all externals vs a more topic-oriented grouping,
like all network related functions, then all disk related ones, etc...).


Mit freundlichen Grüßen/Kind Regards
   Viktor Mihajlovski

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]