[4/4] meson: Deprecate bitwise operations between different enumeration type
diff mbox series

Message ID 20240503025205.2814-5-laurent.pinchart@ideasonboard.com
State Accepted
Commit bf4695266bfca8cc21bcf10a3281e874ebce0d27
Headers show
Series
  • libcamera: Assorted cleanups and fixes
Related show

Commit Message

Laurent Pinchart May 3, 2024, 2:52 a.m. UTC
C++20 deprecates bitwise operations between different enumeration types.
This is a bad practice even in C++17, so enable the deprecation warning.
Doing so ensures no such operations will be added.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 meson.build | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Umang Jain May 3, 2024, 6:07 a.m. UTC | #1
Hi Laurent,

On 03/05/24 8:22 am, Laurent Pinchart wrote:
> C++20 deprecates bitwise operations between different enumeration types.
> This is a bad practice even in C++17, so enable the deprecation warning.
> Doing so ensures no such operations will be added.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>   meson.build | 9 +++++++++
>   1 file changed, 9 insertions(+)
>
> diff --git a/meson.build b/meson.build
> index 39e4947f8c97..89320adbde1f 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -178,6 +178,15 @@ if cc.has_argument('-Wno-c99-designator')
>       ]
>   endif
>   
> +# Enable the C++20 deprecated enum-enum conversion warning if the compiler
> +# supports it. This helps avoiding C++20 regressions, and should be removed
> +# when switching to C++20 as the warning will then be enabled by default.
> +if cxx.has_argument('-Wdeprecated-enum-enum-conversion')
> +    cpp_arguments += [
> +        '-Wdeprecated-enum-enum-conversion',
> +    ]
> +endif
> +
>   c_arguments += common_arguments
>   cpp_arguments += common_arguments
>
Stefan Klug May 3, 2024, 2:44 p.m. UTC | #2
Hi Laurent,

thanks for the patch.

On Fri, May 03, 2024 at 05:52:05AM +0300, Laurent Pinchart wrote:
> C++20 deprecates bitwise operations between different enumeration types.
> This is a bad practice even in C++17, so enable the deprecation warning.
> Doing so ensures no such operations will be added.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> 

Cheers,
Stefan

> ---
>  meson.build | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/meson.build b/meson.build
> index 39e4947f8c97..89320adbde1f 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -178,6 +178,15 @@ if cc.has_argument('-Wno-c99-designator')
>      ]
>  endif
>  
> +# Enable the C++20 deprecated enum-enum conversion warning if the compiler
> +# supports it. This helps avoiding C++20 regressions, and should be removed
> +# when switching to C++20 as the warning will then be enabled by default.
> +if cxx.has_argument('-Wdeprecated-enum-enum-conversion')
> +    cpp_arguments += [
> +        '-Wdeprecated-enum-enum-conversion',
> +    ]
> +endif
> +
>  c_arguments += common_arguments
>  cpp_arguments += common_arguments
>  
> -- 
> Regards,
> 
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/meson.build b/meson.build
index 39e4947f8c97..89320adbde1f 100644
--- a/meson.build
+++ b/meson.build
@@ -178,6 +178,15 @@  if cc.has_argument('-Wno-c99-designator')
     ]
 endif
 
+# Enable the C++20 deprecated enum-enum conversion warning if the compiler
+# supports it. This helps avoiding C++20 regressions, and should be removed
+# when switching to C++20 as the warning will then be enabled by default.
+if cxx.has_argument('-Wdeprecated-enum-enum-conversion')
+    cpp_arguments += [
+        '-Wdeprecated-enum-enum-conversion',
+    ]
+endif
+
 c_arguments += common_arguments
 cpp_arguments += common_arguments