From nobody Sat Apr 20 01:05:52 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 14992508675340.027857564014539093; Wed, 5 Jul 2017 03:34:27 -0700 (PDT) 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 B3EC219D37E; Wed, 5 Jul 2017 10:34:24 +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 1FD5E60F8C; Wed, 5 Jul 2017 10:34:24 +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 C07BD4A492; Wed, 5 Jul 2017 10:34:21 +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 v65AYKPf031043 for ; Wed, 5 Jul 2017 06:34:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 848E3177D8; Wed, 5 Jul 2017 10:34:20 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.42.22.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id E7BD05C550; Wed, 5 Jul 2017 10:34:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B3EC219D37E Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B3EC219D37E From: "Daniel P. Berrange" To: libvir-list@redhat.com Date: Wed, 5 Jul 2017 11:34:09 +0100 Message-Id: <20170705103412.9432-2-berrange@redhat.com> In-Reply-To: <20170705103412.9432-1-berrange@redhat.com> References: <20170705103412.9432-1-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/4] Remove duplicate define of __GNUC_PREREQ 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 05 Jul 2017 10:34:25 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Back in this commit: commit b436a8ae5ccb04f8cf893d882d52ab5efc713307 Author: Fabian Freyer Date: Thu Jun 9 00:50:35 2016 +0000 gnulib: add getopt module config-post.h was modified to define __GNUC_PREREQ, but the original definition was never removed from internal.h, and that is now dead code since config.h is always the first file included. Signed-off-by: Daniel P. Berrange --- config-post.h | 4 ++-- src/internal.h | 12 ------------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/config-post.h b/config-post.h index ffd0904..75e7d02 100644 --- a/config-post.h +++ b/config-post.h @@ -75,11 +75,11 @@ #endif /* LIBVIRT_NSS */ =20 /* - * Define __GNUC__ to a sane default if it isn't yet defined. + * Define __GNUC_PREREQ to a sane default if it isn't yet defined. * This is done here so that it's included as early as possible; gnulib re= lies * on this to be defined in features.h, which should be included from ctyp= e.h. * This doesn't happen on many non-glibc systems. - * When __GNUC__ is not defined, gnulib defines it to 0, which breaks thin= gs. + * When __GNUC_PREREQ is not defined, gnulib defines it to 0, which breaks= things. */ #ifdef __GNUC__ # ifndef __GNUC_PREREQ diff --git a/src/internal.h b/src/internal.h index 03a973c..faf3e2b 100644 --- a/src/internal.h +++ b/src/internal.h @@ -106,18 +106,6 @@ # define __FUNCTION__ __func__ # endif =20 -# ifdef __GNUC__ - -# ifndef __GNUC_PREREQ -# if defined __GNUC__ && defined __GNUC_MINOR__ -# define __GNUC_PREREQ(maj, min) = \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >=3D ((maj) << 16) + (min)) -# else -# define __GNUC_PREREQ(maj, min) 0 -# endif - -# endif /* __GNUC__ */ - /** * ATTRIBUTE_UNUSED: * --=20 2.9.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 01:05:52 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1499250867305368.7656929000502; Wed, 5 Jul 2017 03:34:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B396EC058ECC; Wed, 5 Jul 2017 10:34:24 +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 277CE5C6C5; Wed, 5 Jul 2017 10:34:24 +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 15BFC1803B26; Wed, 5 Jul 2017 10:34:23 +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 v65AYLui031053 for ; Wed, 5 Jul 2017 06:34:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 61DCB5C550; Wed, 5 Jul 2017 10:34:21 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.42.22.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id C76C25C54A; Wed, 5 Jul 2017 10:34:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B396EC058ECC Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B396EC058ECC From: "Daniel P. Berrange" To: libvir-list@redhat.com Date: Wed, 5 Jul 2017 11:34:10 +0100 Message-Id: <20170705103412.9432-3-berrange@redhat.com> In-Reply-To: <20170705103412.9432-1-berrange@redhat.com> References: <20170705103412.9432-1-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/4] Require use of GCC 4.4 or CLang compilers 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 05 Jul 2017 10:34:25 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We only ever test libvirt with GCC or CLang which provides a GCC compatible compilation environment. Between them, these compilers cover every important operating system platform, even Windows. Mandate their use to make it explicit that we don't care about compilers like Microsoft VCC or other UNIX vendor C compilers. GCC 4.4 was picked as the baseline, since RHEL-6 ships 4.4.7 and that lets us remove a large set of checks. There is a slight issue that CLang reports itself as GCC 4.2, so we must also check if __clang__ is defined. We could check a particular CLang version too, but that would require someone to figure out a suitable min version which is fun because OS-X reports totally different CLang version numbers from CLang builds on Linux/BSD Signed-off-by: Daniel P. Berrange --- config-post.h | 20 +++++----- src/internal.h | 116 ++++++++++++++++-------------------------------------= ---- 2 files changed, 44 insertions(+), 92 deletions(-) diff --git a/config-post.h b/config-post.h index 75e7d02..4bddbac 100644 --- a/config-post.h +++ b/config-post.h @@ -74,6 +74,10 @@ # undef WITH_CAPNG #endif /* LIBVIRT_NSS */ =20 +#ifndef __GNUC__ +# error "Libvirt requires GCC >=3D 4.4, or CLang" +#endif + /* * Define __GNUC_PREREQ to a sane default if it isn't yet defined. * This is done here so that it's included as early as possible; gnulib re= lies @@ -81,13 +85,11 @@ * This doesn't happen on many non-glibc systems. * When __GNUC_PREREQ is not defined, gnulib defines it to 0, which breaks= things. */ -#ifdef __GNUC__ -# ifndef __GNUC_PREREQ -# if defined __GNUC__ && defined __GNUC_MINOR__ -# define __GNUC_PREREQ(maj, min) \ - ((__GNUC__ << 16) + __GNUC_MINOR__ >=3D ((maj) << 16) + (min)) -# else -# define __GNUC_PREREQ(maj, min) 0 -# endif -# endif +#ifndef __GNUC_PREREQ +# define __GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >=3D ((maj) << 16) + (min)) +#endif + +#if !__GNUC_PREREQ(4, 4) || defined(__clang__) +# error "Libvirt requires GCC >=3D 4.4, or CLang" #endif diff --git a/src/internal.h b/src/internal.h index faf3e2b..9e2e72c 100644 --- a/src/internal.h +++ b/src/internal.h @@ -101,41 +101,32 @@ # define NUL_TERMINATE(buf) do { (buf)[sizeof(buf)-1] =3D '\0'; } while (0) # define ARRAY_CARDINALITY(Array) (sizeof(Array) / sizeof(*(Array))) =20 -/* C99 uses __func__. __FUNCTION__ is legacy. */ -# ifndef __GNUC__ -# define __FUNCTION__ __func__ -# endif - /** * ATTRIBUTE_UNUSED: * * Macro to flag consciously unused parameters to functions */ -# ifndef ATTRIBUTE_UNUSED -# define ATTRIBUTE_UNUSED __attribute__((__unused__)) -# endif +# ifndef ATTRIBUTE_UNUSED +# define ATTRIBUTE_UNUSED __attribute__((__unused__)) +# endif =20 /** * ATTRIBUTE_NORETURN: * * Macro to indicate that a function won't return to the caller */ -# ifndef ATTRIBUTE_NORETURN -# define ATTRIBUTE_NORETURN __attribute__((__noreturn__)) -# endif +# ifndef ATTRIBUTE_NORETURN +# define ATTRIBUTE_NORETURN __attribute__((__noreturn__)) +# endif =20 /** * ATTRIBUTE_SENTINEL: * * Macro to check for NULL-terminated varargs lists */ -# ifndef ATTRIBUTE_SENTINEL -# if __GNUC_PREREQ (4, 0) -# define ATTRIBUTE_SENTINEL __attribute__((__sentinel__)) -# else -# define ATTRIBUTE_SENTINEL -# endif -# endif +# ifndef ATTRIBUTE_SENTINEL +# define ATTRIBUTE_SENTINEL __attribute__((__sentinel__)) +# endif =20 /** * ATTRIBUTE_NOINLINE: @@ -143,13 +134,9 @@ * Force compiler not to inline a method. Should be used if * the method need to be overridable by test mocks. */ -# ifndef ATTRIBUTE_NOINLINE -# if __GNUC_PREREQ (4, 0) -# define ATTRIBUTE_NOINLINE __attribute__((__noinline__)) -# else -# define ATTRIBUTE_NOINLINE -# endif -# endif +# ifndef ATTRIBUTE_NOINLINE +# define ATTRIBUTE_NOINLINE __attribute__((__noinline__)) +# endif =20 /** * ATTRIBUTE_FMT_PRINTF @@ -161,23 +148,14 @@ * printf format specifiers even on broken Win32 platforms * hence we have to force 'gnu_printf' for new GCC */ -# ifndef ATTRIBUTE_FMT_PRINTF -# if __GNUC_PREREQ (4, 4) -# define ATTRIBUTE_FMT_PRINTF(fmtpos, argpos) \ - __attribute__((__format__ (__gnu_printf__, fmtpos, argpos))) -# else -# define ATTRIBUTE_FMT_PRINTF(fmtpos, argpos) \ - __attribute__((__format__ (__printf__, fmtpos, argpos))) -# endif -# endif +# ifndef ATTRIBUTE_FMT_PRINTF +# define ATTRIBUTE_FMT_PRINTF(fmtpos, argpos) \ + __attribute__((__format__ (__gnu_printf__, fmtpos, argpos))) +# endif =20 -# ifndef ATTRIBUTE_RETURN_CHECK -# if __GNUC_PREREQ (3, 4) -# define ATTRIBUTE_RETURN_CHECK __attribute__((__warn_unused_result__)) -# else -# define ATTRIBUTE_RETURN_CHECK -# endif -# endif +# ifndef ATTRIBUTE_RETURN_CHECK +# define ATTRIBUTE_RETURN_CHECK __attribute__((__warn_unused_result__)) +# endif =20 /** * ATTRIBUTE_PACKED @@ -188,13 +166,9 @@ * ethernet packets. * Others compiler than gcc may use something different e.g. #pragma pack(= 1) */ -# ifndef ATTRIBUTE_PACKED -# if __GNUC_PREREQ (3, 3) -# define ATTRIBUTE_PACKED __attribute__((packed)) -# else -# error "Need an __attribute__((packed)) equivalent" -# endif -# endif +# ifndef ATTRIBUTE_PACKED +# define ATTRIBUTE_PACKED __attribute__((packed)) +# endif =20 /* gcc's handling of attribute nonnull is less than stellar - it does * NOT improve diagnostics, and merely allows gcc to optimize away @@ -205,45 +179,21 @@ * based on whether we are compiling for real or for analysis, while * still requiring correct gcc syntax when it is turned off. See also * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D17308 */ -# ifndef ATTRIBUTE_NONNULL -# if __GNUC_PREREQ (3, 3) -# if STATIC_ANALYSIS -# define ATTRIBUTE_NONNULL(m) __attribute__((__nonnull__(m))) -# else -# define ATTRIBUTE_NONNULL(m) __attribute__(()) -# endif -# else -# define ATTRIBUTE_NONNULL(m) -# endif -# endif - -# ifndef ATTRIBUTE_FALLTHROUGH -# if __GNUC_PREREQ (7, 0) -# define ATTRIBUTE_FALLTHROUGH __attribute__((fallthrough)) -# else -# define ATTRIBUTE_FALLTHROUGH do {} while(0) -# endif +# ifndef ATTRIBUTE_NONNULL +# if STATIC_ANALYSIS +# define ATTRIBUTE_NONNULL(m) __attribute__((__nonnull__(m))) +# else +# define ATTRIBUTE_NONNULL(m) __attribute__(()) # endif +# endif =20 -# else -# ifndef ATTRIBUTE_UNUSED -# define ATTRIBUTE_UNUSED -# endif -# ifndef ATTRIBUTE_FMT_PRINTF -# define ATTRIBUTE_FMT_PRINTF(...) -# endif -# ifndef ATTRIBUTE_RETURN_CHECK -# define ATTRIBUTE_RETURN_CHECK -# endif -# ifndef ATTRIBUTE_NOINLINE -# define ATTRIBUTE_NOINLINE -# endif -# -# ifndef ATTRIBUTE_FALLTHROUGH +# ifndef ATTRIBUTE_FALLTHROUGH +# if __GNUC_PREREQ (7, 0) +# define ATTRIBUTE_FALLTHROUGH __attribute__((fallthrough)) +# else # define ATTRIBUTE_FALLTHROUGH do {} while(0) # endif -# endif /* __GNUC__ */ - +# endif =20 # if WORKING_PRAGMA_PUSH # define VIR_WARNINGS_NO_CAST_ALIGN \ --=20 2.9.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 01:05:52 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1499250887095376.69382317108455; Wed, 5 Jul 2017 03:34:47 -0700 (PDT) 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 9288B7C83A; Wed, 5 Jul 2017 10:34:45 +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 5DAC47E8FD; Wed, 5 Jul 2017 10:34:45 +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 0978E41F76; Wed, 5 Jul 2017 10:34:45 +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 v65AYMYG031060 for ; Wed, 5 Jul 2017 06:34:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 456A0177D8; Wed, 5 Jul 2017 10:34:22 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.42.22.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5AA85C54A; Wed, 5 Jul 2017 10:34:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9288B7C83A Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9288B7C83A From: "Daniel P. Berrange" To: libvir-list@redhat.com Date: Wed, 5 Jul 2017 11:34:11 +0100 Message-Id: <20170705103412.9432-4-berrange@redhat.com> In-Reply-To: <20170705103412.9432-1-berrange@redhat.com> References: <20170705103412.9432-1-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/4] Remove network constants out of internal.h 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 05 Jul 2017 10:34:46 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The HOST_NAME_MAX, INET_ADDRSTRLEN and VIR_LOOPBACK_IPV4_ADDR constants are only used by a handful of files, so are better kept in virsocketaddr.h Signed-off-by: Daniel P. Berrange --- src/internal.h | 16 ---------------- src/libxl/libxl_conf.c | 1 + src/nwfilter/nwfilter_dhcpsnoop.c | 1 + src/nwfilter/nwfilter_gentech_driver.c | 1 + src/qemu/qemu_conf.c | 1 + src/util/virsocketaddr.h | 16 ++++++++++++++++ src/util/virutil.c | 1 + src/vz/vz_sdk.c | 1 + 8 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/internal.h b/src/internal.h index 9e2e72c..bf1eeb5 100644 --- a/src/internal.h +++ b/src/internal.h @@ -65,22 +65,6 @@ # include "ignore-value.h" # include "count-leading-zeros.h" =20 -/* On architectures which lack these limits, define them (ie. Cygwin). - * Note that the libvirt code should be robust enough to handle the - * case where actual value is longer than these limits (eg. by setting - * length correctly in second argument to gethostname and by always - * using strncpy instead of strcpy). - */ -# ifndef HOST_NAME_MAX -# define HOST_NAME_MAX 256 -# endif - -# ifndef INET_ADDRSTRLEN -# define INET_ADDRSTRLEN 16 -# endif - -# define VIR_LOOPBACK_IPV4_ADDR "127.0.0.1" - /* String equality tests, suggested by Jim Meyering. */ # define STREQ(a, b) (strcmp(a, b) =3D=3D 0) # define STRCASEEQ(a, b) (c_strcasecmp(a, b) =3D=3D 0) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 938e09d..a85bc71 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -42,6 +42,7 @@ #include "viralloc.h" #include "viruuid.h" #include "vircommand.h" +#include "virsocketaddr.h" #include "libxl_domain.h" #include "libxl_conf.h" #include "libxl_utils.h" diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcp= snoop.c index 702abe1..4436e39 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -65,6 +65,7 @@ #include "virnetdev.h" #include "virfile.h" #include "viratomic.h" +#include "virsocketaddr.h" #include "virthreadpool.h" #include "configmake.h" #include "virtime.h" diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter= _gentech_driver.c index 82e20de..3d809fb 100644 --- a/src/nwfilter/nwfilter_gentech_driver.c +++ b/src/nwfilter/nwfilter_gentech_driver.c @@ -37,6 +37,7 @@ #include "nwfilter_learnipaddr.h" #include "virnetdev.h" #include "datatypes.h" +#include "virsocketaddr.h" #include "virstring.h" =20 #define VIR_FROM_THIS VIR_FROM_NWFILTER diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 73c33d6..a65c92a 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -49,6 +49,7 @@ #include "cpu/cpu.h" #include "domain_nwfilter.h" #include "virfile.h" +#include "virsocketaddr.h" #include "virstring.h" #include "viratomic.h" #include "storage_conf.h" diff --git a/src/util/virsocketaddr.h b/src/util/virsocketaddr.h index 43a3706..ae76166 100644 --- a/src/util/virsocketaddr.h +++ b/src/util/virsocketaddr.h @@ -32,6 +32,22 @@ # include # endif =20 +/* On architectures which lack these limits, define them (ie. Cygwin). + * Note that the libvirt code should be robust enough to handle the + * case where actual value is longer than these limits (eg. by setting + * length correctly in second argument to gethostname and by always + * using strncpy instead of strcpy). + */ +# ifndef HOST_NAME_MAX +# define HOST_NAME_MAX 256 +# endif + +# ifndef INET_ADDRSTRLEN +# define INET_ADDRSTRLEN 16 +# endif + +# define VIR_LOOPBACK_IPV4_ADDR "127.0.0.1" + typedef struct { union { struct sockaddr sa; diff --git a/src/util/virutil.c b/src/util/virutil.c index e4de4ca..88fff64 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -81,6 +81,7 @@ #include "virprocess.h" #include "virstring.h" #include "virutil.h" +#include "virsocketaddr.h" =20 verify(sizeof(gid_t) <=3D sizeof(unsigned int) && sizeof(uid_t) <=3D sizeof(unsigned int)); diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index 0aa1a30..c5f11a4 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -31,6 +31,7 @@ #include "domain_conf.h" #include "virtime.h" #include "virhostcpu.h" +#include "virsocketaddr.h" =20 #include "storage/storage_driver.h" #include "vz_sdk.h" --=20 2.9.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 20 01:05:52 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1499250892474881.6164543693569; Wed, 5 Jul 2017 03:34:52 -0700 (PDT) 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 B27B34E341; Wed, 5 Jul 2017 10:34:49 +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 76B707E902; Wed, 5 Jul 2017 10:34:49 +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 244D71841C41; Wed, 5 Jul 2017 10:34: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 v65AYNCT031069 for ; Wed, 5 Jul 2017 06:34:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 24BA55C54A; Wed, 5 Jul 2017 10:34:23 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.42.22.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id 88A3F5C88A; Wed, 5 Jul 2017 10:34:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B27B34E341 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B27B34E341 From: "Daniel P. Berrange" To: libvir-list@redhat.com Date: Wed, 5 Jul 2017 11:34:12 +0100 Message-Id: <20170705103412.9432-5-berrange@redhat.com> In-Reply-To: <20170705103412.9432-1-berrange@redhat.com> References: <20170705103412.9432-1-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/4] Remove incorrectly used TODO macro 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 05 Jul 2017 10:34:50 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The TODO macro expands to an fprintf() call and is used in several places in the Xen driver. Anything that wishes to print such debug messages should use the logging macros. In this case though, all the places in the Xen driver should have been raising a formal libvirt error instead. Add proper error handling and delete the TODO macro to prevent future misuse. Signed-off-by: Daniel P. Berrange --- src/internal.h | 9 --------- src/xen/xen_hypervisor.c | 6 ++++-- src/xen/xend_internal.c | 6 ++++-- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/internal.h b/src/internal.h index bf1eeb5..6a4a91f 100644 --- a/src/internal.h +++ b/src/internal.h @@ -239,15 +239,6 @@ # define EMPTYSTR(s) ((s) ? (s) : "-") =20 /** - * TODO: - * - * macro to flag unimplemented blocks - */ -# define TODO \ - fprintf(stderr, "Unimplemented block at %s:%d\n", \ - __FILE__, __LINE__); - -/** * SWAP: * * In place exchange of two values diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c index bce7b56..c4d7b2d 100644 --- a/src/xen/xen_hypervisor.c +++ b/src/xen/xen_hypervisor.c @@ -1262,7 +1262,8 @@ xenHypervisorGetSchedulerParameters(virConnectPtr con= n, } =20 /* TODO: Implement for Xen/SEDF */ - TODO + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("SEDF schedular parameters not supported"= )); return -1; case XEN_SCHEDULER_CREDIT: memset(&op_dom, 0, sizeof(op_dom)); @@ -1359,7 +1360,8 @@ xenHypervisorSetSchedulerParameters(virConnectPtr con= n, switch (op_sys.u.getschedulerid.sched_id) { case XEN_SCHEDULER_SEDF: /* TODO: Implement for Xen/SEDF */ - TODO + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("SEDF schedular parameters not supported")); return -1; case XEN_SCHEDULER_CREDIT: { memset(&op_dom, 0, sizeof(op_dom)); diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index 605c3cd..e0404e1 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -2881,7 +2881,8 @@ xenDaemonGetSchedulerParameters(virConnectPtr conn, } =20 /* TODO: Implement for Xen/SEDF */ - TODO + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("SEDF schedular parameters not supported")); goto error; case XEN_SCHED_CRED_NPARAM: /* get cpu_weight/cpu_cap from xend/domain */ @@ -2972,7 +2973,8 @@ xenDaemonSetSchedulerParameters(virConnectPtr conn, switch (sched_nparam) { case XEN_SCHED_SEDF_NPARAM: /* TODO: Implement for Xen/SEDF */ - TODO + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("SEDF schedular parameters not supported")); goto error; case XEN_SCHED_CRED_NPARAM: { char buf_weight[VIR_UUID_BUFLEN]; --=20 2.9.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list