[{"id":16384,"web_url":"https://patchwork.libcamera.org/comment/16384/","msgid":"<YH67MXUCWKles3XC@oden.dyn.berto.se>","date":"2021-04-20T11:29:53","subject":"Re: [libcamera-devel] [PATCH v2 1/2] libcamera: Drop argument from\n\tLIBCAMERA_DECLARE_PRIVATE","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your work.\n\nOn 2021-04-20 11:38:58 +0200, Jacopo Mondi wrote:\n> The LIBCAMERA_DECLARE_PRIVATE() macro, used by the library classes\n> that inherits from libcamera::Extensible in order to implement the\n> PIMPL pattern, expands to:\n> \n> public:\t\t\t\t\t\t\t\t\t\\\n> \tclass Private;\t\t\t\t\t\t\t\\\n> \tfriend class Private;\n> \n> The 'klass' argument is not used and it might confuse developers as\n> it might hint that the class that defines the pattern's implementation\n> can be freely named, while it is actually hardcoded to 'Private'.\n> \n> Drop the argument from the macro definition.\n> \n> Reviewed-by: Hanlin Chen <hanlinchen@google.com>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  include/libcamera/camera.h         | 2 +-\n>  include/libcamera/camera_manager.h | 2 +-\n>  include/libcamera/class.h          | 4 ++--\n>  src/android/camera_buffer.h        | 2 +-\n>  src/libcamera/class.cpp            | 4 +---\n>  5 files changed, 6 insertions(+), 8 deletions(-)\n> \n> diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\n> index 326b14d0ca01..d71641805c0a 100644\n> --- a/include/libcamera/camera.h\n> +++ b/include/libcamera/camera.h\n> @@ -74,7 +74,7 @@ protected:\n>  class Camera final : public Object, public std::enable_shared_from_this<Camera>,\n>  \t\t     public Extensible\n>  {\n> -\tLIBCAMERA_DECLARE_PRIVATE(Camera)\n> +\tLIBCAMERA_DECLARE_PRIVATE()\n> \n>  public:\n>  \tstatic std::shared_ptr<Camera> create(PipelineHandler *pipe,\n> diff --git a/include/libcamera/camera_manager.h b/include/libcamera/camera_manager.h\n> index 35a59f0df4ca..c2f0b786da8e 100644\n> --- a/include/libcamera/camera_manager.h\n> +++ b/include/libcamera/camera_manager.h\n> @@ -22,7 +22,7 @@ class Camera;\n> \n>  class CameraManager : public Object, public Extensible\n>  {\n> -\tLIBCAMERA_DECLARE_PRIVATE(CameraManager)\n> +\tLIBCAMERA_DECLARE_PRIVATE()\n>  public:\n>  \tCameraManager();\n>  \t~CameraManager();\n> diff --git a/include/libcamera/class.h b/include/libcamera/class.h\n> index 920624d8e726..466114ecfaf4 100644\n> --- a/include/libcamera/class.h\n> +++ b/include/libcamera/class.h\n> @@ -30,7 +30,7 @@ namespace libcamera {\n>  #endif\n> \n>  #ifndef __DOXYGEN__\n> -#define LIBCAMERA_DECLARE_PRIVATE(klass)\t\t\t\t\\\n> +#define LIBCAMERA_DECLARE_PRIVATE()\t\t\t\t\t\\\n>  public:\t\t\t\t\t\t\t\t\t\\\n>  \tclass Private;\t\t\t\t\t\t\t\\\n>  \tfriend class Private;\n> @@ -46,7 +46,7 @@ public:\t\t\t\t\t\t\t\t\t\\\n>  \t_o<Public>();\n> \n>  #else\n> -#define LIBCAMERA_DECLARE_PRIVATE(klass)\n> +#define LIBCAMERA_DECLARE_PRIVATE()\n>  #define LIBCAMERA_DECLARE_PUBLIC(klass)\n>  #define LIBCAMERA_D_PTR(klass)\n>  #define LIBCAMERA_O_PTR(klass)\n> diff --git a/src/android/camera_buffer.h b/src/android/camera_buffer.h\n> index 7e8970b49f49..c88124b2b3f3 100644\n> --- a/src/android/camera_buffer.h\n> +++ b/src/android/camera_buffer.h\n> @@ -14,7 +14,7 @@\n> \n>  class CameraBuffer final : public libcamera::Extensible\n>  {\n> -\tLIBCAMERA_DECLARE_PRIVATE(CameraBuffer)\n> +\tLIBCAMERA_DECLARE_PRIVATE()\n> \n>  public:\n>  \tCameraBuffer(buffer_handle_t camera3Buffer, int flags);\n> diff --git a/src/libcamera/class.cpp b/src/libcamera/class.cpp\n> index 340b7de7911c..171f7c0a927b 100644\n> --- a/src/libcamera/class.cpp\n> +++ b/src/libcamera/class.cpp\n> @@ -77,12 +77,10 @@ namespace libcamera {\n>  /**\n>   * \\def LIBCAMERA_DECLARE_PRIVATE\n>   * \\brief Declare private data for a public class\n> - * \\param klass The public class name\n>   *\n>   * The LIBCAMERA_DECLARE_PRIVATE() macro plumbs the infrastructure necessary to\n>   * make a class manage its private data through a d-pointer. It shall be used at\n> - * the very top of the class definition, with the public class name passed as\n> - * the \\a klass parameter.\n> + * the very top of the class definition.\n>   */\n> \n>  /**\n> --\n> 2.31.1\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 1FB96BDB15\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 20 Apr 2021 11:29:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9509B68839;\n\tTue, 20 Apr 2021 13:29:58 +0200 (CEST)","from mail-lj1-x229.google.com (mail-lj1-x229.google.com\n\t[IPv6:2a00:1450:4864:20::229])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E364A60516\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Apr 2021 13:29:56 +0200 (CEST)","by mail-lj1-x229.google.com with SMTP id a25so29806889ljm.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Apr 2021 04:29:56 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\tb23sm30634lfe.284.2021.04.20.04.29.54\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 20 Apr 2021 04:29:54 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"C+DVCDg/\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=5Rg+kszP6qK3dVMM8R5ZiE0/oCvhYyjGSOfAoyLSDiw=;\n\tb=C+DVCDg/2pd6IZFbu1bsmcHiOe33nQRL/UcVEg3NMwNSxL75LcEI0Hp9k0+IoUnZk4\n\tiOLhJovV6daR+1H5KftB66ylNP6zN6kMbeNbEjfqmWwZgg+kB8UInY0R0HadGCbeC8Dr\n\t6/yXSbkW9Fsrlky43FnLBuBBJbs/M6d6PVGuOgl8ojq4WcfmbwOKIbMMjBPJY2pRJo/5\n\tjRkFs1jABrRjlcJxCMJWXaWIA109JAfouU2brkWOLjpDs8jLIf2ZJTAItVDvy6QIvzmX\n\t1PPiVKC1I0nc2z38VGX0CqOr2Mu/B0H0yLzunsJLOmrR1dZnenUWmWLlGD41ggMGn+Ky\n\tAGkg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=5Rg+kszP6qK3dVMM8R5ZiE0/oCvhYyjGSOfAoyLSDiw=;\n\tb=Kop6D7ufSnpq53U5qZ+bm79I4uMml3f1/B9QrcjyqbDpcWifLH+QRSEdLdNohQJj5f\n\tN8+MU1UCLkvOohrApZatDWtxTmiYUd0pJ8GddnrxBBvKNnTQie7HSryxyZceC3h8y+kj\n\to/Ps0uCSzQOq+xD9E+Adxp66bbx8yXSF+lK+EKQ/RxRogiQZyfc/RxZHmp1NVG8NRcpP\n\tCFN93fgxaMKqLxXGQl8Amh97N4wxeXS9EMtF+IfDThDc7L9vwKUcncdGoAGJVbiykiM1\n\tgaPqF9dMDEugyDN5Jba6pFvYtE5U3DPN8W4ED2/EU/N7E1EzfHo0Dpt53s19n0owEqXv\n\t+X/A==","X-Gm-Message-State":"AOAM530KrFPC+t+dUxI8AKbPZI+Js1edsHQJ+1aNkUFHCs4T+scVdlBi\n\t88v85UToLKejOSTITLkAJwmpVfPrIUiw5V6T","X-Google-Smtp-Source":"ABdhPJytGVpngwaQ+K1Dm09ZVZZp+bG45QGWdDBOQWTeMnVmiaqyIurl5JUp+JaproOM8g4p+XMItg==","X-Received":"by 2002:a05:651c:1425:: with SMTP id\n\tu37mr2067976lje.271.1618918196285; \n\tTue, 20 Apr 2021 04:29:56 -0700 (PDT)","Date":"Tue, 20 Apr 2021 13:29:53 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YH67MXUCWKles3XC@oden.dyn.berto.se>","References":"<20210420093859.14280-1-jacopo@jmondi.org>\n\t<20210420093859.14280-2-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210420093859.14280-2-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v2 1/2] libcamera: Drop argument from\n\tLIBCAMERA_DECLARE_PRIVATE","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":16419,"web_url":"https://patchwork.libcamera.org/comment/16419/","msgid":"<YH9a/UgqJDcyeIXw@pendragon.ideasonboard.com>","date":"2021-04-20T22:51:41","subject":"Re: [libcamera-devel] [PATCH v2 1/2] libcamera: Drop argument from\n\tLIBCAMERA_DECLARE_PRIVATE","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Tue, Apr 20, 2021 at 11:38:58AM +0200, Jacopo Mondi wrote:\n> The LIBCAMERA_DECLARE_PRIVATE() macro, used by the library classes\n> that inherits from libcamera::Extensible in order to implement the\n\ns/inherits/inherit/\n\n> PIMPL pattern, expands to:\n> \n> public:\t\t\t\t\t\t\t\t\t\\\n> \tclass Private;\t\t\t\t\t\t\t\\\n> \tfriend class Private;\n> \n> The 'klass' argument is not used and it might confuse developers as\n> it might hint that the class that defines the pattern's implementation\n> can be freely named, while it is actually hardcoded to 'Private'.\n> \n> Drop the argument from the macro definition.\n> \n> Reviewed-by: Hanlin Chen <hanlinchen@google.com>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  include/libcamera/camera.h         | 2 +-\n>  include/libcamera/camera_manager.h | 2 +-\n>  include/libcamera/class.h          | 4 ++--\n>  src/android/camera_buffer.h        | 2 +-\n>  src/libcamera/class.cpp            | 4 +---\n>  5 files changed, 6 insertions(+), 8 deletions(-)\n> \n> diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\n> index 326b14d0ca01..d71641805c0a 100644\n> --- a/include/libcamera/camera.h\n> +++ b/include/libcamera/camera.h\n> @@ -74,7 +74,7 @@ protected:\n>  class Camera final : public Object, public std::enable_shared_from_this<Camera>,\n>  \t\t     public Extensible\n>  {\n> -\tLIBCAMERA_DECLARE_PRIVATE(Camera)\n> +\tLIBCAMERA_DECLARE_PRIVATE()\n> \n>  public:\n>  \tstatic std::shared_ptr<Camera> create(PipelineHandler *pipe,\n> diff --git a/include/libcamera/camera_manager.h b/include/libcamera/camera_manager.h\n> index 35a59f0df4ca..c2f0b786da8e 100644\n> --- a/include/libcamera/camera_manager.h\n> +++ b/include/libcamera/camera_manager.h\n> @@ -22,7 +22,7 @@ class Camera;\n> \n>  class CameraManager : public Object, public Extensible\n>  {\n> -\tLIBCAMERA_DECLARE_PRIVATE(CameraManager)\n> +\tLIBCAMERA_DECLARE_PRIVATE()\n>  public:\n>  \tCameraManager();\n>  \t~CameraManager();\n> diff --git a/include/libcamera/class.h b/include/libcamera/class.h\n> index 920624d8e726..466114ecfaf4 100644\n> --- a/include/libcamera/class.h\n> +++ b/include/libcamera/class.h\n> @@ -30,7 +30,7 @@ namespace libcamera {\n>  #endif\n> \n>  #ifndef __DOXYGEN__\n> -#define LIBCAMERA_DECLARE_PRIVATE(klass)\t\t\t\t\\\n> +#define LIBCAMERA_DECLARE_PRIVATE()\t\t\t\t\t\\\n>  public:\t\t\t\t\t\t\t\t\t\\\n>  \tclass Private;\t\t\t\t\t\t\t\\\n>  \tfriend class Private;\n> @@ -46,7 +46,7 @@ public:\t\t\t\t\t\t\t\t\t\\\n>  \t_o<Public>();\n> \n>  #else\n> -#define LIBCAMERA_DECLARE_PRIVATE(klass)\n> +#define LIBCAMERA_DECLARE_PRIVATE()\n>  #define LIBCAMERA_DECLARE_PUBLIC(klass)\n>  #define LIBCAMERA_D_PTR(klass)\n>  #define LIBCAMERA_O_PTR(klass)\n> diff --git a/src/android/camera_buffer.h b/src/android/camera_buffer.h\n> index 7e8970b49f49..c88124b2b3f3 100644\n> --- a/src/android/camera_buffer.h\n> +++ b/src/android/camera_buffer.h\n> @@ -14,7 +14,7 @@\n> \n>  class CameraBuffer final : public libcamera::Extensible\n>  {\n> -\tLIBCAMERA_DECLARE_PRIVATE(CameraBuffer)\n> +\tLIBCAMERA_DECLARE_PRIVATE()\n> \n>  public:\n>  \tCameraBuffer(buffer_handle_t camera3Buffer, int flags);\n> diff --git a/src/libcamera/class.cpp b/src/libcamera/class.cpp\n> index 340b7de7911c..171f7c0a927b 100644\n> --- a/src/libcamera/class.cpp\n> +++ b/src/libcamera/class.cpp\n> @@ -77,12 +77,10 @@ namespace libcamera {\n>  /**\n>   * \\def LIBCAMERA_DECLARE_PRIVATE\n>   * \\brief Declare private data for a public class\n> - * \\param klass The public class name\n>   *\n>   * The LIBCAMERA_DECLARE_PRIVATE() macro plumbs the infrastructure necessary to\n>   * make a class manage its private data through a d-pointer. It shall be used at\n> - * the very top of the class definition, with the public class name passed as\n> - * the \\a klass parameter.\n> + * the very top of the class definition.\n>   */\n> \n>  /**","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 5C085BDB16\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 20 Apr 2021 22:51:47 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9E5B568842;\n\tWed, 21 Apr 2021 00:51:46 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D267F602C8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Apr 2021 00:51:45 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4160445E;\n\tWed, 21 Apr 2021 00:51:45 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"CB/Hr8rm\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1618959105;\n\tbh=F9lZng+JM+lFvOC0TQFxe9/Z2eMbm7bNy/aPOqqXli4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=CB/Hr8rmOqS74CeJjJBZtfo65iQWpir0QxIpEDaID3IDqwteiFjH3Hm0G1eTJuixi\n\tqvCAzI8EX97242FRDxJwHQQ5WpKIn/03g7suvK2FE3DpiLnCztcFU8I7jb+fGy9WEG\n\tRL0pp6hVYO8b5GF0s0xr9NadcC2NLeUSwuZCvc0g=","Date":"Wed, 21 Apr 2021 01:51:41 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YH9a/UgqJDcyeIXw@pendragon.ideasonboard.com>","References":"<20210420093859.14280-1-jacopo@jmondi.org>\n\t<20210420093859.14280-2-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210420093859.14280-2-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v2 1/2] libcamera: Drop argument from\n\tLIBCAMERA_DECLARE_PRIVATE","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]