From nobody Mon May 6 18:50:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15158547861241013.0006016134647; Sat, 13 Jan 2018 06:46:26 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 477A44E4C8; Sat, 13 Jan 2018 14:46:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 847625D6A6; Sat, 13 Jan 2018 14:46:21 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8819D4EBD7; Sat, 13 Jan 2018 14:46:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0DEkGoU026856 for ; Sat, 13 Jan 2018 09:46:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6F9BE608F3; Sat, 13 Jan 2018 14:46:16 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6477460D61 for ; Sat, 13 Jan 2018 14:46:12 +0000 (UTC) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com [209.85.215.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1BE7D81DEE for ; Sat, 13 Jan 2018 14:46:11 +0000 (UTC) Received: by mail-lf0-f47.google.com with SMTP id m8so8827750lfc.6 for ; Sat, 13 Jan 2018 06:46:11 -0800 (PST) Received: from kloomba.my.domain ([95.104.133.157]) by smtp.gmail.com with ESMTPSA id p26sm1092911lja.62.2018.01.13.06.46.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Jan 2018 06:46:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=9KHjxvKIl0FyGQB9PpROp1FCA4DMpuqgVNE51sCQ3LU=; b=LuViuLoIDtsiEyFH/UcJTSHxeezKrEkjpAxQorWQG7LiWObIv6rERY65Zo1dJnW+rn 9muubO64V4Yn6IeVjzQV79ql/qETt8f9hEmZmGnCWi+TqKjtJdhusmtvrNnd8eIFEYPO wJl/ne83LtQZFSKq7LaJkblVBmxnsScycwgE+vaN4pLaJgB7ZJSs9rewdjPilL3xN+Mi v/x5sdJ12UA1YVxZmdCF5g8hrohDHwMUxP53QgPUYBayKsWIPira4PXpnGsbSXThDKDG tIBqbLkaEVNOt4o3wdphg9LzP9AhF8Fz4ZaDtn7NVFeTU9kFSZ/QKS0P8ZlgJ6zRAdUX n9dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9KHjxvKIl0FyGQB9PpROp1FCA4DMpuqgVNE51sCQ3LU=; b=gN8AvmcMyp0+2b7oRlOrabcWKotJ+PjTiDyVvtYwMP/+OIvqeOPuK+CSiH7M9sB21P cb501LMm725Pcs4Usm+gPltQyGWOOsjYn5ASAJlGOEpXLdIiZ8V+FxvUjEKxyzHFkSQf 6G0Zp63O0SwjAJpTGZ1zh4u1ajcHw1ICEUC1tyNnA9v1nSQPKblFnqD9TeQPwRPSb9iq VzkmJZDFtLzvOpjrqKjKEe6tqDdzWI+FR0ohYsf/kTlWSNZdKJo9y/1oZVLxZN6mwlSO Y/VdBCyWgisIJWg/GmzyYoiBXqrnNWC1klVfOKWRDdLTq4RAcEcUH8R/IpZev+iGBDN2 ITYQ== X-Gm-Message-State: AKwxytdUfWubxPZIpZFXQZaKvyO5Unm6h/m7MSYGxUUUR5PnLlP4oRGl UON4wxyanvtIlMlgSWzRNoIgyw== X-Google-Smtp-Source: ACJfBosaHyroPcmZ7kmyVlXZ2hoPYl23Ie4X5SR7T+sujm2q//0lFa2QMlM3NujpkwmT0vP9md0hbg== X-Received: by 10.25.90.200 with SMTP id y69mr8594133lfk.138.1515854769205; Sat, 13 Jan 2018 06:46:09 -0800 (PST) From: Roman Bogorodskiy To: libvir-list@redhat.com Date: Sat, 13 Jan 2018 18:46:00 +0400 Message-Id: <20180113144600.54404-1-bogorodskiy@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sat, 13 Jan 2018 14:46:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sat, 13 Jan 2018 14:46:11 +0000 (UTC) for IP:'209.85.215.47' DOMAIN:'mail-lf0-f47.google.com' HELO:'mail-lf0-f47.google.com' FROM:'bogorodskiy@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.13 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.215.47 mail-lf0-f47.google.com 209.85.215.47 mail-lf0-f47.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Roman Bogorodskiy Subject: [libvirt] [PATCH v2] virsh: fix build without readline X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 13 Jan 2018 14:46:24 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Completion in virsh is enabled when readline is available. In order to fix build when it's not available, do the following: * Unconditionally add virsh-completer.[ch] and virt-admin-completer.[ch] to the build, and provide stub functions for when readline is not available. This way virsh builds without complaining about missing symbols used for 'completer' in vshCmdOptDef; * In cmdComplete(), mark unused arguments when there's no readline with ATTRIBUTE_UNUSED. --- tools/Makefile.am | 20 ++------------------ tools/virsh-completer.c | 23 +++++++++++++++++++++++ tools/virt-admin-completer.c | 12 ++++++++++++ tools/vsh.c | 2 +- 4 files changed, 38 insertions(+), 19 deletions(-) diff --git a/tools/Makefile.am b/tools/Makefile.am index 48125f516..8cb66db7d 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -229,17 +229,9 @@ virsh_SOURCES =3D \ virsh-snapshot.c virsh-snapshot.h \ virsh-util.c virsh-util.h \ virsh-volume.c virsh-volume.h \ + virsh-completer.c virsh-completer.h \ $(NULL) =20 -VIRSH_COMPLETER =3D \ - virsh-completer.c virsh-completer.h - -if WITH_READLINE -virsh_SOURCES +=3D $(VIRSH_COMPLETER) -else ! WITH_READLINE -EXTRA_DIST +=3D $(VIRSH_COMPLETER) -endif ! WITH_READLINE - virsh_LDFLAGS =3D \ $(AM_LDFLAGS) \ $(PIE_LDFLAGS) \ @@ -256,17 +248,9 @@ virsh_CFLAGS =3D \ =20 virt_admin_SOURCES =3D \ virt-admin.c virt-admin.h \ + virt-admin-completer.c virt-admin-completer.h \ $(NULL) =20 -VIRT_ADMIN_COMPLETER =3D \ - virt-admin-completer.c virt-admin-completer.h - -if WITH_READLINE -virt_admin_SOURCES +=3D $(VIRT_ADMIN_COMPLETER) -else ! WITH_READLINE -EXTRA_DIST +=3D $(VIRT_ADMIN_COMPLETER) -endif ! WITH_READLINE - virt_admin_LDFLAGS =3D \ $(AM_LDFLAGS) \ $(COVERAGE_LDFLAGS) \ diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index 48dd9fbc2..fd92ee8db 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -31,6 +31,7 @@ #include "virxml.h" =20 =20 +#ifdef WITH_READLINE char ** virshDomainNameCompleter(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED, @@ -147,3 +148,25 @@ virshDomainInterfaceCompleter(vshControl *ctl, virStringListFree(ret); return NULL; } +#else +char ** +virshDomainNameCompleter(vshControl *ctl ATTRIBUTE_UNUSED, + const vshCmd *cmd ATTRIBUTE_UNUSED, + unsigned int flags) +{ + virCheckFlags(-1, NULL); + + return NULL; +} + + +char ** +virshDomainInterfaceCompleter(vshControl *ctl ATTRIBUTE_UNUSED, + const vshCmd *cmd ATTRIBUTE_UNUSED, + unsigned int flags) +{ + virCheckFlags(-1, NULL); + + return NULL; +} +#endif /* WITH_READLINE */ diff --git a/tools/virt-admin-completer.c b/tools/virt-admin-completer.c index 2cd471f32..a432f0977 100644 --- a/tools/virt-admin-completer.c +++ b/tools/virt-admin-completer.c @@ -30,6 +30,7 @@ #include "virstring.h" =20 =20 +#ifdef WITH_READLINE char ** vshAdmServerCompleter(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED, @@ -74,3 +75,14 @@ vshAdmServerCompleter(vshControl *ctl, VIR_FREE(ret); return ret; } +#else +char ** +vshAdmServerCompleter(vshControl *ctl ATTRIBUTE_UNUSED, + const vshCmd *cmd ATTRIBUTE_UNUSED, + unsigned int flags) +{ + virCheckFlags(-1, NULL); + + return NULL; +} +#endif /* WITH_READLINE */ diff --git a/tools/vsh.c b/tools/vsh.c index 4426c08d6..59c8a440e 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -3500,7 +3500,7 @@ const vshCmdInfo info_complete[] =3D { }; =20 bool -cmdComplete(vshControl *ctl, const vshCmd *cmd) +cmdComplete(vshControl *ctl ATTRIBUTE_UNUSED, const vshCmd *cmd ATTRIBUTE_= UNUSED) { bool ret =3D false; #ifdef WITH_READLINE --=20 2.15.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list