DOC: minor update to coding style file

It used to still refrence includes/{types,proto,common}/, now turned
to import/ and haproxy/.
This commit is contained in:
Willy Tarreau 2020-07-07 16:21:19 +02:00
parent 4ced4bd426
commit bdc62096fc
1 changed files with 13 additions and 16 deletions

View File

@ -1,4 +1,4 @@
2015/09/21 - HAProxy coding style - Willy Tarreau <w@1wt.eu> 2020/07/07 - HAProxy coding style - Willy Tarreau <w@1wt.eu>
------------------------------------------------------------ ------------------------------------------------------------
A number of contributors are often embarrassed with coding style issues, they A number of contributors are often embarrassed with coding style issues, they
@ -1149,11 +1149,10 @@ is to be used :
------------ ------------
Includes are as much as possible listed in alphabetically ordered groups : Includes are as much as possible listed in alphabetically ordered groups :
- the libc-standard includes (those without any path component)
- the includes more or less system-specific (sys/*, netinet/*, ...) - the includes more or less system-specific (sys/*, netinet/*, ...)
- includes from the local "common" subdirectory - the libc-standard includes (those without any path component)
- includes from the local "types" subdirectory - includes from the local "import" subdirectory
- includes from the local "proto" subdirectory - includes from the local "haproxy" subdirectory
Each section is just visually delimited from the other ones using an empty Each section is just visually delimited from the other ones using an empty
line. The two first ones above may be merged into a single section depending on line. The two first ones above may be merged into a single section depending on
@ -1163,19 +1162,17 @@ hard to find which ones are needed later. Just include what you need and if
possible in alphabetical order so that when something is missing, it becomes possible in alphabetical order so that when something is missing, it becomes
obvious where to look for it and where to add it. obvious where to look for it and where to add it.
All files should include <common/config.h> because this is where build options All files should include <haproxy/api.h> because this is where build options
are prepared. are prepared.
Header files are split in two directories ("types" and "proto") depending on Haproxy header files are split in two, those exporting the types only (named
what they provide. Types, structures, enums and #defines must go into the with a trailing "-t") and those exporting variables, functions and inline
"types" directory. Function prototypes and inlined functions must go into the functions. Types, structures, enums and #defines must go into the types files
"proto" directory. This split is because of inlined functions which which are the only ones that may be included by othertype files. Function
cross-reference types from other files, which cause a chicken-and-egg problem prototypes and inlined functions must go into the main files. This split is
if the functions and types are declared at the same place. because of inlined functions which cross-reference types from other files,
which cause a chicken-and-egg problem if the functions and types are declared
All headers which do not depend on anything currently go to the "common" at the same place.
subdirectory, but are equally well placed into the "proto" directory. It is
possible that one day the "common" directory will disappear.
Include files must be protected against multiple inclusion using the common Include files must be protected against multiple inclusion using the common
#ifndef/#define/#endif trick with a tag derived from the include file and its #ifndef/#define/#endif trick with a tag derived from the include file and its