[2/2] meson: Enable the -Wnon-virtual-dtor compiler option
diff mbox series

Message ID 20250224220438.21512-3-laurent.pinchart@ideasonboard.com
State Accepted
Commit 4849a84a9bf3577435ba7e9bc39a8ff5d8960e6e
Headers show
Series
  • libcamera: Fix -Wnon-virtual-dtor warning
Related show

Commit Message

Laurent Pinchart Feb. 24, 2025, 10:04 p.m. UTC
A base class with virtual functions and a non-virtual public destructor
is prone to undefined behaviourif deleted from a pointer to the base.
Enable the -Wnon-virtual-dtor warning to report those issues.

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

Comments

Milan Zamazal Feb. 25, 2025, 8:56 a.m. UTC | #1
Laurent Pinchart <laurent.pinchart@ideasonboard.com> writes:

> A base class with virtual functions and a non-virtual public destructor
> is prone to undefined behaviourif deleted from a pointer to the base.
> Enable the -Wnon-virtual-dtor warning to report those issues.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Milan Zamazal <mzamazal@redhat.com>

> ---
>  meson.build | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/meson.build b/meson.build
> index 5270f626f2fb..f8d32dcf8d7a 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -110,7 +110,9 @@ common_arguments = [
>  ]
>  
>  c_arguments = []
> -cpp_arguments = []
> +cpp_arguments = [
> +    '-Wnon-virtual-dtor',
> +]
>  
>  cxx_stdlib = 'libstdc++'
Stefan Klug Feb. 25, 2025, 10:11 p.m. UTC | #2
Hi Laurent,

Thank you for the patch. 

On Tue, Feb 25, 2025 at 12:04:38AM +0200, Laurent Pinchart wrote:
> A base class with virtual functions and a non-virtual public destructor
> is prone to undefined behaviourif deleted from a pointer to the base.
> Enable the -Wnon-virtual-dtor warning to report those issues.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

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

Cheers,
Stefan

> ---
>  meson.build | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/meson.build b/meson.build
> index 5270f626f2fb..f8d32dcf8d7a 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -110,7 +110,9 @@ common_arguments = [
>  ]
>  
>  c_arguments = []
> -cpp_arguments = []
> +cpp_arguments = [
> +    '-Wnon-virtual-dtor',
> +]
>  
>  cxx_stdlib = 'libstdc++'
>  
> -- 
> Regards,
> 
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/meson.build b/meson.build
index 5270f626f2fb..f8d32dcf8d7a 100644
--- a/meson.build
+++ b/meson.build
@@ -110,7 +110,9 @@  common_arguments = [
 ]
 
 c_arguments = []
-cpp_arguments = []
+cpp_arguments = [
+    '-Wnon-virtual-dtor',
+]
 
 cxx_stdlib = 'libstdc++'