From nobody Thu Mar 28 14:58:47 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; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1546927135746184.89281419429722; Mon, 7 Jan 2019 21:58:55 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8300BC07EFC3; Tue, 8 Jan 2019 05:58:53 +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 46B3B60CD0; Tue, 8 Jan 2019 05:58:53 +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 6B0A73F954; Tue, 8 Jan 2019 05:58:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x085wmDO010579 for ; Tue, 8 Jan 2019 00:58:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 461395C21E; Tue, 8 Jan 2019 05:58:48 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-216.phx2.redhat.com [10.3.116.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id 005405C20D; Tue, 8 Jan 2019 05:58:47 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Mon, 7 Jan 2019 23:58:41 -0600 Message-Id: <20190108055842.19272-2-eblake@redhat.com> In-Reply-To: <20190108055842.19272-1-eblake@redhat.com> References: <20190108055842.19272-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: jtomko@redhat.com Subject: [libvirt] [PATCH v2 1/2] examples: Drop event-test.c dependency on gnulib 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: , 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 08 Jan 2019 05:58:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Pulling in gnulib just for the header is rather expensive, especially since that header does not require us to link against gnulib. It's better to make the event-test example be standalone by just open-coding a more limited form of a verify() macro that depends on modern gcc (we have enough CI coverage that even though the verify is now a no-op in older setups, we will still notice if we fail to add an event - as a quick test, I still provoked a compile failure on Fedora 29 by deleting a line from domainEvents). Signed-off-by: Eric Blake Reviewed-by: J=C3=A1n Tomko --- examples/object-events/event-test.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/object-events/event-test.c b/examples/object-events/e= vent-test.c index 8499e0b38e..6694d3dffc 100644 --- a/examples/object-events/event-test.c +++ b/examples/object-events/event-test.c @@ -6,8 +6,6 @@ #include #include -#include - #define VIR_ENUM_SENTINELS #include @@ -17,6 +15,14 @@ #define STREQ(a, b) (strcmp(a, b) =3D=3D 0) #define NULLSTR(s) ((s) ? (s) : "") +#if (4 < __GNUC__ + (6 <=3D __GNUC_MINOR__) \ + && (201112L <=3D __STDC_VERSION__ || !defined __STRICT_ANSI__) \ + && !defined __cplusplus) +# define verify(cond) _Static_assert(cond, "verify (" #cond ")") +#else +# define verify(cond) +#endif + #ifndef ATTRIBUTE_UNUSED # define ATTRIBUTE_UNUSED __attribute__((__unused__)) #endif --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Mar 28 14:58:47 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; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1546927136221457.994775032882; Mon, 7 Jan 2019 21:58:56 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 83069C07EFD5; Tue, 8 Jan 2019 05:58:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 132C25C20D; Tue, 8 Jan 2019 05:58:53 +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 37B7D181BA1A; Tue, 8 Jan 2019 05:58:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x085wmik010584 for ; Tue, 8 Jan 2019 00:58:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id AC1425C21E; Tue, 8 Jan 2019 05:58:48 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-216.phx2.redhat.com [10.3.116.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64A805C20D; Tue, 8 Jan 2019 05:58:48 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Mon, 7 Jan 2019 23:58:42 -0600 Message-Id: <20190108055842.19272-3-eblake@redhat.com> In-Reply-To: <20190108055842.19272-1-eblake@redhat.com> References: <20190108055842.19272-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: jtomko@redhat.com Subject: [libvirt] [PATCH v2 2/2] examples: Avoid gnulib, have standalone examples 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: , 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 08 Jan 2019 05:58:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Commit 0c6ad476 updated gnulib, which rearranged some of the conditions in gnulib wrapper headers such that compilation started failing on BSD systems when the normal system tried to include another system header but instead got a gnulib wrapper header in an incomplete state; this is because gnulib headers only work if is included first. Commit b6f78259 papered over the symptoms of that by including in all the examples. But this logic is backwards - if our examples are truly meant to be stand-alone, they should NOT depend on how libvirt was configured, and should NOT depend on the gnulib fixes for system quirks. In particular, if an example does not need to link against libgnulib.la, then it also does not need to use -Ignulib in its compile flags, and likewise does not need to include since none of the gnulib wrapper headers should be interfering. So, revert (most of) b6f78259 (except for the bogus pre-patch use of "config.h" in admin/logging.c: if config.h is included, it should be via <> rather than "", and must be before any system headers); then additionally nuke all mention of , -Ignulib, and -lgnulib, making all of the examples truly standalone. Signed-off-by: Eric Blake Reviewed-by: J=C3=A1n Tomko --- v2: rewrite to nuke rather than partition use of gnulib, revert Jan's patch that landed in meantime --- examples/Makefile.am | 5 ++--- examples/admin/client_close.c | 2 -- examples/admin/client_info.c | 3 +-- examples/admin/client_limits.c | 2 -- examples/admin/list_clients.c | 2 -- examples/admin/list_servers.c | 2 -- examples/admin/logging.c | 2 -- examples/admin/threadpool_params.c | 2 -- examples/dommigrate/dommigrate.c | 2 -- examples/domsuspend/suspend.c | 2 -- examples/domtop/domtop.c | 2 -- examples/hellolibvirt/hellolibvirt.c | 2 -- examples/object-events/event-test.c | 2 -- examples/openauth/openauth.c | 2 -- examples/rename/rename.c | 2 -- 15 files changed, 3 insertions(+), 31 deletions(-) diff --git a/examples/Makefile.am b/examples/Makefile.am index 61cf2af4a5..76907a1c8f 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -34,10 +34,9 @@ EXTRA_DIST =3D \ AM_CPPFLAGS =3D \ - -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir) \ - -I$(top_builddir)/gnulib/lib -I$(top_srcdir)/gnulib/lib + -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir) LDADD =3D $(STATIC_BINARIES) $(WARN_CFLAGS) $(COVERAGE_LDFLAGS) \ - $(top_builddir)/src/libvirt.la $(top_builddir)/gnulib/lib/libgnu.la \ + $(top_builddir)/src/libvirt.la \ $(top_builddir)/src/libvirt-admin.la noinst_PROGRAMS=3Ddominfo/info1 dommigrate/dommigrate domsuspend/suspend \ diff --git a/examples/admin/client_close.c b/examples/admin/client_close.c index 9b7e1febb1..5c28ce7949 100644 --- a/examples/admin/client_close.c +++ b/examples/admin/client_close.c @@ -1,5 +1,3 @@ -#include - #include #include #include diff --git a/examples/admin/client_info.c b/examples/admin/client_info.c index 550a24824a..2c46ccf514 100644 --- a/examples/admin/client_info.c +++ b/examples/admin/client_info.c @@ -1,5 +1,4 @@ -#include - +#define _GNU_SOURCE #include #include #include diff --git a/examples/admin/client_limits.c b/examples/admin/client_limits.c index a87cb52c82..69b931682c 100644 --- a/examples/admin/client_limits.c +++ b/examples/admin/client_limits.c @@ -1,5 +1,3 @@ -#include - #include #include #include diff --git a/examples/admin/list_clients.c b/examples/admin/list_clients.c index 1d961a1ec9..15205a7bd1 100644 --- a/examples/admin/list_clients.c +++ b/examples/admin/list_clients.c @@ -1,5 +1,3 @@ -#include - #include #include #include diff --git a/examples/admin/list_servers.c b/examples/admin/list_servers.c index d48d87af6e..e53cd3b48f 100644 --- a/examples/admin/list_servers.c +++ b/examples/admin/list_servers.c @@ -1,5 +1,3 @@ -#include - #include #include #include diff --git a/examples/admin/logging.c b/examples/admin/logging.c index 10952afa03..730ae40d9d 100644 --- a/examples/admin/logging.c +++ b/examples/admin/logging.c @@ -1,5 +1,3 @@ -#include - #include #include #include diff --git a/examples/admin/threadpool_params.c b/examples/admin/threadpool= _params.c index 9517dcb0f2..be833c2ea3 100644 --- a/examples/admin/threadpool_params.c +++ b/examples/admin/threadpool_params.c @@ -1,5 +1,3 @@ -#include - #include #include #include diff --git a/examples/dommigrate/dommigrate.c b/examples/dommigrate/dommigr= ate.c index 71a0af4058..1b6072d138 100644 --- a/examples/dommigrate/dommigrate.c +++ b/examples/dommigrate/dommigrate.c @@ -20,8 +20,6 @@ * . */ -#include - #include #include #include diff --git a/examples/domsuspend/suspend.c b/examples/domsuspend/suspend.c index ac816044ef..af61129ecc 100644 --- a/examples/domsuspend/suspend.c +++ b/examples/domsuspend/suspend.c @@ -19,8 +19,6 @@ * . */ -#include - #include #include #include diff --git a/examples/domtop/domtop.c b/examples/domtop/domtop.c index fb631781fd..4224e4c9ec 100644 --- a/examples/domtop/domtop.c +++ b/examples/domtop/domtop.c @@ -18,8 +18,6 @@ * . */ -#include - #include #include #include diff --git a/examples/hellolibvirt/hellolibvirt.c b/examples/hellolibvirt/h= ellolibvirt.c index 02c4401987..bfb12846e6 100644 --- a/examples/hellolibvirt/hellolibvirt.c +++ b/examples/hellolibvirt/hellolibvirt.c @@ -2,8 +2,6 @@ * hypervisor and gather a few bits of information about domains. * Similar API's exist for storage pools, networks, and interfaces. */ -#include - #include #include #include diff --git a/examples/object-events/event-test.c b/examples/object-events/e= vent-test.c index 6694d3dffc..53d95b10d0 100644 --- a/examples/object-events/event-test.c +++ b/examples/object-events/event-test.c @@ -1,5 +1,3 @@ -#include - #include #include #include diff --git a/examples/openauth/openauth.c b/examples/openauth/openauth.c index eef46d5f52..efd21c374f 100644 --- a/examples/openauth/openauth.c +++ b/examples/openauth/openauth.c @@ -1,8 +1,6 @@ /* This is a copy of the hellolibvirt example demonstaring how to use * virConnectOpenAuth with a custom auth callback */ -#include - #include #include #include diff --git a/examples/rename/rename.c b/examples/rename/rename.c index c64dd5baa3..85f18e9df3 100644 --- a/examples/rename/rename.c +++ b/examples/rename/rename.c @@ -16,8 +16,6 @@ * . */ -#include - #include #include #include --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list