[PATCH] remote_driver: Work around broken clang

Michal Privoznik posted 1 patch 1 year, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cb07b7eeb9e5681804dfd78167bd110378820b66.1675930753.git.mprivozn@redhat.com
src/remote/remote_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] remote_driver: Work around broken clang
Posted by Michal Privoznik 1 year, 2 months ago
In recent commit of v9.0.0-191-gc71c159248 I've introduced
remoteConnectFormatURI() function and in the function @query
variable. Even though, the variable is used, clang-13 fails to
see it. Surprisingly, never clang is not affected. Fortunately,
swapping the order in which variables are set makes clang happy
again.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/remote/remote_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 58cd0abe8c..a4c60be3d7 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -712,7 +712,7 @@ remoteConnectFormatURI(virURI *uri,
         virURIParamsSetIgnore(uri, false, names);
     }
 
-    query = tmpuri.query = virURIFormatParams(uri);
+    tmpuri.query = query = virURIFormatParams(uri);
 
     ret = virURIFormat(&tmpuri);
 
-- 
2.39.1
Re: [PATCH] remote_driver: Work around broken clang
Posted by Peter Krempa 1 year, 2 months ago
On Thu, Feb 09, 2023 at 09:19:13 +0100, Michal Privoznik wrote:
> In recent commit of v9.0.0-191-gc71c159248 I've introduced
> remoteConnectFormatURI() function and in the function @query
> variable. Even though, the variable is used, clang-13 fails to
> see it. Surprisingly, never clang is not affected. Fortunately,

s/never/newer/ ?

> swapping the order in which variables are set makes clang happy
> again.

weird

> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/remote/remote_driver.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>