From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1W75W5-0007MJ-JR for mharc-grub-devel@gnu.org; Sat, 25 Jan 2014 10:51:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40595) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W75Vw-0007L6-PY for grub-devel@gnu.org; Sat, 25 Jan 2014 10:51:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W75Vq-000594-7S for grub-devel@gnu.org; Sat, 25 Jan 2014 10:51:20 -0500 Received: from mail-la0-x22b.google.com ([2a00:1450:4010:c03::22b]:54885) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W75Vp-00058x-Q0 for grub-devel@gnu.org; Sat, 25 Jan 2014 10:51:14 -0500 Received: by mail-la0-f43.google.com with SMTP id pv20so3448412lab.30 for ; Sat, 25 Jan 2014 07:51:11 -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=u+JviFXqaQWXnzEzDHHmTm3dQlzA63TWVQwivoRhBAY=; b=VFbjF5P/6oDQnaugSfMdXQW9HLK8wSQZDremxnumAJdCd2jlwgeKPekngIrGUpMxS1 4WR7GKGWMfotSLKkQLSonmm3LnQaQuJmX1cIZ3Tm2xJIfxU5l+Uel3H93GNagYei5W0g NVGU5mBMGEhqN+Ua3DeQ1tCysxlBUfEkV6OKfJ95xXiAVvVEeRWeMUSBPD3r6TVsOzD9 FCiAP+RLAUYEGwtlhfqJKQLZBx7cWYwAnpa2iS9BqJF5bYm9yu4aD+t8gE7PADe1Q3MK NBvZKE+/h+Wq9WCOc2IkMoCDXoPM7xuMvnkehTJGp5Dv0/at+bw7kKin/9BfdUM4gOIZ uwmw== X-Received: by 10.152.87.142 with SMTP id ay14mr12268078lab.7.1390665071356; Sat, 25 Jan 2014 07:51:11 -0800 (PST) Received: from opensuse.site (ppp91-76-154-95.pppoe.mtu-net.ru. [91.76.154.95]) by mx.google.com with ESMTPSA id np10sm5203772lbb.7.2014.01.25.07.51.10 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Sat, 25 Jan 2014 07:51:10 -0800 (PST) Date: Sat, 25 Jan 2014 19:51:09 +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: <20140125195109.69118cbd@opensuse.site> In-Reply-To: <52E2CE49.9000105@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> <20140118230208.044b1e22@opensuse.site> <52DAD0F3.9010101@gmail.com> <20140118230950.7d285645@opensuse.site> <52E2CE49.9000105@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_/P3W+F4Des4ci+.v7EtAMaCO"; 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::22b 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, 25 Jan 2014 15:51:27 -0000 --Sig_/P3W+F4Des4ci+.v7EtAMaCO Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =D0=92 Fri, 24 Jan 2014 21:34:17 +0100 Vladimir '=CF=86-coder/phcoder' Serbinenko =D0=BF=D0=B8= =D1=88=D0=B5=D1=82: > On 18.01.2014 20:09, Andrey Borzenkov wrote: > > =D0=92 Sat, 18 Jan 2014 20:07:31 +0100 > > Vladimir '=CF=86-coder/phcoder' Serbinenko =D0=BF= =D0=B8=D1=88=D0=B5=D1=82: > >=20 > >> On 18.01.2014 20:02, Andrey Borzenkov wrote: > >>> + fw.write (f.read ().replace ("(printf,f,a)", "(__printf__,f,= a)").replace ("(printf,f,a)", "(__printf__,f,a)")) > >> Why replace twice? > >> > >=20 > > Somehow I though they had different number of arguments. Do not know > > why. Sorry. > >=20 > Can you send fixed patch for me to have a look, and, probably, approve. 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..2b3322d 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)")) + f.close () + fw.close () + continue + fw.write (f.read ()) f.close () fw.close () --=20 tg: (61c8482..) u/mingw/attribute_printf (depends on: master) --Sig_/P3W+F4Des4ci+.v7EtAMaCO Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iEYEARECAAYFAlLj3W0ACgkQR6LMutpd94wiqwCeOje2EJEFwHemubdnlDwmtohx BF4An0hxvg+7lRd34U57cYyCPGxzjwCi =91xU -----END PGP SIGNATURE----- --Sig_/P3W+F4Des4ci+.v7EtAMaCO--