[{"id":35053,"web_url":"https://patchwork.libcamera.org/comment/35053/","msgid":"<20250723165808.GD14576@pendragon.ideasonboard.com>","date":"2025-07-23T16:58:08","subject":"Re: [PATCH v2 1/4] libcamera: base: Wrap <regex.h>","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Thu, Jul 17, 2025 at 01:48:50PM +0100, Daniel Scally wrote:\n> Provide a wrapper for regex.h to work around the false-positive\n> compilation errors that crop up in some versions of gcc.\n> \n> Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n> Changes in v2:\n> \n> \t- New patch\n> \n>  include/libcamera/base/meson.build |  1 +\n>  include/libcamera/base/regex.h     | 13 +++++++++++++\n>  src/libcamera/v4l2_subdevice.cpp   |  8 +-------\n>  3 files changed, 15 insertions(+), 7 deletions(-)\n>  create mode 100644 include/libcamera/base/regex.h\n> \n> diff --git a/include/libcamera/base/meson.build b/include/libcamera/base/meson.build\n> index f28ae4d4..f84b5141 100644\n> --- a/include/libcamera/base/meson.build\n> +++ b/include/libcamera/base/meson.build\n> @@ -24,6 +24,7 @@ libcamera_base_private_headers = files([\n>      'message.h',\n>      'mutex.h',\n>      'private.h',\n> +    'regex.h',\n>      'semaphore.h',\n>      'thread.h',\n>      'thread_annotations.h',\n> diff --git a/include/libcamera/base/regex.h b/include/libcamera/base/regex.h\n> new file mode 100644\n> index 00000000..1ae21c1f\n> --- /dev/null\n> +++ b/include/libcamera/base/regex.h\n> @@ -0,0 +1,13 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2025, Ideas on Board Oy\n> + *\n> + * std::regex wrapper for gcc\n> + */\n> +\n> +#pragma GCC diagnostic push\n> +#if defined __SANITIZE_ADDRESS__ && defined __OPTIMIZE__\n> +#pragma GCC diagnostic ignored \"-Wmaybe-uninitialized\"\n> +#endif\n> +#include <regex>\n> +#pragma GCC diagnostic pop\n> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> index 33279654..fd3b18c2 100644\n> --- a/src/libcamera/v4l2_subdevice.cpp\n> +++ b/src/libcamera/v4l2_subdevice.cpp\n> @@ -13,17 +13,11 @@\n>  #include <sys/ioctl.h>\n>  #include <unistd.h>\n>  \n> -#pragma GCC diagnostic push\n> -#if defined __SANITIZE_ADDRESS__ && defined __OPTIMIZE__\n> -#pragma GCC diagnostic ignored \"-Wmaybe-uninitialized\"\n> -#endif\n> -#include <regex>\n> -#pragma GCC diagnostic pop\n> -\n>  #include <linux/media-bus-format.h>\n>  #include <linux/v4l2-subdev.h>\n>  \n>  #include <libcamera/base/log.h>\n> +#include <libcamera/base/regex.h>\n>  #include <libcamera/base/utils.h>\n>  \n>  #include <libcamera/geometry.h>","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 3D869C3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 23 Jul 2025 16:58:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4529E69062;\n\tWed, 23 Jul 2025 18:58:12 +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 7907469057\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Jul 2025 18:58:11 +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 UTF8SMTPSA id E12AADF3;\n\tWed, 23 Jul 2025 18:57:32 +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=\"QEmPE18K\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1753289853;\n\tbh=MZAfaOwBeWV52iBhbPeUnnvRGa6YmnvxSptRsh3DrRg=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=QEmPE18KKAVIcScVD9vTTqHigbLxVde2yd5r1PX7nuObTA9l3KRvchJlYVYPpmsHf\n\t0KOEAe96KPr2aKiAuU10kQA9ravuW2k2Ym+NLxDOpv90z3655Vi4cSDACWGkQtROBJ\n\to9s55iMLdXkSpsGbMtgPJlMgMEPK2xHB1NXOgDTg=","Date":"Wed, 23 Jul 2025 19:58:08 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Daniel Scally <dan.scally@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v2 1/4] libcamera: base: Wrap <regex.h>","Message-ID":"<20250723165808.GD14576@pendragon.ideasonboard.com>","References":"<20250717124853.2317191-1-dan.scally@ideasonboard.com>\n\t<20250717124853.2317191-2-dan.scally@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20250717124853.2317191-2-dan.scally@ideasonboard.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":35471,"web_url":"https://patchwork.libcamera.org/comment/35471/","msgid":"<175551254027.2014387.15968133091296233748@localhost>","date":"2025-08-18T10:22:20","subject":"Re: [PATCH v2 1/4] libcamera: base: Wrap <regex.h>","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"Hi Dan,\n\nThank you for the patch. I also need similar functionality for my work.\nSo I'd be happy if we could get this in.\n\nQuoting Daniel Scally (2025-07-17 14:48:50)\n> Provide a wrapper for regex.h to work around the false-positive\n> compilation errors that crop up in some versions of gcc.\n> \n> Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n\nReviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\nCheers,\nStefan\n\n> ---\n> Changes in v2:\n> \n>         - New patch\n> \n>  include/libcamera/base/meson.build |  1 +\n>  include/libcamera/base/regex.h     | 13 +++++++++++++\n>  src/libcamera/v4l2_subdevice.cpp   |  8 +-------\n>  3 files changed, 15 insertions(+), 7 deletions(-)\n>  create mode 100644 include/libcamera/base/regex.h\n> \n> diff --git a/include/libcamera/base/meson.build b/include/libcamera/base/meson.build\n> index f28ae4d4..f84b5141 100644\n> --- a/include/libcamera/base/meson.build\n> +++ b/include/libcamera/base/meson.build\n> @@ -24,6 +24,7 @@ libcamera_base_private_headers = files([\n>      'message.h',\n>      'mutex.h',\n>      'private.h',\n> +    'regex.h',\n>      'semaphore.h',\n>      'thread.h',\n>      'thread_annotations.h',\n> diff --git a/include/libcamera/base/regex.h b/include/libcamera/base/regex.h\n> new file mode 100644\n> index 00000000..1ae21c1f\n> --- /dev/null\n> +++ b/include/libcamera/base/regex.h\n> @@ -0,0 +1,13 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2025, Ideas on Board Oy\n> + *\n> + * std::regex wrapper for gcc\n> + */\n> +\n> +#pragma GCC diagnostic push\n> +#if defined __SANITIZE_ADDRESS__ && defined __OPTIMIZE__\n> +#pragma GCC diagnostic ignored \"-Wmaybe-uninitialized\"\n> +#endif\n> +#include <regex>\n> +#pragma GCC diagnostic pop\n> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> index 33279654..fd3b18c2 100644\n> --- a/src/libcamera/v4l2_subdevice.cpp\n> +++ b/src/libcamera/v4l2_subdevice.cpp\n> @@ -13,17 +13,11 @@\n>  #include <sys/ioctl.h>\n>  #include <unistd.h>\n>  \n> -#pragma GCC diagnostic push\n> -#if defined __SANITIZE_ADDRESS__ && defined __OPTIMIZE__\n> -#pragma GCC diagnostic ignored \"-Wmaybe-uninitialized\"\n> -#endif\n> -#include <regex>\n> -#pragma GCC diagnostic pop\n> -\n>  #include <linux/media-bus-format.h>\n>  #include <linux/v4l2-subdev.h>\n>  \n>  #include <libcamera/base/log.h>\n> +#include <libcamera/base/regex.h>\n>  #include <libcamera/base/utils.h>\n>  \n>  #include <libcamera/geometry.h>\n> -- \n> 2.34.1\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 7C457BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 18 Aug 2025 10:22:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2538E69261;\n\tMon, 18 Aug 2025 12:22:25 +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 D505D69257\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Aug 2025 12:22:23 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:766d:a405:f64e:fe3a])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 805C52394; \n\tMon, 18 Aug 2025 12:21:26 +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=\"kNjgvj4V\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1755512486;\n\tbh=LjJOvjdIqZ3Ig+H+HdBJcGQJWjf7dxF8VWggbNw6nSE=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=kNjgvj4VsRDEIwPHepkM+9NqSC40xOvmXRvNJXZvxNcgqGQDInSXXpT5Z9okZi1cJ\n\tfa1VDB53vjQ2XLoAr3OfTB/oBVT8mgzX4YkZKB0jwaiV5BzEil3BeV1C3PEnduhuCT\n\tu0cXTlhj+px5hzB+FmOEMol0Wjs1L14khbLGtKc8=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250717124853.2317191-2-dan.scally@ideasonboard.com>","References":"<20250717124853.2317191-1-dan.scally@ideasonboard.com>\n\t<20250717124853.2317191-2-dan.scally@ideasonboard.com>","Subject":"Re: [PATCH v2 1/4] libcamera: base: Wrap <regex.h>","From":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"Daniel Scally <dan.scally@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Daniel Scally <dan.scally@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 18 Aug 2025 12:22:20 +0200","Message-ID":"<175551254027.2014387.15968133091296233748@localhost>","User-Agent":"alot/0.12.dev8+g2c003385c862.d20250602","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>"}}]