From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 109720 invoked by alias); 8 May 2017 15:30:33 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 109315 invoked by uid 89); 8 May 2017 15:30:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: fencepost.gnu.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (208.118.235.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 08 May 2017 15:30:25 +0000 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1578 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1d7kc9-0006QS-Nn; Mon, 08 May 2017 11:30:22 -0400 Date: Mon, 08 May 2017 15:37:00 -0000 Message-Id: <83h90vcqo6.fsf@gnu.org> From: Eli Zaretskii To: gcc-patches@gcc.gnu.org CC: gdb-patches@sourceware.org Subject: MinGW compilation warnings in libiberty's xstrndup.c Reply-to: Eli Zaretskii X-SW-Source: 2017-05/txt/msg00558.txt.bz2 When compiling libiberty (as part of GDB) with MinGW on MS-Windows, I see the following warning: gcc -c -DHAVE_CONFIG_H -O2 -gdwarf-4 -g3 -D__USE_MINGW_ACCESS -I. -I./../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic -D_GNU_SOURCE ./xstrndup.c -o xstrndup.o ./xstrndup.c: In function 'xstrndup': ./xstrndup.c:51:16: warning: implicit declaration of function 'strnlen' [-Wimplicit-function-declaration] size_t len = strnlen (s, n); ^ This happens because libiberty.h uses incorrect guards for the prototype of strnlen: #if defined (HAVE_DECL_STRNLEN) && !HAVE_DECL_STRNLEN extern size_t strnlen (const char *, size_t); #endif It should use HAVE_STRNLEN instead, because that's the only strnlen-related macro defined in config.g when strnlen is probed by the configure script. Thanks.