From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VjQIt-0006XU-QQ for qemu-devel@nongnu.org; Thu, 21 Nov 2013 04:12:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VjQIn-0003Lb-QA for qemu-devel@nongnu.org; Thu, 21 Nov 2013 04:12:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32633) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VjQIn-0003LW-GS for qemu-devel@nongnu.org; Thu, 21 Nov 2013 04:11:57 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rAL9Bunq017026 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 21 Nov 2013 04:11:56 -0500 Date: Thu, 21 Nov 2013 11:15:06 +0200 From: "Michael S. Tsirkin" Message-ID: <20131121091506.GA22462@redhat.com> References: <528A7D64.4020908@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <528A7D64.4020908@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [for-1.7] hw/i386/acpi-build.c vs glib-2.12 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: qemu-devel On Tue, Nov 19, 2013 at 06:49:40AM +1000, Richard Henderson wrote: > hw/i386/acpi-build.c:294:5: error: implicit declaration of function > =E2=80=98g_string_vprintf=E2=80=99 [-Werror=3Dimplicit-function-declara= tion] > g_string_vprintf(s, format, args); >=20 > Introduced in 2.14. >=20 >=20 > hw/i386/acpi-build.c:427:5: error: implicit declaration of function > =E2=80=98g_array_get_element_size=E2=80=99 [-Werror=3Dimplicit-function= -declaration] > return table->len * g_array_get_element_size(table); >=20 > Introduced in 2.22. >=20 >=20 > Our (self-)documented minimums are >=20 > if test "$mingw32" =3D yes; then > # g_poll is required in order to integrate with the glib main loop. > glib_req_ver=3D2.20 > else > glib_req_ver=3D2.12 > fi >=20 >=20 > Within unix variants at least, vs(n)printf is likely to be much more po= rtable > than the glib function. I suspect MinGW has it as well, though I've no= t checked. >=20 > As for g_array_get_element_size, aren't all of your tables element size= 1? > That's all I can see from acpi_build_tables_init, though I admit to not= digging > deeper. >=20 >=20 >=20 > r~ Can you please confirm this fixes the issue for you? diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 486e705..97e0fba 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -287,14 +287,17 @@ static inline void build_append_array(GArray *array= , GArray *val) =20 static void build_append_nameseg(GArray *array, const char *format, ...) { - GString *s =3D g_string_new(""); + /* It would be nicer to use g_string_vprintf but it's only there in = 2.22 */ + char s[] =3D "XXXX"; + int len; va_list args; =20 va_start(args, format); g_string_vprintf(s, format, args); + len =3D vsnprintf(s, sizeof s, format, args); va_end(args); =20 - assert(s->len =3D=3D 4); + assert(len =3D=3D 4); g_array_append_vals(array, s->str, s->len); g_string_free(s, true); } @@ -424,7 +427,10 @@ static inline void *acpi_data_push(GArray *table_dat= a, unsigned size) =20 static unsigned acpi_data_len(GArray *table) { - return table->len * g_array_get_element_size(table); +#if GLIB_CHECK_VERSION(2, 14, 0) + assert(g_array_get_element_size(table) =3D=3D 1); +#endif + return table->len; } =20 static void acpi_align_size(GArray *blob, unsigned align)