From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1W4bA2-0001Dv-Og for mharc-grub-devel@gnu.org; Sat, 18 Jan 2014 14:02:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48936) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W4b9u-0001DQ-AF for grub-devel@gnu.org; Sat, 18 Jan 2014 14:02:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W4b9n-0008Ji-N6 for grub-devel@gnu.org; Sat, 18 Jan 2014 14:02:18 -0500 Received: from mail-la0-x230.google.com ([2a00:1450:4010:c03::230]:42391) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W4b9n-0008Jc-9M for grub-devel@gnu.org; Sat, 18 Jan 2014 14:02:11 -0500 Received: by mail-la0-f48.google.com with SMTP id er20so4475690lab.21 for ; Sat, 18 Jan 2014 11:02:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-type; bh=p7lSWTBXtHsB6t59PucprCC2+TAzPyrY6GYDEDjk8fE=; b=XOwKhnsenFn9vPQl8u44Z7tLHC14/4XLhwYd6IQyLCMhBpWuGYk7rzn2SgcxglEZXM rxFC3ePQAwT0nzgU9sH0BySL0sZ3AMduiFbRRy54JCfCMY5cygjzZCThPvkbPGTW94zb e6uFnVSXrK8jeuxMiQ9w8TEQC7eVjR+jIrugMEqbpDZcjbzp5aF4Cw2KGLMnUrov00ec e5h62YBqI4dod857VNBYMzorBSLXHKwiDcDqvdscooi0Um89CrNywB+nnUV+9kLJjv0x qrkGdVH75J3h7JJw2vwAyFkiPiMg70QlZkwkji534y/CciU82GacCbooe8xjlm/iqK5X 9k2Q== X-Received: by 10.112.139.72 with SMTP id qw8mr5115973lbb.16.1390071730033; Sat, 18 Jan 2014 11:02:10 -0800 (PST) Received: from opensuse.site (ppp91-76-163-241.pppoe.mtu-net.ru. [91.76.163.241]) by mx.google.com with ESMTPSA id mq10sm9684126lbb.12.2014.01.18.11.02.09 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Sat, 18 Jan 2014 11:02:09 -0800 (PST) Date: Sat, 18 Jan 2014 23:02:08 +0400 From: Andrey Borzenkov To: grub-devel@gnu.org Subject: Re: [PATCH v2] fix Mingw W64-32 cross compile failure due to printf redefinition in libintl.h Message-ID: <20140118230208.044b1e22@opensuse.site> In-Reply-To: <52DAAAD5.5000807@gmail.com> References: <1388253611-16848-1-git-send-email-arvidjaar@gmail.com> <1390061390-14156-1-git-send-email-arvidjaar@gmail.com> <52DAAAD5.5000807@gmail.com> X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.22; x86_64-suse-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/KhVTGD7W+iex1PMSfuK0+h2"; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::230 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2014 19:02:25 -0000 --Sig_/KhVTGD7W+iex1PMSfuK0+h2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =D0=92 Sat, 18 Jan 2014 17:24:53 +0100 Vladimir '=CF=86-coder/phcoder' Serbinenko =D0=BF=D0=B8= =D1=88=D0=B5=D1=82: > On 18.01.2014 17:09, Andrey Borzenkov wrote: > > In file included from util/misc.c:36:0: > > ./include/grub/emu/misc.h:56:1: error: 'libintl_printf' is an unrecogni= zed format function type [-Werror=3Dformat=3D] > > char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((f= ormat (printf, 1, 2))) WARN_UNUSED_RESULT; > > ^ > > ./include/grub/emu/misc.h:58:1: error: 'libintl_printf' is an unrecogni= zed format function type [-Werror=3Dformat=3D] > >=20 > > The reason is libintl.h which redefines printf as libintl_printf. The p= roblem > > is not present in native MinGW build which avoids redefinition. Use > > (format (__printf__) instead which is valid replacement in GCC. > >=20 > > v2: add grub-core/lib/libgcrypt/src/g10lib.h > >=20 > can we avoid modifying libgcrypt? Well, we can do it during import? From: Andrey Borzenkov Subject: [PATCH v3] fix Mingw W64-32 cross compile failure due to printf re= definition in libintl.h In file included from util/misc.c:36:0: ./include/grub/emu/misc.h:56:1: error: 'libintl_printf' is an unrecognized = format function type [-Werror=3Dformat=3D] char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((forma= t (printf, 1, 2))) WARN_UNUSED_RESULT; ^ ./include/grub/emu/misc.h:58:1: error: 'libintl_printf' is an unrecognized = format function type [-Werror=3Dformat=3D] The reason is libintl.h which redefines printf as libintl_printf. The probl= em is not present in native MinGW build which avoids redefinition. Use (format (__printf__) instead which is valid replacement in GCC. v2: add grub-core/lib/libgcrypt/src/g10lib.h v3: modify g10lib.h during import --- include/grub/crypto.h | 2 +- include/grub/emu/misc.h | 8 ++++---- include/grub/err.h | 2 +- util/import_gcry.py | 6 ++++++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/include/grub/crypto.h b/include/grub/crypto.h index ec1b980..a24e89d 100644 --- a/include/grub/crypto.h +++ b/include/grub/crypto.h @@ -408,7 +408,7 @@ void _gcry_assert_failed (const char *expr, const char = *file, int line, const char *func) __attribute__ ((noreturn)); =20 void _gcry_burn_stack (int bytes); -void _gcry_log_error( const char *fmt, ... ) __attribute__ ((format (prin= tf, 1, 2))); +void _gcry_log_error( const char *fmt, ... ) __attribute__ ((format (__pr= intf__, 1, 2))); =20 =20 #ifdef GRUB_UTIL diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h index dde48c1..a588ba2 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h @@ -53,11 +53,11 @@ grub_util_device_is_mapped (const char *dev); void * EXPORT_FUNC(xmalloc) (grub_size_t size) WARN_UNUSED_RESULT; void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) WARN_UNUSED_RES= ULT; char * EXPORT_FUNC(xstrdup) (const char *str) WARN_UNUSED_RESULT; -char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((forma= t (printf, 1, 2))) WARN_UNUSED_RESULT; +char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((forma= t (__printf__, 1, 2))) WARN_UNUSED_RESULT; =20 -void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((fo= rmat (printf, 1, 2))); -void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((fo= rmat (printf, 1, 2))); -void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((f= ormat (printf, 1, 2), noreturn)); +void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((fo= rmat (__printf__, 1, 2))); +void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((fo= rmat (__printf__, 1, 2))); +void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((f= ormat (__printf__, 1, 2), noreturn)); =20 grub_uint64_t EXPORT_FUNC (grub_util_get_cpu_time_ms) (void); =20 diff --git a/include/grub/err.h b/include/grub/err.h index 9896fcc..1590c68 100644 --- a/include/grub/err.h +++ b/include/grub/err.h @@ -91,6 +91,6 @@ int EXPORT_FUNC(grub_error_pop) (void); void EXPORT_FUNC(grub_print_error) (void); extern int EXPORT_VAR(grub_err_printed_errors); int grub_err_printf (const char *fmt, ...) - __attribute__ ((format (printf, 1, 2))); + __attribute__ ((format (__printf__, 1, 2))); =20 #endif /* ! GRUB_ERR_HEADER */ diff --git a/util/import_gcry.py b/util/import_gcry.py index 63ebb90..a3a903e 100644 --- a/util/import_gcry.py +++ b/util/import_gcry.py @@ -534,6 +534,12 @@ for src in sorted (os.listdir (os.path.join (indir, "s= rc"))): fw.close () continue =20 + if src =3D=3D "g10lib.h": + fw.write (f.read ().replace ("(printf,f,a)", "(__printf__,f,a)").r= eplace ("(printf,f,a)", "(__printf__,f,a)")) + f.close () + fw.close () + continue + fw.write (f.read ()) f.close () fw.close () --=20 tg: (e0a8509..) u/mingw/attribute_printf (depends on: master) --Sig_/KhVTGD7W+iex1PMSfuK0+h2 Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iEYEARECAAYFAlLaz7AACgkQR6LMutpd94zg+QCbBeEYJ12eZWF05oJNiWCvtmU2 E1UAn28WCsFqPlhmYv50IjGyrShbZ/g8 =ULde -----END PGP SIGNATURE----- --Sig_/KhVTGD7W+iex1PMSfuK0+h2--