From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32126 invoked by alias); 18 Dec 2013 13:25:59 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 32006 invoked by uid 89); 18 Dec 2013 13:25:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-pb0-f47.google.com Received: from mail-pb0-f47.google.com (HELO mail-pb0-f47.google.com) (209.85.160.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 18 Dec 2013 13:25:58 +0000 Received: by mail-pb0-f47.google.com with SMTP id um1so8410568pbc.34 for ; Wed, 18 Dec 2013 05:25:56 -0800 (PST) X-Received: by 10.68.34.37 with SMTP id w5mr33526136pbi.159.1387373156456; Wed, 18 Dec 2013 05:25:56 -0800 (PST) Received: from [192.168.1.101] ([115.199.127.143]) by mx.google.com with ESMTPSA id er3sm41140551pbb.40.2013.12.18.05.25.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Dec 2013 05:25:55 -0800 (PST) Message-ID: <52B1A20C.6090607@gmail.com> Date: Wed, 18 Dec 2013 13:25:00 -0000 From: asmwarrior User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: Pierre Muller , 'Pedro Alves' CC: 'GDB Development' , 'Binutils Development' Subject: Re: [RFC] BFD MinGW/Cygwin build error in bfd/peiXXgen.c References: <52B17083.7040404@gmail.com> <52B1738D.4010409@redhat.com> <52b19d01.22cbc20a.69b0.ffffb29eSMTPIN_ADDED_BROKEN@mx.google.com> In-Reply-To: <52b19d01.22cbc20a.69b0.ffffb29eSMTPIN_ADDED_BROKEN@mx.google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-12/txt/msg00050.txt.bz2 On 2013-12-18 21:02, Pierre Muller wrote: > Cygwin also fails to compile bfd/peigen.c, itself gebnerated > from source bfd/peXXigen.c. > > The patch below allows to compile both for mingw32 and cygwin hosts. > To fix the unknown wcsncasecmp function for mingw32 hosts, > I added this code: > > +#ifdef __MINGW32__ > +#define wcsncasecmp wcsnicmp > +#endif > I think that using the Windows API function wcsnicmp > here is OK, but I don't know if the code should be somehow modified to > accept wcsncasecmp function if it is added later to mingw hosts... > > Pierre Muller > > > bfd/ChangeLog entry: > > 2013-12-18 Pierre Muller > > peXXigen.c (u16_mbtouc): Avoid unused function warning by exculding if > __CYGWIN__ or __MINGW32__ macro is defined. > (rsrc_cmp): Fix short Windows OS version. Also use this code > for mingw32 systems. > [__MINGW32__]: Alias wcsncasecmp function to Windows API wcsnicmp function. > > diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c > index 5e2a876..05c7d8b 100644 > --- a/bfd/peXXigen.c > +++ b/bfd/peXXigen.c > @@ -2930,7 +2930,7 @@ rsrc_write_directory (rsrc_write_data * data, > BFD_ASSERT (nt == next_entry); > } > > -#ifdef HAVE_WCHAR_H > +#if defined HAVE_WCHAR_H && ! defined __CYGWIN__ && ! defined __MINGW32__ > /* Return the length (number of units) of the first character in S, > putting its 'ucs4_t' representation in *PUC. */ > > @@ -2979,9 +2979,16 @@ rsrc_cmp (bfd_boolean is_name, rsrc_entry * a, rsrc_entry * b) > /* We have to perform a case insenstive, unicode string comparison... */ > int res; > > -#ifdef __CYGWIN__ > +#if defined __CYGWIN__ || defined __MINGW32__ > +#ifdef __MINGW32__ > +#define wcsncasecmp wcsnicmp > +#endif > /* Under Cygwin unicode == UTF-16 == wchar_t. > FIXME: The same is true for MingGW - we should test for that too. */ > + bfd_byte * astring = a->name_id.name.string; > + unsigned int alen = a->name_id.name.len; > + bfd_byte * bstring = b->name_id.name.string; > + unsigned int blen = b->name_id.name.len; > res = wcsncasecmp ((const wchar_t *) astring + 2, (const wchar_t *) bstring + 2, min (alen, blen)); > #elif defined HAVE_WCHAR_H > unsigned int i; Thanks, just test this patch, it fix the build error under MinGW-Build 4.8.2 + MSYS. Yuanhui Zhang