From patchwork Wed Oct 23 13:52:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2212 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3FB2C6138D for ; Wed, 23 Oct 2019 15:54:01 +0200 (CEST) Received: from pendragon.ideasonboard.com (143.121.2.93.rev.sfr.net [93.2.121.143]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D946F814 for ; Wed, 23 Oct 2019 15:54:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1571838840; bh=0qI1bjkBKakM0C0NEQRoFbFrjCAnpDloioehclwe/hQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DHCmyPXfFpc7DSpkSbOnq5eO7c1n7NlrAeVw5N2YkpDCyrGx69kdziJ/v91va1mxS /fAhbXLvjap2nSZmmmJhXin5aG3GDOneOkwqxVzPe+6t796TbCNYw1OFWeBfqGdlKl Ut+oeLB8Xgzu/eLCECgxkO+v8h/DcgHuyT1Mv7ds= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Wed, 23 Oct 2019 16:52:56 +0300 Message-Id: <20191023135258.32256-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191023135258.32256-1-laurent.pinchart@ideasonboard.com> References: <20191023135258.32256-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/4] Documentation: coding-style: Document order of includes X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 13:54:01 -0000 We follow the Google C++ Style Guide rule on include ordering with a few tweaks. Document our rule explicitly. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- Documentation/coding-style.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Documentation/coding-style.rst b/Documentation/coding-style.rst index ced3155169a6..c53248234c34 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 ------------------