[libcamera-devel] qcam: Fix compilation errors with clang-10

Message ID 20200218001405.18232-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit a8be6e94e79f602d543a15afd44ef60e378b138f
Headers show
Series
  • [libcamera-devel] qcam: Fix compilation errors with clang-10
Related show

Commit Message

Laurent Pinchart Feb. 18, 2020, 12:14 a.m. UTC
clang-10 has introduced the same deprecated-copy warning that appeared
in gcc-9 and caused build issues with Qt header files. However, the
clang version seems more sensitive, and detects issues that are not
fixed in Qt 5.13, unlike gcc-9.

Extend the logic that disables the warning for gcc-9 and Qt < 5.13 to
cover clang-10 and all Qt versions.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/qcam/meson.build | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Niklas Söderlund Feb. 18, 2020, 8:18 p.m. UTC | #1
Hi Laurent,

Thanks for your patch.

On 2020-02-18 02:14:05 +0200, Laurent Pinchart wrote:
> clang-10 has introduced the same deprecated-copy warning that appeared
> in gcc-9 and caused build issues with Qt header files. However, the
> clang version seems more sensitive, and detects issues that are not
> fixed in Qt 5.13, unlike gcc-9.
> 
> Extend the logic that disables the warning for gcc-9 and Qt < 5.13 to
> cover clang-10 and all Qt versions.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  src/qcam/meson.build | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/src/qcam/meson.build b/src/qcam/meson.build
> index 5b877a84da85..5150631b55c8 100644
> --- a/src/qcam/meson.build
> +++ b/src/qcam/meson.build
> @@ -25,13 +25,12 @@ if qt5_dep.found()
>      qt5_cpp_args = [ '-DQT_NO_KEYWORDS' ]
>  
>      # gcc 9 introduced a deprecated-copy warning that is triggered by Qt until
> -    # Qt 5.13. Disable it manually.
> -    if cc.get_id() == 'gcc'
> -        gcc_version = cc.version().split('.')
> -        qt5_version = qt5_dep.version().split('.')
> -        if qt5_version[1].to_int() < 13 and gcc_version[0].to_int() >= 9
> -            qt5_cpp_args += [ '-Wno-deprecated-copy' ]
> -        endif
> +    # Qt 5.13. clang 10 introduced the same warning, but detects more issues
> +    # that are not fixed in Qt yet. Disable the warning manually in both cases.
> +    if ((cc.get_id() == 'gcc' and cc.version().version_compare('>=9.0') and
> +         qt5_dep.version().version_compare('<5.13')) or
> +        (cc.get_id() == 'clang' and cc.version().version_compare('>=10.0')))
> +        qt5_cpp_args += [ '-Wno-deprecated-copy' ]
>      endif
>  
>      resources = qt5.preprocess(moc_headers: qcam_moc_headers,
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Kieran Bingham Feb. 19, 2020, 1:22 p.m. UTC | #2
Hi Laurent,

On 18/02/2020 00:14, Laurent Pinchart wrote:
> clang-10 has introduced the same deprecated-copy warning that appeared
> in gcc-9 and caused build issues with Qt header files. However, the
> clang version seems more sensitive, and detects issues that are not
> fixed in Qt 5.13, unlike gcc-9.
> 
> Extend the logic that disables the warning for gcc-9 and Qt < 5.13 to
> cover clang-10 and all Qt versions.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Pesky compilers... :-D

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  src/qcam/meson.build | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/src/qcam/meson.build b/src/qcam/meson.build
> index 5b877a84da85..5150631b55c8 100644
> --- a/src/qcam/meson.build
> +++ b/src/qcam/meson.build
> @@ -25,13 +25,12 @@ if qt5_dep.found()
>      qt5_cpp_args = [ '-DQT_NO_KEYWORDS' ]
>  
>      # gcc 9 introduced a deprecated-copy warning that is triggered by Qt until
> -    # Qt 5.13. Disable it manually.
> -    if cc.get_id() == 'gcc'
> -        gcc_version = cc.version().split('.')
> -        qt5_version = qt5_dep.version().split('.')
> -        if qt5_version[1].to_int() < 13 and gcc_version[0].to_int() >= 9
> -            qt5_cpp_args += [ '-Wno-deprecated-copy' ]
> -        endif
> +    # Qt 5.13. clang 10 introduced the same warning, but detects more issues
> +    # that are not fixed in Qt yet. Disable the warning manually in both cases.
> +    if ((cc.get_id() == 'gcc' and cc.version().version_compare('>=9.0') and
> +         qt5_dep.version().version_compare('<5.13')) or
> +        (cc.get_id() == 'clang' and cc.version().version_compare('>=10.0')))
> +        qt5_cpp_args += [ '-Wno-deprecated-copy' ]
>      endif
>  
>      resources = qt5.preprocess(moc_headers: qcam_moc_headers,
>

Patch

diff --git a/src/qcam/meson.build b/src/qcam/meson.build
index 5b877a84da85..5150631b55c8 100644
--- a/src/qcam/meson.build
+++ b/src/qcam/meson.build
@@ -25,13 +25,12 @@  if qt5_dep.found()
     qt5_cpp_args = [ '-DQT_NO_KEYWORDS' ]
 
     # gcc 9 introduced a deprecated-copy warning that is triggered by Qt until
-    # Qt 5.13. Disable it manually.
-    if cc.get_id() == 'gcc'
-        gcc_version = cc.version().split('.')
-        qt5_version = qt5_dep.version().split('.')
-        if qt5_version[1].to_int() < 13 and gcc_version[0].to_int() >= 9
-            qt5_cpp_args += [ '-Wno-deprecated-copy' ]
-        endif
+    # Qt 5.13. clang 10 introduced the same warning, but detects more issues
+    # that are not fixed in Qt yet. Disable the warning manually in both cases.
+    if ((cc.get_id() == 'gcc' and cc.version().version_compare('>=9.0') and
+         qt5_dep.version().version_compare('<5.13')) or
+        (cc.get_id() == 'clang' and cc.version().version_compare('>=10.0')))
+        qt5_cpp_args += [ '-Wno-deprecated-copy' ]
     endif
 
     resources = qt5.preprocess(moc_headers: qcam_moc_headers,