[{"id":32522,"web_url":"https://patchwork.libcamera.org/comment/32522/","msgid":"<20241204162151.GC10736@pendragon.ideasonboard.com>","date":"2024-12-04T16:21:51","subject":"Re: [PATCH v1] libcamera: utils: StringSplitter: Add `operator==`","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Barnabás,\n\nThank you for the patch.\n\nOn Wed, Dec 04, 2024 at 02:54:24PM +0000, Barnabás Pőcze wrote:\n> If `cpp_debugstl=true` in the build configuration, then libstdc++ will\n> try to use `operator==` and the build will fail.\n\nI didn't know about cpp_debugstl. Is that something we should enable in\nCI debug builds ?\n\n> Implement `operator==` in terms of `operator!=` to avoid the build failure.\n> \n> Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n> ---\n>  include/libcamera/base/utils.h | 4 ++++\n>  1 file changed, 4 insertions(+)\n> \n> diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h\n> index 957150cb..782d5c97 100644\n> --- a/include/libcamera/base/utils.h\n> +++ b/include/libcamera/base/utils.h\n> @@ -205,6 +205,10 @@ public:\n>  \t\titerator &operator++();\n>  \t\tstd::string operator*() const;\n>  \t\tbool operator!=(const iterator &other) const;\n> +\t\tbool operator==(const iterator &other) const\n> +\t\t{\n> +\t\t\treturn !(*this != other);\n> +\t\t}\n\nShould we make operator!=() inline while at it ? It's a trivial\nfunction, and it would let the compiler optimize the operator==()\nimplementation. Actually, maybe we should instead define operator==() as\nthe canonical comparison operator, and implemente operator!=() as\n!operator==(). I think that's what we usually do.\n\n>  \n>  \tprivate:\n>  \t\tconst StringSplitter *ss_;","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 08787BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  4 Dec 2024 16:22:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D3556660C8;\n\tWed,  4 Dec 2024 17:22:05 +0100 (CET)","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 B6D7C618B5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  4 Dec 2024 17:22:02 +0100 (CET)","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 63AF86D6;\n\tWed,  4 Dec 2024 17:21:34 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"F9b2aHov\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1733329294;\n\tbh=hlEtjHJlNbgtUiOzfdjrDaTD0T/6KujJem16HFyErog=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=F9b2aHov+BaJe9RCYf5ZYl1HhI3pRXH6UaBOxKEqFofYRFwh5+aB448oemx+rFznJ\n\toQoa0ErihVv7Jri+HjsAvWwx70jAnsPgwXLu58P9WjPczKuFBpqxGcAS66qwShJ1g8\n\tkphA/rmpObn/7cFzjyeNrYJ70oZsGjMy5iebdn8U=","Date":"Wed, 4 Dec 2024 18:21:51 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v1] libcamera: utils: StringSplitter: Add `operator==`","Message-ID":"<20241204162151.GC10736@pendragon.ideasonboard.com>","References":"<20241204145422.968446-1-pobrn@protonmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20241204145422.968446-1-pobrn@protonmail.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>"}},{"id":32529,"web_url":"https://patchwork.libcamera.org/comment/32529/","msgid":"<REhMffOjErGUR0nUTFMvtcFoKVyZYLJrn5tp3bOkzkfUNiY23TR-I61rJ_PR3u25c4rHgNN8TCUsm0tdAcjmZmbQddG4CvUf95D_ezq7QSw=@protonmail.com>","date":"2024-12-04T17:57:13","subject":"Re: [PATCH v1] libcamera: utils: StringSplitter: Add `operator==`","submitter":{"id":133,"url":"https://patchwork.libcamera.org/api/people/133/","name":"Pőcze Barnabás","email":"pobrn@protonmail.com"},"content":"Hi\n\n\n2024. december 4., szerda 17:21 keltezéssel, Laurent Pinchart <laurent.pinchart@ideasonboard.com> írta:\n\n> Hi Barnabás,\n> \n> Thank you for the patch.\n> \n> On Wed, Dec 04, 2024 at 02:54:24PM +0000, Barnabás Pőcze wrote:\n> > If `cpp_debugstl=true` in the build configuration, then libstdc++ will\n> > try to use `operator==` and the build will fail.\n> \n> I didn't know about cpp_debugstl. Is that something we should enable in\n> CI debug builds ?\n\nI believe so, yes.\n\n\n> \n> > Implement `operator==` in terms of `operator!=` to avoid the build failure.\n> >\n> > Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n> > ---\n> >  include/libcamera/base/utils.h | 4 ++++\n> >  1 file changed, 4 insertions(+)\n> >\n> > diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h\n> > index 957150cb..782d5c97 100644\n> > --- a/include/libcamera/base/utils.h\n> > +++ b/include/libcamera/base/utils.h\n> > @@ -205,6 +205,10 @@ public:\n> >  \t\titerator &operator++();\n> >  \t\tstd::string operator*() const;\n> >  \t\tbool operator!=(const iterator &other) const;\n> > +\t\tbool operator==(const iterator &other) const\n> > +\t\t{\n> > +\t\t\treturn !(*this != other);\n> > +\t\t}\n> \n> Should we make operator!=() inline while at it ? It's a trivial\n> function, and it would let the compiler optimize the operator==()\n> implementation. Actually, maybe we should instead define operator==() as\n> the canonical comparison operator, and implemente operator!=() as\n> !operator==(). I think that's what we usually do.\n> [...]\n\nWhen I originally made this change a long time ago I think I did it this way so\nthat the ABI is not broken. But I would be strongly in favour of inlining `operator==`\nand expressing `operator!=` in terms of that.\n\n\nRegards,\nBarnabás Pőcze","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 C59DCBDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  4 Dec 2024 17:57:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DBC0D660E1;\n\tWed,  4 Dec 2024 18:57:21 +0100 (CET)","from mail-10631.protonmail.ch (mail-10631.protonmail.ch\n\t[79.135.106.31])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 00449660D1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  4 Dec 2024 18:57:19 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=protonmail.com header.i=@protonmail.com\n\theader.b=\"y+tNlzi9\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;\n\ts=protonmail3; t=1733335038; x=1733594238;\n\tbh=LfGqVvfIjqzBLdH92Wwe1jSGkq5QScJ0F3KGPnaHEP8=;\n\th=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References:\n\tFeedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:\n\tMessage-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post;\n\tb=y+tNlzi93y0a8uLgPd/R+vZi9OU8sK2jypLTcO+iCOKR2K7tw/700zG0JCE+P+oH9\n\tgJ9LvAqkD2B8B/r7TCJiXV6eEC3W76ubUyGFy+G8GJkQgL0jB6jdmj6PTeTID1cB/h\n\tBYqFk3jQlOaKWomdXpdKGh4WZQqvNIhy30ROxFN/0M80cMJchbc4fptJRUAnehEJNP\n\tEZX0CbBNiampGNE/FROsvk0t7L6Z5QShQP+ELMj6pJ4EfV6K7o+QpW+PkZJsb2wBzt\n\tfsQXQjDmfoQODAXb/Ijj9OgUKtYt4joL1ZMVhcyOO6+xm8XufClRqo19c9nUjNHtfH\n\tyDpj6kl7LTR1w==","Date":"Wed, 04 Dec 2024 17:57:13 +0000","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v1] libcamera: utils: StringSplitter: Add `operator==`","Message-ID":"<REhMffOjErGUR0nUTFMvtcFoKVyZYLJrn5tp3bOkzkfUNiY23TR-I61rJ_PR3u25c4rHgNN8TCUsm0tdAcjmZmbQddG4CvUf95D_ezq7QSw=@protonmail.com>","In-Reply-To":"<20241204162151.GC10736@pendragon.ideasonboard.com>","References":"<20241204145422.968446-1-pobrn@protonmail.com>\n\t<20241204162151.GC10736@pendragon.ideasonboard.com>","Feedback-ID":"20568564:user:proton","X-Pm-Message-ID":"94ae39764bb2404843e26c20a065fe1ee77b7798","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","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>"}},{"id":32530,"web_url":"https://patchwork.libcamera.org/comment/32530/","msgid":"<20241204194317.GA17302@pendragon.ideasonboard.com>","date":"2024-12-04T19:43:17","subject":"Re: [PATCH v1] libcamera: utils: StringSplitter: Add `operator==`","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Wed, Dec 04, 2024 at 05:57:13PM +0000, Barnabás Pőcze wrote:\n> 2024. december 4., szerda 17:21 keltezéssel, Laurent Pinchart írta:\n> > On Wed, Dec 04, 2024 at 02:54:24PM +0000, Barnabás Pőcze wrote:\n> > > If `cpp_debugstl=true` in the build configuration, then libstdc++ will\n> > > try to use `operator==` and the build will fail.\n> > \n> > I didn't know about cpp_debugstl. Is that something we should enable in\n> > CI debug builds ?\n> \n> I believe so, yes.\n\nI'll give it a try once this fix gets merged.\n\n> > > Implement `operator==` in terms of `operator!=` to avoid the build failure.\n> > >\n> > > Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n> > > ---\n> > >  include/libcamera/base/utils.h | 4 ++++\n> > >  1 file changed, 4 insertions(+)\n> > >\n> > > diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h\n> > > index 957150cb..782d5c97 100644\n> > > --- a/include/libcamera/base/utils.h\n> > > +++ b/include/libcamera/base/utils.h\n> > > @@ -205,6 +205,10 @@ public:\n> > >  \t\titerator &operator++();\n> > >  \t\tstd::string operator*() const;\n> > >  \t\tbool operator!=(const iterator &other) const;\n> > > +\t\tbool operator==(const iterator &other) const\n> > > +\t\t{\n> > > +\t\t\treturn !(*this != other);\n> > > +\t\t}\n> > \n> > Should we make operator!=() inline while at it ? It's a trivial\n> > function, and it would let the compiler optimize the operator==()\n> > implementation. Actually, maybe we should instead define operator==() as\n> > the canonical comparison operator, and implemente operator!=() as\n> > !operator==(). I think that's what we usually do.\n> > [...]\n> \n> When I originally made this change a long time ago I think I did it this way so\n> that the ABI is not broken. But I would be strongly in favour of inlining `operator==`\n> and expressing `operator!=` in terms of that.\n\nCould you send a new version of this patch that does so ? No need to\nsplit it in two different patches, you can combine them.","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 AB760BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  4 Dec 2024 19:43:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A3AB5660DA;\n\tWed,  4 Dec 2024 20:43:30 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 10E72660C8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  4 Dec 2024 20:43:29 +0100 (CET)","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 A46864D4;\n\tWed,  4 Dec 2024 20:43:00 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"dj9y/CAL\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1733341380;\n\tbh=X2qoamOm7kOYZ0WO5uari5xOY0tfGzBb4WTJcNy3t2o=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=dj9y/CALyctyu50oyLqs2SQYaXl3cBoHZxkcpoLjircEOYqguI1ClNiMGOi/0DJ0z\n\tAnkZTIaTzsOEnl7MFURygV96OOpBgXOGvkK8hGY9JNd+PHeeN12fJjp3f6KuIvMr3o\n\tUksLQyq6GRwFw7T1W2QWPDann1Ko2StriZeLCZTI=","Date":"Wed, 4 Dec 2024 21:43:17 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v1] libcamera: utils: StringSplitter: Add `operator==`","Message-ID":"<20241204194317.GA17302@pendragon.ideasonboard.com>","References":"<20241204145422.968446-1-pobrn@protonmail.com>\n\t<20241204162151.GC10736@pendragon.ideasonboard.com>\n\t<REhMffOjErGUR0nUTFMvtcFoKVyZYLJrn5tp3bOkzkfUNiY23TR-I61rJ_PR3u25c4rHgNN8TCUsm0tdAcjmZmbQddG4CvUf95D_ezq7QSw=@protonmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<REhMffOjErGUR0nUTFMvtcFoKVyZYLJrn5tp3bOkzkfUNiY23TR-I61rJ_PR3u25c4rHgNN8TCUsm0tdAcjmZmbQddG4CvUf95D_ezq7QSw=@protonmail.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>"}}]