From patchwork Fri May 26 21:34:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DJ Delorie X-Patchwork-Id: 767592 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wZKCZ5gmCz9s75 for ; Sat, 27 May 2017 07:34:34 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="dVCezqw1"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:date:message-id:mime-version :content-type; q=dns; s=default; b=hy4tpJSYhiYxTE/6LOsPnSNqq24aV RZETdRpkbwCSMTbLHwYnWSU+3IxNb2y4dATRB45tDS5z/KvU9WheepTDyMi75/Ub Zb0Pt2TgzuoqSzN4UcJUdw1muTNnyYya44asb06NA9HntJMVa8H4is4u1ZytDsWg FUBhQp2BXkP/m8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:date:message-id:mime-version :content-type; s=default; bh=v6D1C2fDPNnUUVLTmQbQHOchJ00=; b=dVC ezqw14EVotwl1tJ3efqqiYdMaav1y7gSUVdhDO4bPOQlRE5wWDvajhTyB9Yl/7NE KVKCSP6+se9WXtsOVVK02wU0XfMSZABi3swBIwEgpoPFeckGAQF1krSlIFP9T86t LFdPG/RZ6lNz8tPkeil5ZB+kwQAB32y6cb2BPbSM= Received: (qmail 96500 invoked by alias); 26 May 2017 21:34:22 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 96484 invoked by uid 89); 26 May 2017 21:34:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 26 May 2017 21:34:11 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 860E380C04; Fri, 26 May 2017 21:34:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 860E380C04 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dj@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 860E380C04 Received: from greed.delorie.com (ovpn-120-43.rdu2.redhat.com [10.10.120.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 51540189BC; Fri, 26 May 2017 21:34:13 +0000 (UTC) Received: from greed.delorie.com.redhat.com (localhost [127.0.0.1]) by greed.delorie.com (8.14.7/8.14.7) with ESMTP id v4QLYCbU004554; Fri, 26 May 2017 17:34:12 -0400 From: DJ Delorie To: Eli Zaretskii Cc: gcc-patches@gcc.gnu.org, gdb-patches@sourceware.org Subject: Re: MinGW compilation warnings in libiberty's xstrndup.c In-Reply-To: <83h90vcqo6.fsf@gnu.org> (message from Eli Zaretskii on Mon, 08 May 2017 18:30:01 +0300) Date: Fri, 26 May 2017 17:34:12 -0400 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Please try this patch: Index: config.in =================================================================== --- config.in (revision 248482) +++ config.in (working copy) @@ -76,12 +76,16 @@ #undef HAVE_DECL_SBRK /* Define to 1 if you have the declaration of `snprintf', and to 0 if you don't. */ #undef HAVE_DECL_SNPRINTF +/* Define to 1 if you have the declaration of `strnlen', and to 0 if you + don't. */ +#undef HAVE_DECL_STRNLEN + /* Define to 1 if you have the declaration of `strtol', and to 0 if you don't. */ #undef HAVE_DECL_STRTOL /* Define to 1 if you have the declaration of `strtoll', and to 0 if you don't. */ Index: configure =================================================================== --- configure (revision 248482) +++ configure (working copy) @@ -5861,12 +5861,22 @@ else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_STRTOULL $ac_have_decl _ACEOF +ac_fn_c_check_decl "$LINENO" "strnlen" "ac_cv_have_decl_strnlen" "$ac_includes_default" +if test "x$ac_cv_have_decl_strnlen" = x""yes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRNLEN $ac_have_decl +_ACEOF $as_echo "#define HAVE_SYS_ERRLIST 1" >>confdefs.h $as_echo "#define HAVE_SYS_NERR 1" >>confdefs.h @@ -7002,12 +7012,23 @@ else fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_STRVERSCMP $ac_have_decl _ACEOF + ac_fn_c_check_decl "$LINENO" "strnlen" "ac_cv_have_decl_strnlen" "$ac_includes_default" +if test "x$ac_cv_have_decl_strnlen" = x""yes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRNLEN $ac_have_decl +_ACEOF + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether canonicalize_file_name must be declared" >&5 $as_echo_n "checking whether canonicalize_file_name must be declared... " >&6; } if test "${libiberty_cv_decl_needed_canonicalize_file_name+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext Index: configure.ac =================================================================== --- configure.ac (revision 248482) +++ configure.ac (working copy) @@ -413,13 +413,13 @@ if test "x" = "y"; then stpcpy stpncpy strcasecmp strchr strdup \ strerror strncasecmp strndup strnlen strrchr strsignal strstr strtod \ strtol strtoul strtoll strtoull strverscmp sysconf sysctl sysmp \ table times tmpnam \ vasprintf vfprintf vprintf vsprintf \ wait3 wait4 waitpid) - AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, vsnprintf, strtol, strtoul, strtoll, strtoull]) + AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, vsnprintf, strtol, strtoul, strtoll, strtoull, strnlen]) AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.]) AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.]) AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.]) fi # For each of these functions, if the host does not provide the @@ -686,12 +686,13 @@ if test -z "${setobjs}"; then AC_CHECK_FUNCS($checkfuncs) AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, vsnprintf]) AC_CHECK_DECLS([calloc, getenv, getopt, malloc, realloc, sbrk]) AC_CHECK_DECLS([strtol, strtoul, strtoll, strtoull]) AC_CHECK_DECLS([strverscmp]) + AC_CHECK_DECLS([strnlen]) libiberty_NEED_DECLARATION(canonicalize_file_name) fi # Figure out which version of pexecute to use. case "${host}" in *-*-mingw* | *-*-winnt*) pexecute=pex-win32 ;;