[libcamera-devel] [PATCH 01/17] meson: Allow partially initializing objects

Jacopo Mondi jacopo at jmondi.org
Mon May 27 11:18:07 CEST 2019


Hi Niklas,

On Mon, May 27, 2019 at 02:15:27AM +0200, Niklas Söderlund wrote:
> There are valid use-cases where one might wish to partially initialize a
> structure when creating it without needing to initialize all members.
> This is especially common when working with V4L2.
>
> struct foo {
>     int bar;
>     int baz;
> };
>
> struct foo f = {
>     .bar = 1;
> };
>
> Without -Wno-missing-field-initializers fails to compile with the error,

I asked for the same a few weeks ago, so I welcome this change
Acked-by: Jacopo Mondi <jacopo at jmondi.org>
>
>     error: missing initializer for member ‘foo::baz’ [-Werror=missing-field-initializers]
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> ---
>  meson.build | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/meson.build b/meson.build
> index 4d3e99d3e58f71d5..90ad58328f9a2bd5 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -22,6 +22,7 @@ endif
>
>  common_arguments = [
>      '-Wno-unused-parameter',
> +    '-Wno-missing-field-initializers',
>      '-include', 'config.h',
>  ]
>
> --
> 2.21.0
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20190527/f44ec59c/attachment.sig>


More information about the libcamera-devel mailing list