From patchwork Thu May 26 11:00:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 16060 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 59F86C3256 for ; Thu, 26 May 2022 11:00:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4FB3265668; Thu, 26 May 2022 13:00:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1653562821; bh=LvRr4TI/9314rdTW4KMcUAJ33PEj+tUuERzn4R7Ick8=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=O4+39/JZr79DW9yW++xDMZkrxldFHXTH4QXQzunwDTXqr6ZduxIJURrueIeaJ2S+n zmVuooHGoBnN4Bvg7qp1fx79fOBQtr1hNnqK0ma1CMEPSlBDH5D+CF09NOkSin2WGt Ot5KxaprmaogcZOIhzyE52U6wju8b8mvieA7d6KYc3MIB31dbMOWBK4ULsrWgD43t2 debWpJHSs1W6rjftQfhVNh7KZhfscv36Kl4XIiQiwFRjCdbzBMmvAARp7DCMelFWPg 23nT8974v2qq6ob0/xYnoGvpugg6T45fDTR0hc74kxl3R/NqSQj1/ZO9AGY/rIi/I8 OHx+W08UK+VbQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5273D65660 for ; Thu, 26 May 2022 13:00:19 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="jm7Bf4qf"; dkim-atps=neutral Received: from pendragon.lan (unknown [37.120.212.14]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E2A53898 for ; Thu, 26 May 2022 13:00:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1653562819; bh=LvRr4TI/9314rdTW4KMcUAJ33PEj+tUuERzn4R7Ick8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jm7Bf4qf5bV6EjZ2OW0sNTw4UfpJbdsfgAslbASW7zUP/WOJGWBDSUWBjeI8jDbGG aZh28f/akjsmHIuiR4EHyNbVr7pa8Ec9uE6pxQ1X+FJAH8Ogf5e8p1boBreXta1okX LgsUTJruTOQzOUe3NaVPTscw8jg4cp32vUx1uQXo= To: libcamera-devel@lists.libcamera.org Date: Thu, 26 May 2022 14:00:07 +0300 Message-Id: <20220526110009.13874-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220526110009.13874-1-laurent.pinchart@ideasonboard.com> References: <20220526110009.13874-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/3] utils: checkstyle: Run the ClangFormatter last 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-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The IncludeOrderFormatter will be extended with more formatting rules that should be applied before clang-format gets run, as it will influence its output. Add a priority mechanism for formatters, and give a negative priority to the ClangFormatter to make it run last. Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain Reviewed-by: Paul Elder --- utils/checkstyle.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/checkstyle.py b/utils/checkstyle.py index 835f2a9fcd71..66af96abd402 100755 --- a/utils/checkstyle.py +++ b/utils/checkstyle.py @@ -279,6 +279,8 @@ class ClassRegistry(type): newclass = super().__new__(cls, clsname, bases, attrs) if bases: bases[0].subclasses.append(newclass) + bases[0].subclasses.sort(key=lambda x: getattr(x, 'priority', 0), + reverse=True) return newclass @@ -568,6 +570,7 @@ class Formatter(metaclass=ClassRegistry): class CLangFormatter(Formatter): patterns = ('*.c', '*.cpp', '*.h') + priority = -1 @classmethod def format(cls, filename, data): From patchwork Thu May 26 11:00:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 16061 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 4A32BC326D for ; Thu, 26 May 2022 11:00:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 239B365665; Thu, 26 May 2022 13:00:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1653562823; bh=MQH0YRTF3qDClE7iU422wz2lP3V+H8lW4am8/WGpPns=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Ye7HS8Z+qQVmvtaAv8YofLolzAUGGWevAGfuiuL1jdI3V/hiGIDspCLqQZY7moCO5 FNbXWLLZCrciB5JKOmza/zwW3SfA7F8PngisKtmYH2CxXvExRD8wmUh0GrWPZ/VUsF 2YUODfWqo28KV6274jU055fCmlx3JRzSEab3y1WkO/5387ifkBxxabcmgvoPVPNUvh cfufnLCe6gQZs7xPUaPV/Cw4Jr3hqz3i6LN3D2QpVv5h80e5vntqgpA5L58pckTTDI 89KxbjIBtvDc9TJx7T9ANb/3xO7epvd9znHPToHOqev/CzJX5WpkZU9oRl42QPNnzo imBKhXbChzS9A== 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 F12F160418 for ; Thu, 26 May 2022 13:00:19 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="JUSi0hrL"; dkim-atps=neutral Received: from pendragon.lan (unknown [37.120.212.14]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8751F6D4 for ; Thu, 26 May 2022 13:00:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1653562819; bh=MQH0YRTF3qDClE7iU422wz2lP3V+H8lW4am8/WGpPns=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JUSi0hrLpDgrz0jenNWjdysHCxemSpx334ysLP7ib8QPL4Y8EBgNkQiUWyu6lIj7V uSxVTSX22CUxBp/BsS+a9wWLknkDvEqhv/glnGrU4/sAgvPMndQrDzG6YjdKiNFfkG JZc2QK0/eowzZFeCyVv1K3tjM9FRc3jU4Cp45m1c= To: libcamera-devel@lists.libcamera.org Date: Thu, 26 May 2022 14:00:08 +0300 Message-Id: <20220526110009.13874-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220526110009.13874-1-laurent.pinchart@ideasonboard.com> References: <20220526110009.13874-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/3] utils: checkstyle: Ensure "..." include style for internal headers 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-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" libcamera uses the "..." include style for internal headers. Enforce it. Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain Reviewed-by: Paul Elder --- utils/checkstyle.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/utils/checkstyle.py b/utils/checkstyle.py index 66af96abd402..61783165bef2 100755 --- a/utils/checkstyle.py +++ b/utils/checkstyle.py @@ -643,7 +643,7 @@ class DPointerFormatter(Formatter): class IncludeOrderFormatter(Formatter): patterns = ('*.cpp', '*.h') - include_regex = re.compile('^#include ["<]([^">]*)[">]') + include_regex = re.compile('^#include (["<])([^">]*)([">])') @classmethod def format(cls, filename, data): @@ -657,7 +657,21 @@ class IncludeOrderFormatter(Formatter): if match: # If the current line is an #include statement, add it to the # includes group and continue to the next line. - includes.append((line, match.group(1))) + open_token = match.group(1) + file_name = match.group(2) + close_token = match.group(3) + + # Ensure the "..." include style for internal headers and the + # <...> style for all other libcamera headers. + if (file_name.startswith('libcamera/internal')): + open_token = '"' + close_token = '"' + elif (file_name.startswith('libcamera/')): + open_token = '<' + close_token = '>' + + line = f'#include {open_token}{file_name}{close_token}' + includes.append((line, file_name)) continue # The current line is not an #include statement, output the sorted From patchwork Thu May 26 11:00:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 16062 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 2F17BC326E for ; Thu, 26 May 2022 11:00:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9B8AA6566E; Thu, 26 May 2022 13:00:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1653562823; bh=GRDxw18Eyf3vesUTXpjTRHMLyh41ytFc26qgoqRoYBA=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=n1ahQzYqsKtxwWAfV1g+mKataR0RNS5tJwdJxdA8NjuVisigLyZKAwAHECQlemhlk Frq/SdlkIzE7OsoL1GtUsZfnwkX6vc78pRVzuRyEmoho0VYg/VCxi5Dd30t25ZiY7/ XdfiaTlHCzCwbcTdg+uWrnrAiH/pJedyogYk+Hnff021bptfvCtrSdRGIL9o/wON8m JuHRJCeIzOLHam0F8eCmn665VMId0+uWJrittq0FwDBFK2eJkGvsZtTD6UpMSn45cs xAIEsHzqsKlom4wwX0RhD0Zsk1201CUAlmi/cdRYdH+dpXgCwx7COLl9kP3jKpGu3h iJNT3USC2fZ0Q== 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 C143A65665 for ; Thu, 26 May 2022 13:00:20 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="FxzDCDDj"; dkim-atps=neutral Received: from pendragon.lan (unknown [37.120.212.14]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 104736D4 for ; Thu, 26 May 2022 13:00:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1653562820; bh=GRDxw18Eyf3vesUTXpjTRHMLyh41ytFc26qgoqRoYBA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=FxzDCDDjuM76fEp90qPGccnUkmVrdMzVe+cz8IUJCS8fjVscmBxfJDEb8zCG2gZck xkW+QZW0oPCW3o3g19RmcLq551e+ZTDqBv0303IhqOqf58Q/g78xs37RbZlDKP6EV2 1MeQrH1CAbzxEOWYYfeuNOmLpaUQkI0uNkrKJJE0= To: libcamera-devel@lists.libcamera.org Date: Thu, 26 May 2022 14:00:09 +0300 Message-Id: <20220526110009.13874-4-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220526110009.13874-1-laurent.pinchart@ideasonboard.com> References: <20220526110009.13874-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/3] libcamera: Use "..." instead of <...> consistently for internal headers 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-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" libcamera uses double quotes for #include directives for internal headers. A few <...> have found their way in the code base over time. Fix them. While at it, move an Android header include to the right location. Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain Reviewed-by: Paul Elder --- src/android/camera_hal_config.cpp | 6 +++--- src/ipa/rkisp1/rkisp1.cpp | 2 +- test/yaml-parser.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/android/camera_hal_config.cpp b/src/android/camera_hal_config.cpp index 28072cb86285..8ba8738cc6b6 100644 --- a/src/android/camera_hal_config.cpp +++ b/src/android/camera_hal_config.cpp @@ -10,11 +10,11 @@ #include #include -#include - #include -#include +#include "libcamera/internal/yaml_parser.h" + +#include using namespace libcamera; diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index c818a6d71afc..7d6f0b39bb78 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include "libcamera/internal/mapped_framebuffer.h" #include "algorithms/agc.h" #include "algorithms/algorithm.h" diff --git a/test/yaml-parser.cpp b/test/yaml-parser.cpp index 652adf53d0cc..5315d99fae5d 100644 --- a/test/yaml-parser.cpp +++ b/test/yaml-parser.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include "libcamera/internal/yaml_parser.h" #include "test.h"