From patchwork Fri Aug 9 22:10:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 1144981 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-104268-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="k4TF44sw"; dkim-atps=neutral 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 464zvH0Csbz9sN1 for ; Sat, 10 Aug 2019 08:10:18 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=YkeRtBKjmcq+5qpyLWs0ghTZAYexc f7Nuf98DSYl+ywn6/zOlwc+oQX0ZbTBhzXykMVi7JJL+ubi5ReXgqWBurZVe+LZ8 tPJcS3ws2zlRvUv+IUf9p1OVjL/xU5GEMXnnRl9VoBHOahWPgwoRUZscdG2lmdh4 rmn7GjwB/qCfHs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=vZm56EmZXwiRrVYbTQdjmfSXpuw=; b=k4T F44swDQap3nS0Sg9CzbYthwWu/qSily+A6rRd71BX66ckWNUcWT9OurXPFg7p/yO F5eCoOJFJey7DyIwaoUN1RWotO8ofOEaq8+WKOy6buOaIq7fi5xNpwGu/KjojSyz PLfUpjb04FHWWNKk2zA9gfs1wsl+b0zemnMA57CY= Received: (qmail 64143 invoked by alias); 9 Aug 2019 22:10:13 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 64134 invoked by uid 89); 9 Aug 2019 22:10:13 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=stopping, HX-Languages-Length:2014 X-HELO: esa4.mentor.iphmx.com IronPort-SDR: +EiJnuTfZsXlctab7e3dOTMckoHhOCzHPW9oWYto9wDDVMnzGwRwYO2H5hv7fAElTgCK48pM1h kX2ilkzXAAiY1su+1PettNnjTk+eLLYhnXDoTrFBmeVkY4IGPJk6zC1pS4F09bmJo4dFKis+Sl IFcqHqmjNbgO9Jqt13I7OHzE3UxWEg/YA8agQuH6eqvakd6JI3q+2uUMMdUFmEttBuzbN46V07 UG35M/rCNsjEh6HnfJscUi2yFjnJlP0LBxrw0tNcE+wx3F5WypMecKVOKjRSqMq7ueZ0ZAqJfX Xfc= IronPort-SDR: Y0z4SxXmFQUAAdJXIJ3KLm1JAz7hsz/Ydb2eeeN8Wm+zXGKblF9L8bivAjwc+LB823308R2u4O AKla/Wzn7ATOF/YGPoScRtEhr9US0vsE71phrX+rukLabUtglJ11qP5ckRj1+w0GFQ/bDiveYi I+nrulU7MSuUTUbCy/2Jgf3UQRcUXjKtm1yDZDbBIMkH/LXUdmn9bm6SBQiADwqBRmEEqNvkyn Yq0yu/QsIgFB4pFfDt/L6t15vVGW2ZEYwzjaSROivhavYgpUkII1HvWli+wNaDOcmyjKwoWwgK AQQ= Date: Fri, 9 Aug 2019 22:10:04 +0000 From: Joseph Myers To: Subject: Declare memccpy, strdup, strndup for C2X Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 C2X adds the memccpy, strdup and strndup functions. This patch duly adds __GLIBC_USE (ISOC2X) to the conditions under which declares them. Tested for x86_64. 2019-08-09 Joseph Myers * string/string.h (memccpy): Also declare if [__GLIBC_USE (ISOC2X)]. (strdup): Likewise. (strndup): Likewise. --- This patch is relative to a tree with applied. diff --git a/string/string.h b/string/string.h index c38eea971f..f51a9e2270 100644 --- a/string/string.h +++ b/string/string.h @@ -49,7 +49,7 @@ extern void *memmove (void *__dest, const void *__src, size_t __n) /* Copy no more than N bytes of SRC to DEST, stopping when C is found. Return the position in DEST one byte past where C was copied, or NULL if C was not found in the first N bytes of SRC. */ -#if defined __USE_MISC || defined __USE_XOPEN +#if defined __USE_MISC || defined __USE_XOPEN || __GLIBC_USE (ISOC2X) extern void *memccpy (void *__restrict __dest, const void *__restrict __src, int __c, size_t __n) __THROW __nonnull ((1, 2)); @@ -161,7 +161,7 @@ extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, #endif #if (defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 \ - || __GLIBC_USE (LIB_EXT2)) + || __GLIBC_USE (LIB_EXT2) || __GLIBC_USE (ISOC2X)) /* Duplicate S, returning an identical malloc'd string. */ extern char *strdup (const char *__s) __THROW __attribute_malloc__ __nonnull ((1)); @@ -170,7 +170,7 @@ extern char *strdup (const char *__s) /* Return a malloc'd copy of at most N bytes of STRING. The resultant string is terminated even if no null terminator appears before STRING[N]. */ -#if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2) +#if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2) || __GLIBC_USE (ISOC2X) extern char *strndup (const char *__string, size_t __n) __THROW __attribute_malloc__ __nonnull ((1)); #endif