[{"id":31017,"web_url":"https://patchwork.libcamera.org/comment/31017/","msgid":"<20240831004701.GT3811@pendragon.ideasonboard.com>","date":"2024-08-31T00:47:01","subject":"Re: [PATCH v2 20/20] libcamera: includes: Formatting improvements","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi MIlan,\n\nThank you for the patch.\n\nOn Fri, Aug 30, 2024 at 05:27:17PM +0200, Milan Zamazal wrote:\n> The LSP autoformatter doesn't like some of the current formatting, let's\n> make it happy.\n> \n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> ---\n>  include/libcamera/base/log.h                  | 22 +++++-----\n>  include/libcamera/base/span.h                 | 40 +++++++++----------\n>  include/libcamera/base/utils.h                |  2 +-\n>  include/libcamera/internal/camera_manager.h   |  4 +-\n>  .../libcamera/internal/ipa_data_serializer.h  |  7 ++--\n>  5 files changed, 38 insertions(+), 37 deletions(-)\n> \n> diff --git a/include/libcamera/base/log.h b/include/libcamera/base/log.h\n> index 62093012..38b0ab01 100644\n> --- a/include/libcamera/base/log.h\n> +++ b/include/libcamera/base/log.h\n> @@ -43,17 +43,17 @@ private:\n>  \tLogSeverity severity_;\n>  };\n>  \n> -#define LOG_DECLARE_CATEGORY(name)\t\t\t\t\t\\\n> -extern const LogCategory &_LOG_CATEGORY(name)();\n> -\n> -#define LOG_DEFINE_CATEGORY(name)\t\t\t\t\t\\\n> -LOG_DECLARE_CATEGORY(name)\t\t\t\t\t\t\\\n> -const LogCategory &_LOG_CATEGORY(name)()\t\t\t\t\\\n> -{\t\t\t\t\t\t\t\t\t\\\n> -\t/* The instance will be deleted by the Logger destructor. */\t\\\n> -\tstatic LogCategory *category = LogCategory::create(#name);\t\\\n> -\treturn *category;\t\t\t\t\t\t\\\n> -}\n> +#define LOG_DECLARE_CATEGORY(name) \\\n> +\textern const LogCategory &_LOG_CATEGORY(name)();\n> +\n> +#define LOG_DEFINE_CATEGORY(name)                                            \\\n> +\tLOG_DECLARE_CATEGORY(name)                                           \\\n> +\tconst LogCategory &_LOG_CATEGORY(name)()                             \\\n> +\t{                                                                    \\\n> +\t\t/* The instance will be deleted by the Logger destructor. */ \\\n> +\t\tstatic LogCategory *category = LogCategory::create(#name);   \\\n> +\t\treturn *category;                                            \\\n> +\t}\n\nI'd rather not.\n\n>  \n>  class LogMessage\n>  {\n> diff --git a/include/libcamera/base/span.h b/include/libcamera/base/span.h\n> index 92cce4f0..86201aa2 100644\n> --- a/include/libcamera/base/span.h\n> +++ b/include/libcamera/base/span.h\n\nNack for the whole file.\n\n> @@ -125,7 +125,7 @@ public:\n>  \tconstexpr Span(element_type (&arr)[N],\n>  \t\t       std::enable_if_t<std::is_convertible<std::remove_pointer_t<decltype(utils::data(arr))> (*)[],\n>  \t\t\t\t\t\t\t    element_type (*)[]>::value &&\n> -\t\t\t\t\tN == Extent,\n> +\t\t\t\t\t\tN == Extent,\n>  \t\t\t\t\tstd::nullptr_t> = nullptr) noexcept\n>  \t\t: data_(arr)\n>  \t{\n> @@ -135,7 +135,7 @@ public:\n>  \tconstexpr Span(std::array<value_type, N> &arr,\n>  \t\t       std::enable_if_t<std::is_convertible<std::remove_pointer_t<decltype(utils::data(arr))> (*)[],\n>  \t\t\t\t\t\t\t    element_type (*)[]>::value &&\n> -\t\t\t\t\tN == Extent,\n> +\t\t\t\t\t\tN == Extent,\n>  \t\t\t\t\tstd::nullptr_t> = nullptr) noexcept\n>  \t\t: data_(arr.data())\n>  \t{\n> @@ -145,7 +145,7 @@ public:\n>  \tconstexpr Span(const std::array<value_type, N> &arr,\n>  \t\t       std::enable_if_t<std::is_convertible<std::remove_pointer_t<decltype(utils::data(arr))> (*)[],\n>  \t\t\t\t\t\t\t    element_type (*)[]>::value &&\n> -\t\t\t\t\tN == Extent,\n> +\t\t\t\t\t\tN == Extent,\n>  \t\t\t\t\tstd::nullptr_t> = nullptr) noexcept\n>  \t\t: data_(arr.data())\n>  \t{\n> @@ -154,10 +154,10 @@ public:\n>  \ttemplate<class Container>\n>  \texplicit constexpr Span(Container &cont,\n>  \t\t\t\tstd::enable_if_t<!details::is_span<Container>::value &&\n> -\t\t\t\t\t\t !details::is_array<Container>::value &&\n> -\t\t\t\t\t\t !std::is_array<Container>::value &&\n> -\t\t\t\t\t\t std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],\n> -\t\t\t\t\t\t\t\t     element_type (*)[]>::value,\n> +\t\t\t\t\t\t\t !details::is_array<Container>::value &&\n> +\t\t\t\t\t\t\t !std::is_array<Container>::value &&\n> +\t\t\t\t\t\t\t std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],\n> +\t\t\t\t\t\t\t\t\t     element_type (*)[]>::value,\n>  \t\t\t\t\t\t std::nullptr_t> = nullptr)\n>  \t\t: data_(utils::data(cont))\n>  \t{\n> @@ -166,10 +166,10 @@ public:\n>  \ttemplate<class Container>\n>  \texplicit constexpr Span(const Container &cont,\n>  \t\t\t\tstd::enable_if_t<!details::is_span<Container>::value &&\n> -\t\t\t\t\t\t !details::is_array<Container>::value &&\n> -\t\t\t\t\t\t !std::is_array<Container>::value &&\n> -\t\t\t\t\t\t std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],\n> -\t\t\t\t\t\t\t\t     element_type (*)[]>::value,\n> +\t\t\t\t\t\t\t !details::is_array<Container>::value &&\n> +\t\t\t\t\t\t\t !std::is_array<Container>::value &&\n> +\t\t\t\t\t\t\t std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],\n> +\t\t\t\t\t\t\t\t\t     element_type (*)[]>::value,\n>  \t\t\t\t\t\t std::nullptr_t> = nullptr)\n>  \t\t: data_(utils::data(cont))\n>  \t{\n> @@ -179,7 +179,7 @@ public:\n>  \ttemplate<class U, std::size_t N>\n>  \texplicit constexpr Span(const Span<U, N> &s,\n>  \t\t\t\tstd::enable_if_t<std::is_convertible<U (*)[], element_type (*)[]>::value &&\n> -\t\t\t\t\t\t N == Extent,\n> +\t\t\t\t\t\t\t N == Extent,\n>  \t\t\t\t\t\t std::nullptr_t> = nullptr) noexcept\n>  \t\t: data_(s.data())\n>  \t{\n> @@ -316,10 +316,10 @@ public:\n>  \ttemplate<class Container>\n>  \tconstexpr Span(Container &cont,\n>  \t\t       std::enable_if_t<!details::is_span<Container>::value &&\n> -\t\t\t\t\t!details::is_array<Container>::value &&\n> -\t\t\t\t\t!std::is_array<Container>::value &&\n> -\t\t\t\t\tstd::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],\n> -\t\t\t\t\t\t\t    element_type (*)[]>::value,\n> +\t\t\t\t\t\t!details::is_array<Container>::value &&\n> +\t\t\t\t\t\t!std::is_array<Container>::value &&\n> +\t\t\t\t\t\tstd::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],\n> +\t\t\t\t\t\t\t\t    element_type (*)[]>::value,\n>  \t\t\t\t\tstd::nullptr_t> = nullptr)\n>  \t\t: data_(utils::data(cont)), size_(utils::size(cont))\n>  \t{\n> @@ -328,10 +328,10 @@ public:\n>  \ttemplate<class Container>\n>  \tconstexpr Span(const Container &cont,\n>  \t\t       std::enable_if_t<!details::is_span<Container>::value &&\n> -\t\t\t\t\t!details::is_array<Container>::value &&\n> -\t\t\t\t\t!std::is_array<Container>::value &&\n> -\t\t\t\t\tstd::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],\n> -\t\t\t\t\t\t\t    element_type (*)[]>::value,\n> +\t\t\t\t\t\t!details::is_array<Container>::value &&\n> +\t\t\t\t\t\t!std::is_array<Container>::value &&\n> +\t\t\t\t\t\tstd::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],\n> +\t\t\t\t\t\t\t\t    element_type (*)[]>::value,\n>  \t\t\t\t\tstd::nullptr_t> = nullptr)\n>  \t\t: data_(utils::data(cont)), size_(utils::size(cont))\n>  \t{\n> diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h\n> index 98c683a7..a9b27d0f 100644\n> --- a/include/libcamera/base/utils.h\n> +++ b/include/libcamera/base/utils.h\n> @@ -12,8 +12,8 @@\n>  #include <iterator>\n>  #include <ostream>\n>  #include <sstream>\n> -#include <string>\n>  #include <string.h>\n> +#include <string>\n\nTechnically, I think string.h goes after string in alphabetical order.\nHowever, sorting \"<string>\" and \"<string.h>\" moves \"<string.h>\" first.\nWhatever makes clang-format happy is fine with me for this.\n\n>  #include <sys/time.h>\n>  #include <type_traits>\n>  #include <utility>\n> diff --git a/include/libcamera/internal/camera_manager.h b/include/libcamera/internal/camera_manager.h\n> index 0150ca61..95ddf4cf 100644\n> --- a/include/libcamera/internal/camera_manager.h\n> +++ b/include/libcamera/internal/camera_manager.h\n> @@ -7,8 +7,6 @@\n>  \n>  #pragma once\n>  \n> -#include <libcamera/camera_manager.h>\n> -\n\nDone on purpose.\n\n>  #include <memory>\n>  #include <sys/types.h>\n>  #include <vector>\n> @@ -18,6 +16,8 @@\n>  #include <libcamera/base/thread.h>\n>  #include <libcamera/base/thread_annotations.h>\n>  \n> +#include <libcamera/camera_manager.h>\n> +\n>  #include \"libcamera/internal/process.h\"\n>  \n>  namespace libcamera {\n> diff --git a/include/libcamera/internal/ipa_data_serializer.h b/include/libcamera/internal/ipa_data_serializer.h\n> index 13470a89..66d9a19f 100644\n> --- a/include/libcamera/internal/ipa_data_serializer.h\n> +++ b/include/libcamera/internal/ipa_data_serializer.h\n\nAck for the whole file.\n\n> @@ -18,6 +18,7 @@\n>  #include <libcamera/control_ids.h>\n>  #include <libcamera/framebuffer.h>\n>  #include <libcamera/geometry.h>\n> +\n>  #include <libcamera/ipa/ipa_interface.h>\n>  \n>  #include \"libcamera/internal/control_serializer.h\"\n> @@ -161,7 +162,7 @@ public:\n>  \t\tstd::vector<SharedFD>::const_iterator fdIter = fdsBegin;\n>  \t\tfor (uint32_t i = 0; i < vecLen; i++) {\n>  \t\t\tuint32_t sizeofData = readPOD<uint32_t>(dataIter, 0, dataEnd);\n> -\t\t\tuint32_t sizeofFds  = readPOD<uint32_t>(dataIter, 4, dataEnd);\n> +\t\t\tuint32_t sizeofFds = readPOD<uint32_t>(dataIter, 4, dataEnd);\n>  \t\t\tdataIter += 8;\n>  \n>  \t\t\tret[i] = IPADataSerializer<V>::deserialize(dataIter,\n> @@ -268,7 +269,7 @@ public:\n>  \t\tstd::vector<SharedFD>::const_iterator fdIter = fdsBegin;\n>  \t\tfor (uint32_t i = 0; i < mapLen; i++) {\n>  \t\t\tuint32_t sizeofData = readPOD<uint32_t>(dataIter, 0, dataEnd);\n> -\t\t\tuint32_t sizeofFds  = readPOD<uint32_t>(dataIter, 4, dataEnd);\n> +\t\t\tuint32_t sizeofFds = readPOD<uint32_t>(dataIter, 4, dataEnd);\n>  \t\t\tdataIter += 8;\n>  \n>  \t\t\tK key = IPADataSerializer<K>::deserialize(dataIter,\n> @@ -280,7 +281,7 @@ public:\n>  \t\t\tdataIter += sizeofData;\n>  \t\t\tfdIter += sizeofFds;\n>  \t\t\tsizeofData = readPOD<uint32_t>(dataIter, 0, dataEnd);\n> -\t\t\tsizeofFds  = readPOD<uint32_t>(dataIter, 4, dataEnd);\n> +\t\t\tsizeofFds = readPOD<uint32_t>(dataIter, 4, dataEnd);\n>  \t\t\tdataIter += 8;\n>  \n>  \t\t\tconst V value = IPADataSerializer<V>::deserialize(dataIter,","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id E1EA4C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 31 Aug 2024 00:47:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EC5F663469;\n\tSat, 31 Aug 2024 02:47:36 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 708B0618FF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 31 Aug 2024 02:47:34 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 593AE74C;\n\tSat, 31 Aug 2024 02:46:24 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"UGAjsvo0\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1725065185;\n\tbh=aE/vnLHNR5oq2uo6f75XfH5ZHkxvhhX1YGjfvJUt7XI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=UGAjsvo0E4Uz5u9OC8dfvLRzoYooA+O1nDFmEGIsjKuJylX+WrMHfCJQzJdPnC2cr\n\tPKkzBF5aCmH11Yqib21cDI/W0XimNUx09PAiVSInG5a7DP4I9OwnCG4qAXHFkl3A/V\n\tpOPDn9ml0D99iJ0sKXKWcOIx3De+rDkxyBfB93JU=","Date":"Sat, 31 Aug 2024 03:47:01 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v2 20/20] libcamera: includes: Formatting improvements","Message-ID":"<20240831004701.GT3811@pendragon.ideasonboard.com>","References":"<20240830152721.1420313-1-mzamazal@redhat.com>\n\t<20240830152721.1420313-21-mzamazal@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240830152721.1420313-21-mzamazal@redhat.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]