From patchwork Sun Oct 9 11:20:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Zaretskii X-Patchwork-Id: 16367 Received: (qmail 14119 invoked by alias); 9 Oct 2016 11:20:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 14007 invoked by uid 89); 9 Oct 2016 11:20:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=MinGW, string.h, UD:string.h, stringh X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 09 Oct 2016 11:20:30 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1btC9Z-00058a-PG for gdb-patches@sourceware.org; Sun, 09 Oct 2016 07:20:28 -0400 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33353) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btC9Z-00058U-Lb for gdb-patches@sourceware.org; Sun, 09 Oct 2016 07:20:25 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4628 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1btC9X-0004xO-Ke for gdb-patches@sourceware.org; Sun, 09 Oct 2016 07:20:24 -0400 Date: Sun, 09 Oct 2016 14:20:34 +0300 Message-Id: <83oa2tg459.fsf@gnu.org> From: Eli Zaretskii To: gdb-patches@sourceware.org Subject: MinGW compilation errors due to strcasecmp Reply-to: Eli Zaretskii X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-IsSubscribed: yes I've upgraded to the latest mingw.org's MinGW runtime lately, and that triggers compilation errors building GDB 7.12: g++ -O2 -gdwarf-4 -g3 -I. -I. -I./common -I./config -DLOCALEDIR="\"d:/usr/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../opcodes/.. -I./../readline/.. -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber -I./gnulib/import -Ibuild-gnulib/import -DTUI=1 -Id:/usr/include -Id:/usr/include/guile/2.0 -Id:/usr/Python26/include -Id:/usr/Python26/include -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-write-strings -Wno-narrowing -Wno-format -c -o windows-nat.o -MT windows-nat.o -MMD -MP -MF .deps/windows-nat.Tpo windows-nat.c windows-nat.c: In function 'so_list* windows_make_so(const char*, LPVOID)': windows-nat.c:608:35: error: 'strcasecmp' was not declared in this scope if (strcasecmp (buf, "ntdll.dll") == 0) ^ windows-nat.c: In function 'int envvar_cmp(const void*, const void*)': windows-nat.c:2031:28: error: 'strcasecmp' was not declared in this scope return strcasecmp (*p, *q); ^ Makefile:1134: recipe for target `windows-nat.o' failed make[2]: *** [windows-nat.o] Error 1 A similar error happens in stap-probe.c. The reason for this is that MinGW runtime changed the place where the prototypes of strcasecmp and strncasecmp are declared: they are now in strings.h (which AFAIU is more compatible to other systems). But we don't include strings.h anywhere, although the configure script probes for it. I guess other platforms include that header indirectly somehow. My suggestion is to include it in common-defs.h, as shown below. Is it okay to push such a change to the repository (with a suitable ChangeLog entry, of course)? --- ./gdb/common/common-defs.h~0 2016-10-07 20:09:21.000000000 +0300 +++ ./gdb/common/common-defs.h 2016-10-09 12:30:04.178750000 +0300 @@ -49,6 +50,9 @@ #include #include +#ifdef HAVE_STRINGS_H +#include /* for strcasecmp and strncasecmp */ +#endif #include #include