This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
RE: [RFC-v2] BFD MinGW/Cygwin build error in bfd/peiXXgen.c
- From: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- To: "'nick clifton'" <nickc at redhat dot com>, "'Pedro Alves'" <palves at redhat dot com>, "'asmwarrior'" <asmwarrior at gmail dot com>
- Cc: "'GDB Development'" <gdb at sourceware dot org>, "'Binutils Development'" <binutils at sourceware dot org>
- Date: Thu, 19 Dec 2013 14:18:31 +0100
- Subject: RE: [RFC-v2] BFD MinGW/Cygwin build error in bfd/peiXXgen.c
- Authentication-results: sourceware.org; auth=none
- References: <52B17083 dot 7040404 at gmail dot com> <52B1738D dot 4010409 at redhat dot com> <002101cefbf1$7554b9a0$5ffe2ce0$ at muller@ics-cnrs.unistra.fr> <52B1E03E dot 9010002 at redhat dot com> <006c01cefcaf$bec215b0$3c464110$ at muller@ics-cnrs.unistra.fr> <52B2E8C4 dot 3080208 at redhat dot com>
> > 2013-12-19 Pierre Muller <muller@sourceware.org>
> >
> > peXXigen.c (u16_mbtouc): Avoid unused function warning by
> excluding if
> > __CYGWIN__ or __MINGW32__ macro is defined.
> > (rsrc_cmp): Fix Windows host version and version without wchar
> header.
> > [__CYGWIN__, __MINGW32__]: Introduce rsrccmp macro.
>
> Thanks - I have applied this patch.
Not yet completely OK:
peigen.c: In function ârsrc_cmpâ:
peigen.c:2984:17: erreur: unused variable âiâ [-Werror=unused-variable]
ChangeLog entry:
2013-12-19 Pierre Muller <muller@sourceware.org>
Fix unused variable warning.
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 843cae8..d50db73 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -2981,7 +2981,6 @@ static signed int
rsrc_cmp (bfd_boolean is_name, rsrc_entry * a, rsrc_entry * b)
{
signed int res;
- unsigned int i;
bfd_byte * astring;
unsigned int alen;
bfd_byte * bstring;
@@ -3013,24 +3012,26 @@ rsrc_cmp (bfd_boolean is_name, rsrc_entry * a, rsrc_entry * b)
min (alen, blen));
#elif defined HAVE_WCHAR_H
- res = 0;
- for (i = min (alen, blen); i--; astring += 2, bstring += 2)
- {
- wchar_t awc;
- wchar_t bwc;
-
- /* Convert UTF-16 unicode characters into wchar_t characters so
- that we can then perform a case insensitive comparison. */
- int Alen = u16_mbtouc (& awc, (const unsigned short *) astring, 2);
- int Blen = u16_mbtouc (& bwc, (const unsigned short *) bstring, 2);
-
- if (Alen != Blen)
- return Alen - Blen;
- res = wcsncasecmp (& awc, & bwc, 1);
- if (res)
- break;
- }
-
+ {
+ unsigned int i;
+ res = 0;
+ for (i = min (alen, blen); i--; astring += 2, bstring += 2)
+ {
+ wchar_t awc;
+ wchar_t bwc;
+
+ /* Convert UTF-16 unicode characters into wchar_t characters so
+ that we can then perform a case insensitive comparison. */
+ int Alen = u16_mbtouc (& awc, (const unsigned short *) astring, 2);
+ int Blen = u16_mbtouc (& bwc, (const unsigned short *) bstring, 2);
+
+ if (Alen != Blen)
+ return Alen - Blen;
+ res = wcsncasecmp (& awc, & bwc, 1);
+ if (res)
+ break;
+ }
+ }
#else
/* Do the best we can - a case sensitive, untranslated comparison. */
res = memcmp (astring, bstring, min (alen, blen) * 2);