diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-10-23 16:23:47 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-10-23 17:12:30 +0300 |
commit | 73a11cbf78342ecc875709e92abacee165530823 (patch) | |
tree | 1729622e88f732967150eec211aa0cde81c7d6cc /Documentation/coding-style.rst | |
parent | c98407bb2fdb58d2d0f66f96904661a628d4a3af (diff) |
Documentation: coding-style: Document order of includes
We follow the Google C++ Style Guide rule on include ordering with a few
tweaks. Document our rule explicitly.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'Documentation/coding-style.rst')
-rw-r--r-- | Documentation/coding-style.rst | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Documentation/coding-style.rst b/Documentation/coding-style.rst index ced31551..c5324823 100644 --- a/Documentation/coding-style.rst +++ b/Documentation/coding-style.rst @@ -61,6 +61,29 @@ document: Code Style for indentation, braces, spacing, etc * Header guards are formatted as '__LIBCAMERA_FILE_NAME_H__' +Order of Includes +~~~~~~~~~~~~~~~~~ + +Headers shall be included at the beginning of .c, .cpp and .h files, right +after the file description comment block and, for .h files, the header guard +macro. For .cpp files, if the file implements an API declared in a header file, +that header file shall be included first in order to ensure it is +self-contained. + +The headers shall be grouped and ordered as follows. + + # The header declaring the API being implemented (if any) + # The C and C++ system and standard library headers + # Other libraries' headers, with one group per library + # Other project's headers + +Groups of headers shall be separated by a single blank line. Headers within +each group shall be sorted alphabetically. + +System and library headers shall be included with angle brackets. Project +headers shall be included with angle brackets for the libcamera public API +headers, and with double quotes for other libcamera headers. + C++ Specific Rules ------------------ |