From patchwork Fri Jul 16 15:16:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 13032 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 3A906C3226 for ; Fri, 16 Jul 2021 15:16:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8059268539; Fri, 16 Jul 2021 17:16:47 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Y+MCUd2T"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 774D768521 for ; Fri, 16 Jul 2021 17:16:46 +0200 (CEST) Received: from Monstersaurus.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EBC0B3F0; Fri, 16 Jul 2021 17:16:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1626448606; bh=ujQ1k2un4HI92ZHixSJ7ewnnFuJP22e+1/InVc5famU=; h=From:To:Cc:Subject:Date:From; b=Y+MCUd2T4OfPz6MPKRUGT27GzhaCA1OEmAUvuHiDuy4oh6R6IeujXo19sncc5ZVj4 yTd8wM/oZ83tv9iqB2RaL/G3brGThMTUJynKoO8pgnfIzy/GijYzyMo/Af1D/PSlPr qkX+jmsoiDqEPM/i6Syx/gXhLLOcMS5idFZYoFT4= From: Kieran Bingham To: libcamera devel Date: Fri, 16 Jul 2021 16:16:42 +0100 Message-Id: <20210716151642.500178-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH] clang-format: Regroup sort orders 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Utilise the clang-format header sort to provide a regex based pattern match for our header inclusion coding style. Signed-off-by: Kieran Bingham --- I used this mostly during the libcamera-base split, but it's worth considering and perhaps adapting to see if it helps in general. May still need some tweaking and adjustments - but here's the initial version for anyone who wants to try it or even for us to integrate and update as we identify any more cases or corners... .clang-format | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/.clang-format b/.clang-format index 3a8a896e373d..5ecba901db15 100644 --- a/.clang-format +++ b/.clang-format @@ -66,10 +66,41 @@ ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true ForEachMacros: - 'udev_list_entry_foreach' -IncludeBlocks: Preserve +SortIncludes: true +IncludeBlocks: Regroup IncludeCategories: - - Regex: '.*' - Priority: 1 + # Headers in <> with or without extension. (system libraries) + - Regex: '<([A-Za-z0-9\-_])+.h>' + Priority: 1 + - Regex: '' + Priority: 1 + # Linux headers, as a second group/subset of system headers + - Regex: '' + Priority: 2 + # C++ library includes (no .h) + - Regex: '<([A-Za-z0-9\-_])+>' + Priority: 3 + # Headers for Base support + - Regex: '' + Priority: 4 + - Regex: '' + Priority: 5 + # Headers for libcamera, which are not in a subdir (i.e. ipa/,internal/) + - Regex: '' + Priority: 6 + # IPA Interfaces + - Regex: '' + Priority: 7 + # libcamera Internal headers in "" + - Regex: '"libcamera/internal/.*\.h"' + Priority: 8 + # local modular includes + - Regex: '".*/.*\.h"' + Priority: 9 + # Other local headers "" with extension. + - Regex: '"([A-Za-z0-9.\/-_])+"' + Priority: 10 + IncludeIsMainRegex: '(_test)?$' IndentCaseLabels: false IndentPPDirectives: None