[libcamera-devel] [PATCH] meson.build: Silence the C99 designators warning

Kieran Bingham kieran.bingham at ideasonboard.com
Thu Feb 13 11:35:37 CET 2020


Hi Laurent,

On 12/02/2020 23:54, Laurent Pinchart wrote:
> We use array designators for array initialization, which is a C99
> extension. clang-10 warns about it, causing a build failure.
> 
> As this is a useful extension, silence the warning. This needs to be
> done only if the compiler supports the -Wno-c99-designator argument,
> otherwise a -Wunknown-warning-option will be generated.
> 

As we actively use the feature, why not then set the standard
appropriately instead...

index 0bbd24b2a295..7d572fa9a47a 100644
--- a/meson.build
+++ b/meson.build
@@ -5,6 +5,7 @@ project('libcamera', 'c', 'cpp',
         'werror=true',
         'warning_level=2',
         'cpp_std=c++14',
+        'c_std=c99',          # or =c11, or higher if desired [0]
     ],
     license : 'LGPL 2.1+')

Or will that not apply because we're using C++ compilers... but then if
that's the case, why is our c++ compiler complaining about C features...

[0] https://mesonbuild.com/Builtin-options.html#compiler-options

--
Kieran



> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
>  meson.build | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/meson.build b/meson.build
> index 0bbd24b2a295..aceba997aebd 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -60,6 +60,12 @@ if cc.get_id() == 'clang'
>      endif
>  endif
>  
> +if cc.has_argument('-Wno-c99-designator')
> +    common_arguments += [
> +        '-Wno-c99-designator',
> +    ]
> +endif
> +
>  c_arguments += common_arguments
>  cpp_arguments += common_arguments
>  
> 

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list