Message ID | 20250717124853.2317191-2-dan.scally@ideasonboard.com |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
On Thu, Jul 17, 2025 at 01:48:50PM +0100, Daniel Scally wrote: > Provide a wrapper for regex.h to work around the false-positive > compilation errors that crop up in some versions of gcc. > > Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > Changes in v2: > > - New patch > > include/libcamera/base/meson.build | 1 + > include/libcamera/base/regex.h | 13 +++++++++++++ > src/libcamera/v4l2_subdevice.cpp | 8 +------- > 3 files changed, 15 insertions(+), 7 deletions(-) > create mode 100644 include/libcamera/base/regex.h > > diff --git a/include/libcamera/base/meson.build b/include/libcamera/base/meson.build > index f28ae4d4..f84b5141 100644 > --- a/include/libcamera/base/meson.build > +++ b/include/libcamera/base/meson.build > @@ -24,6 +24,7 @@ libcamera_base_private_headers = files([ > 'message.h', > 'mutex.h', > 'private.h', > + 'regex.h', > 'semaphore.h', > 'thread.h', > 'thread_annotations.h', > diff --git a/include/libcamera/base/regex.h b/include/libcamera/base/regex.h > new file mode 100644 > index 00000000..1ae21c1f > --- /dev/null > +++ b/include/libcamera/base/regex.h > @@ -0,0 +1,13 @@ > +/* SPDX-License-Identifier: LGPL-2.1-or-later */ > +/* > + * Copyright (C) 2025, Ideas on Board Oy > + * > + * std::regex wrapper for gcc > + */ > + > +#pragma GCC diagnostic push > +#if defined __SANITIZE_ADDRESS__ && defined __OPTIMIZE__ > +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" > +#endif > +#include <regex> > +#pragma GCC diagnostic pop > diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp > index 33279654..fd3b18c2 100644 > --- a/src/libcamera/v4l2_subdevice.cpp > +++ b/src/libcamera/v4l2_subdevice.cpp > @@ -13,17 +13,11 @@ > #include <sys/ioctl.h> > #include <unistd.h> > > -#pragma GCC diagnostic push > -#if defined __SANITIZE_ADDRESS__ && defined __OPTIMIZE__ > -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" > -#endif > -#include <regex> > -#pragma GCC diagnostic pop > - > #include <linux/media-bus-format.h> > #include <linux/v4l2-subdev.h> > > #include <libcamera/base/log.h> > +#include <libcamera/base/regex.h> > #include <libcamera/base/utils.h> > > #include <libcamera/geometry.h>
Hi Dan, Thank you for the patch. I also need similar functionality for my work. So I'd be happy if we could get this in. Quoting Daniel Scally (2025-07-17 14:48:50) > Provide a wrapper for regex.h to work around the false-positive > compilation errors that crop up in some versions of gcc. > > Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Cheers, Stefan > --- > Changes in v2: > > - New patch > > include/libcamera/base/meson.build | 1 + > include/libcamera/base/regex.h | 13 +++++++++++++ > src/libcamera/v4l2_subdevice.cpp | 8 +------- > 3 files changed, 15 insertions(+), 7 deletions(-) > create mode 100644 include/libcamera/base/regex.h > > diff --git a/include/libcamera/base/meson.build b/include/libcamera/base/meson.build > index f28ae4d4..f84b5141 100644 > --- a/include/libcamera/base/meson.build > +++ b/include/libcamera/base/meson.build > @@ -24,6 +24,7 @@ libcamera_base_private_headers = files([ > 'message.h', > 'mutex.h', > 'private.h', > + 'regex.h', > 'semaphore.h', > 'thread.h', > 'thread_annotations.h', > diff --git a/include/libcamera/base/regex.h b/include/libcamera/base/regex.h > new file mode 100644 > index 00000000..1ae21c1f > --- /dev/null > +++ b/include/libcamera/base/regex.h > @@ -0,0 +1,13 @@ > +/* SPDX-License-Identifier: LGPL-2.1-or-later */ > +/* > + * Copyright (C) 2025, Ideas on Board Oy > + * > + * std::regex wrapper for gcc > + */ > + > +#pragma GCC diagnostic push > +#if defined __SANITIZE_ADDRESS__ && defined __OPTIMIZE__ > +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" > +#endif > +#include <regex> > +#pragma GCC diagnostic pop > diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp > index 33279654..fd3b18c2 100644 > --- a/src/libcamera/v4l2_subdevice.cpp > +++ b/src/libcamera/v4l2_subdevice.cpp > @@ -13,17 +13,11 @@ > #include <sys/ioctl.h> > #include <unistd.h> > > -#pragma GCC diagnostic push > -#if defined __SANITIZE_ADDRESS__ && defined __OPTIMIZE__ > -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" > -#endif > -#include <regex> > -#pragma GCC diagnostic pop > - > #include <linux/media-bus-format.h> > #include <linux/v4l2-subdev.h> > > #include <libcamera/base/log.h> > +#include <libcamera/base/regex.h> > #include <libcamera/base/utils.h> > > #include <libcamera/geometry.h> > -- > 2.34.1 >
diff --git a/include/libcamera/base/meson.build b/include/libcamera/base/meson.build index f28ae4d4..f84b5141 100644 --- a/include/libcamera/base/meson.build +++ b/include/libcamera/base/meson.build @@ -24,6 +24,7 @@ libcamera_base_private_headers = files([ 'message.h', 'mutex.h', 'private.h', + 'regex.h', 'semaphore.h', 'thread.h', 'thread_annotations.h', diff --git a/include/libcamera/base/regex.h b/include/libcamera/base/regex.h new file mode 100644 index 00000000..1ae21c1f --- /dev/null +++ b/include/libcamera/base/regex.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2025, Ideas on Board Oy + * + * std::regex wrapper for gcc + */ + +#pragma GCC diagnostic push +#if defined __SANITIZE_ADDRESS__ && defined __OPTIMIZE__ +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif +#include <regex> +#pragma GCC diagnostic pop diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp index 33279654..fd3b18c2 100644 --- a/src/libcamera/v4l2_subdevice.cpp +++ b/src/libcamera/v4l2_subdevice.cpp @@ -13,17 +13,11 @@ #include <sys/ioctl.h> #include <unistd.h> -#pragma GCC diagnostic push -#if defined __SANITIZE_ADDRESS__ && defined __OPTIMIZE__ -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -#endif -#include <regex> -#pragma GCC diagnostic pop - #include <linux/media-bus-format.h> #include <linux/v4l2-subdev.h> #include <libcamera/base/log.h> +#include <libcamera/base/regex.h> #include <libcamera/base/utils.h> #include <libcamera/geometry.h>
Provide a wrapper for regex.h to work around the false-positive compilation errors that crop up in some versions of gcc. Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> --- Changes in v2: - New patch include/libcamera/base/meson.build | 1 + include/libcamera/base/regex.h | 13 +++++++++++++ src/libcamera/v4l2_subdevice.cpp | 8 +------- 3 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 include/libcamera/base/regex.h