From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 2362F1F5A2 for ; Mon, 10 Feb 2020 03:03:08 +0000 (UTC) Received: from localhost ([::1]:56346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j0zLm-0003Wg-NJ for normalperson@yhbt.net; Sun, 09 Feb 2020 22:03:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41544) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j0zLb-0003WQ-W2 for bug-gnulib@gnu.org; Sun, 09 Feb 2020 22:03:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j0zLV-0007dW-Lp for bug-gnulib@gnu.org; Sun, 09 Feb 2020 22:02:55 -0500 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::4]:28859) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j0zLU-0007UE-Kq for bug-gnulib@gnu.org; Sun, 09 Feb 2020 22:02:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1581303764; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=fqCx8+KeMOxLMQEZekVAQmQDIh9Koj2PBiVsUORoVPQ=; b=a4hdcUxG8HRiiUCLuVcVZGuPdZx5uQL8DhtaI5rv2WBu/YdRG/KBEFcFFTjf4OqRTP 3eotE0stg+OeOY8lqs9aSTd8EhtAYJvnDj5zVRV4zUSweRYXPmzx8F/fpVd5Y9lCmvpu eqb1t4mQExvDzkOb7Yr7ZnuN1op3gfVocZr9VM6+aoaAMNH/y1vQvnNPlQJCy8F84MWK IOga8eer6eNU00GnYTuPC7YYX/wEg4yCvo21RaR9uBSaNBPZTgALQjCrUJh0E5DDIoK9 bxO7r0EADSQDMhFiWmi9igrd8G1+dmALa+MKac0DWJoXPUrhIecZ0d549kL/4hiHIEgQ pODA== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOH6fzxfs=" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 46.1.12 DYNA|AUTH) with ESMTPSA id g00701w1A32Vifp (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve X9_62_prime256v1 with 256 ECDH bits, eq. 3072 bits RSA)) (Client did not present a certificate); Mon, 10 Feb 2020 04:02:31 +0100 (CET) From: Bruno Haible To: bug-gnulib@gnu.org Subject: Re: restrict Date: Mon, 10 Feb 2020 04:02:30 +0100 Message-ID: <1751343.mXlyrFEpWx@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-171-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: References: <20200209144434.GA19087@aun.utmark.mea> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:238:20a:202:5300::4 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tim =?ISO-8859-1?Q?R=FChsen?= , Mats Erik Andersson Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" Tim R=C3=BChsen wrote: > gcc -Wall tells you so (gcc 8 and upwards): > $ gcc -Wall msg.c -o msg > msg.c: In function =E2=80=98main=E2=80=99: > msg.c:11:13: warning: passing argument 1 to restrict-qualified parameter > aliases with argument 4 [-Wrestrict] > 11 | snprintf (msg, sizeof (msg), "%s%s", msg, WRONG_MESSAGE); > | ^~~ ~~~ > msg.c:11:35: warning: =E2=80=98%s=E2=80=99 directive output may be trunca= ted writing 4 > bytes into a region of size between 1 and 11 [-Wformat-truncation=3D] > 11 | snprintf (msg, sizeof (msg), "%s%s", msg, WRONG_MESSAGE); > | ^~ > msg.c:11:3: note: =E2=80=98snprintf=E2=80=99 output between 5 and 15 byte= s into a > destination of size 11 > 11 | snprintf (msg, sizeof (msg), "%s%s", msg, WRONG_MESSAGE); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >=20 Oh, the 'restrict' keyword is actually useful (other than for micro- optimizations)! Thanks for this pointer, Tim. So, it would make sense to use this keyword in function declarations in public .h files in gnulib. =46or internal .h files in gnulib, there's no point - this code is assumed correct, no need to try to get GCC to produce warnings here. What does 'restrict' precisely mean? ISO C 99 =C2=A7 6.7.3.(7): "An object that is accessed through a restrict-qualified pointer has a special association with that pointer. This association, defined in 6.7.3.1 below, requires that all accesses to that object use, directly or indirectly, the value of that particular pointer.115) The intended use of the restrict qualifier (like the register storage class) is to promote optimization, and deleting all instances of the qualifier from all preprocessing translation units composing a conforming program does not change its meaning (i.e., observable behavior)." Which function declarations could therefore profit from the 'restrict' keyword? - Only parameters of pointer types, excluding function pointer types, matter. - If all pointer parameters are 'const SOMETHING *', the function is not writing into them, therefore 'restrict' is redundant. Example: int strcmp (const char *, const char *); - If all pointer parameters point to different types, excluding 'void *', ISO C forbids aliasing anyway, therefore 'restrict' is redundant. Example: void dfacomp (char const *, ptrdiff_t, struct dfa *, bool); and https://pubs.opengroup.org/onlinepubs/9699919799/functions/glob.html - If, among the parameters, there are N parameters of type [const] TYPE * adding the 'restrict' keyword to N-1 of them is equivalent to adding the 'restrict' keyword to all N of them. See ISO C 99 =C2=A7 6.7.3.1.(7) [Example 1]. GCC's warning facility understands this, regarding the non-const pointe= r. Test case: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D #include extern int smprintf (char *restrict, size_t, const char *, ...) __attribute__ ((__format__ (__printf__, 3, 4))); int main () { char msg[sizeof ("try a fool")] =3D "try a "; smprintf (msg, sizeof (msg), "%s%s", msg, "fool"); } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D - If a function has an input parameter of type const TYPE * and an output parameter of type TYPE * then the 'restrict' keyword means that the implementation may write the output before having finished reading all the input. Example: void arctwo_encrypt (arctwo_context *context, const char *inbuf, char * restrict outbuf, size_t length); Whereas the absence of the 'restrict' keyword means that the implementation will read all the input _before_ starting to store the output. Example: int hmac_md5 (const void *key, size_t keylen, const void *buffer, size_t buflen, void *resbuf); - 'restrict' should NOT be used for multiple output parameters of the same type, when only a single word is written through each parameter. Example: ssize_t copy_file_range (int ifd, off_t *ipos, int ofd, off_t = *opos, size_t len, unsigned flags); Rationale: It is OK to have ipos and opos point to different elements of the same off_t[] array. Is this all right, or did I misinterpret something? If it is right, then how about this start of a patch? (Not sure whether I n= eed to add the 'restrict' keyword also in the function definitions?) Bruno diff --git a/lib/amemxfrm.h b/lib/amemxfrm.h index 7cfc283..0edd3d5 100644 =2D-- a/lib/amemxfrm.h +++ b/lib/amemxfrm.h @@ -38,7 +38,8 @@ extern "C" { freshly allocated string is returned. In both cases, *lengthp is set t= o the length of the returned string. Upon failure, return NULL, with errno set. */ =2Dextern char * amemxfrm (char *s, size_t n, char *resultbuf, size_t *leng= thp); +extern char * amemxfrm (char * restrict s, size_t n, + char * restrict resultbuf, size_t *lengthp); =20 =20 #ifdef __cplusplus diff --git a/lib/arcfour.h b/lib/arcfour.h index b77df1a..b23e792 100644 =2D-- a/lib/arcfour.h +++ b/lib/arcfour.h @@ -37,7 +37,7 @@ typedef struct before this function is called. */ extern void arcfour_stream (arcfour_context * context, =2D const char *inbuf, char *outbuf, size_t length); + const char *inbuf, char * restrict outbuf, size_t length); =20 /* Initialize CONTEXT using encryption KEY of KEYLEN bytes. KEY should be 40 bits (5 bytes) or longer. The KEY cannot be zero diff --git a/lib/arctwo.h b/lib/arctwo.h index 91f725f..e88489a 100644 =2D-- a/lib/arctwo.h +++ b/lib/arctwo.h @@ -48,7 +48,7 @@ arctwo_setkey_ekb (arctwo_context *context, arctwo_setkey_ekb. */ extern void arctwo_encrypt (arctwo_context *context, const char *inbuf, =2D char *outbuf, size_t length); + char * restrict outbuf, size_t length); =20 /* Decrypt INBUF of size LENGTH into OUTBUF. LENGTH must be a multiple of ARCTWO_BLOCK_SIZE. CONTEXT hold the decryption key, @@ -56,6 +56,6 @@ arctwo_encrypt (arctwo_context *context, const char *inbu= f, arctwo_setkey_ekb. */ extern void arctwo_decrypt (arctwo_context *context, const char *inbuf, =2D char *outbuf, size_t length); + char * restrict outbuf, size_t length); =20 #endif /* ARCTWO_H */ diff --git a/lib/astrxfrm.h b/lib/astrxfrm.h index a23ed70..9906659 100644 =2D-- a/lib/astrxfrm.h +++ b/lib/astrxfrm.h @@ -37,7 +37,8 @@ extern "C" { freshly allocated string is returned. In both cases, *lengthp is set t= o the length of the returned string. Upon failure, return NULL, with errno set. */ =2Dextern char * astrxfrm (const char *s, char *resultbuf, size_t *lengthp); +extern char * astrxfrm (const char *s, + char * restrict resultbuf, size_t *lengthp); =20 =20 #ifdef __cplusplus diff --git a/lib/c-snprintf.h b/lib/c-snprintf.h index bfdc081..3b31bd4 100644 =2D-- a/lib/c-snprintf.h +++ b/lib/c-snprintf.h @@ -36,7 +36,8 @@ extern "C" { #endif =20 =2Dint c_snprintf (char *str, size_t size, const char *format, ...) +extern int c_snprintf (char * restrict str, size_t size, + const char *format, ...) _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 4)); =20 #ifdef __cplusplus diff --git a/lib/c-vasnprintf.h b/lib/c-vasnprintf.h index 1a69e56..c44a31b 100644 =2D-- a/lib/c-vasnprintf.h +++ b/lib/c-vasnprintf.h @@ -66,7 +66,8 @@ extern "C" { Formatting takes place in the C locale, that is, the decimal point used= in floating-point formatting directives is always '.'. */ =2Dextern char *c_vasnprintf (char *resultbuf, size_t *lengthp, const char = *format, va_list args) +extern char *c_vasnprintf (char * restrict resultbuf, size_t *lengthp, + const char *format, va_list args) _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 0)); =20 #ifdef __cplusplus diff --git a/lib/c-vsnprintf.h b/lib/c-vsnprintf.h index 97a2816..1b20fd5 100644 =2D-- a/lib/c-vsnprintf.h +++ b/lib/c-vsnprintf.h @@ -39,7 +39,8 @@ extern "C" { #endif =20 =2Dint c_vsnprintf (char *str, size_t size, const char *format, va_list arg= s) +extern int c_vsnprintf (char * restrict str, size_t size, + const char *format, va_list args) _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 0)); =20 #ifdef __cplusplus diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h index 584cfe9..f249ab6 100644 =2D-- a/lib/careadlinkat.h +++ b/lib/careadlinkat.h @@ -47,7 +47,7 @@ struct allocator; set errno. */ =20 char *careadlinkat (int fd, char const *filename, =2D char *buffer, size_t buffer_size, + char * restrict buffer, size_t buffer_size, struct allocator const *alloc, ssize_t (*preadlinkat) (int, char const *, char *, size_t)); diff --git a/lib/gc.h b/lib/gc.h index 05fb8a3..bd90bd0 100644 =2D-- a/lib/gc.h +++ b/lib/gc.h @@ -185,12 +185,12 @@ extern Gc_rc gc_pbkdf2_hmac (Gc_hash hash, const char *P, size_t Plen, const char *S, size_t Slen, =2D unsigned int c, char *DK, size_t dkLen); + unsigned int c, char * restrict DK, size_t dkLen); =20 extern Gc_rc gc_pbkdf2_sha1 (const char *P, size_t Plen, const char *S, size_t Slen, =2D unsigned int c, char *DK, size_t dkLen); + unsigned int c, char * restrict DK, size_t dkLen); =20 /* TODO: diff --git a/lib/gl_openssl.h b/lib/gl_openssl.h index e5991d8..d188a6a 100644 =2D-- a/lib/gl_openssl.h +++ b/lib/gl_openssl.h @@ -90,15 +90,15 @@ GL_CRYPTO_FN (_process_block) (const void *buf, size_t = len, struct _gl_ctx *ctx) #endif =20 GL_OPENSSL_INLINE void * =2DGL_CRYPTO_FN (_finish_ctx) (struct _gl_ctx *ctx, void *res) +GL_CRYPTO_FN (_finish_ctx) (struct _gl_ctx *ctx, void * restrict res) { OPENSSL_FN (_Final) ((unsigned char *) res, (_gl_CTX *) ctx); return res= ; } =20 GL_OPENSSL_INLINE void * =2DGL_CRYPTO_FN (_buffer) (const char *buf, size_t len, void *res) +GL_CRYPTO_FN (_buffer) (const char *buf, size_t len, void * restrict res) { return OPENSSL_FN () ((const unsigned char *) buf, len, (unsigned char *= ) res); } =20 GL_OPENSSL_INLINE void * =2DGL_CRYPTO_FN (_read_ctx) (const struct _gl_ctx *ctx, void *res) +GL_CRYPTO_FN (_read_ctx) (const struct _gl_ctx *ctx, void * restrict res) { /* Assume any unprocessed bytes in ctx are not to be ignored. */ _gl_CTX tmp_ctx =3D *(_gl_CTX *) ctx; diff --git a/lib/memcoll.h b/lib/memcoll.h index add0968..233385b 100644 =2D-- a/lib/memcoll.h +++ b/lib/memcoll.h @@ -22,7 +22,7 @@ =20 # include =20 =2Dint memcoll (char *, size_t, char *, size_t); +int memcoll (char * restrict, size_t, char * restrict, size_t); int memcoll0 (char const *, size_t, char const *, size_t); =20 #endif /* MEMCOLL_H_ */ diff --git a/lib/monetary.in.h b/lib/monetary.in.h index ab17917..5b67cec 100644 =2D-- a/lib/monetary.in.h +++ b/lib/monetary.in.h @@ -79,15 +79,18 @@ extern "C" { # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strfmon_l rpl_strfmon_l # endif =2D_GL_FUNCDECL_RPL (strfmon_l, ssize_t, (char *s, size_t maxsize, locale_t= locale, +_GL_FUNCDECL_RPL (strfmon_l, ssize_t, (char * restrict s, size_t maxsize, + locale_t locale, const char *format, ...) _GL_ATTRIBUTE_FORMAT_STRFMON (4, 5) _GL_ARG_NONNULL ((4))); =2D_GL_CXXALIAS_RPL (strfmon_l, ssize_t, (char *s, size_t maxsize, locale_t= locale, +_GL_CXXALIAS_RPL (strfmon_l, ssize_t, (char * restrict s, size_t maxsize, + locale_t locale, const char *format, ...)); # else # if @HAVE_STRFMON_L@ =2D_GL_CXXALIAS_SYS (strfmon_l, ssize_t, (char *s, size_t maxsize, locale_t= locale, +_GL_CXXALIAS_SYS (strfmon_l, ssize_t, (char * restrict s, size_t maxsize, + locale_t locale, const char *format, ...)); # endif # endif diff --git a/lib/parse-datetime.h b/lib/parse-datetime.h index ab9b576..d2c7518 100644 =2D-- a/lib/parse-datetime.h +++ b/lib/parse-datetime.h @@ -19,11 +19,13 @@ #include #include =20 =2Dbool parse_datetime (struct timespec *, char const *, struct timespec co= nst *); +bool parse_datetime (struct timespec * restrict, + char const *, struct timespec const *); =20 /* parse_datetime2 flag: if set, print debug/progress information to STDER= R */ #define PARSE_DATETIME_DEBUG 1 =20 /* same as above, supporting additional flags */ =2Dbool parse_datetime2 (struct timespec *, char const *, struct timespec c= onst *, +bool parse_datetime2 (struct timespec * restrict, + char const *, struct timespec const *, unsigned int flags, timezone_t, char const *); diff --git a/lib/quotearg.h b/lib/quotearg.h index d30fdd1..1261c8f 100644 =2D-- a/lib/quotearg.h +++ b/lib/quotearg.h @@ -323,7 +323,7 @@ void set_custom_quoting (struct quoting_options *o, On output, BUFFER might contain embedded null bytes if ARGSIZE was not -1, the style of O does not use backslash escapes, and the flags of O do not request elision of null bytes.*/ =2Dsize_t quotearg_buffer (char *buffer, size_t buffersize, +size_t quotearg_buffer (char * restrict buffer, size_t buffersize, char const *arg, size_t argsize, struct quoting_options const *o); =20 diff --git a/lib/regex-quote.h b/lib/regex-quote.h index 185f9fe..0d166c7 100644 =2D-- a/lib/regex-quote.h +++ b/lib/regex-quote.h @@ -77,7 +77,7 @@ extern size_t /* Copies the quoted string to p and returns the incremented p. There must be room for regex_quote_length (string, spec) + 1 bytes at p= =2E */ extern char * =2D regex_quote_copy (char *p, + regex_quote_copy (char * restrict p, const char *string, const struct regex_quote_spec= *spec); =20 /* Returns the freshly allocated quoted string. */ diff --git a/lib/rijndael-api-fst.h b/lib/rijndael-api-fst.h index 0553acc..e6ac5ab 100644 =2D-- a/lib/rijndael-api-fst.h +++ b/lib/rijndael-api-fst.h @@ -157,7 +157,7 @@ extern int rijndaelBlockEncrypt (rijndaelCipherInstance *cipher, const rijndaelKeyInstance *key, const char *input, size_t inputLen, =2D char *outBuffer); + char * restrict outBuffer); =20 /* Encrypt data in INPUT, of INPUTOCTETS bytes length, placing the output in the pre-allocated OUTBUFFER which must hold at least @@ -172,7 +172,7 @@ extern int rijndaelPadEncrypt (rijndaelCipherInstance *cipher, const rijndaelKeyInstance *key, const char *input, size_t inputOctets, =2D char *outBuffer); + char * restrict outBuffer); =20 /* Decrypt data in INPUT, of INPUTLEN/8 bytes length, placing the output in the pre-allocated OUTBUFFER which must hold at least @@ -185,7 +185,7 @@ extern int rijndaelBlockDecrypt (rijndaelCipherInstance *cipher, const rijndaelKeyInstance *key, const char *input, size_t inputLen, =2D char *outBuffer); + char * restrict outBuffer); =20 /* Decrypt data in INPUT, of INPUTOCTETS bytes length, placing the output in the pre-allocated OUTBUFFER which must hold at least @@ -200,6 +200,6 @@ extern int rijndaelPadDecrypt (rijndaelCipherInstance *cipher, const rijndaelKeyInstance *key, const char *input, size_t inputOctets, =2D char *outBuffer); + char * restrict outBuffer); =20 #endif /* __RIJNDAEL_API_FST_H */ diff --git a/lib/sh-quote.h b/lib/sh-quote.h index 9dcd4cf..2f9a69b 100644 =2D-- a/lib/sh-quote.h +++ b/lib/sh-quote.h @@ -33,7 +33,7 @@ extern size_t shell_quote_length (const char *string); =20 /* Copies the quoted string to p and returns the incremented p. There must be room for shell_quote_length (string) + 1 bytes at p. */ =2Dextern char * shell_quote_copy (char *p, const char *string); +extern char * shell_quote_copy (char * restrict p, const char *string); =20 /* Returns the freshly allocated quoted string. */ extern char * shell_quote (const char *string); diff --git a/lib/sha1.h b/lib/sha1.h index 99c53da..e97914b 100644 =2D-- a/lib/sha1.h +++ b/lib/sha1.h @@ -71,13 +71,13 @@ extern void sha1_process_bytes (const void *buffer, siz= e_t len, in first 20 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ =2Dextern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf); +extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void * restrict resbuf= ); =20 =20 /* Put result from CTX in first 20 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ =2Dextern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf); +extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void * restrict re= sbuf); =20 =20 /* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The diff --git a/lib/sha256.h b/lib/sha256.h index 1bc61d4..a1dad2e 100644 =2D-- a/lib/sha256.h +++ b/lib/sha256.h @@ -70,15 +70,17 @@ extern void sha256_process_bytes (const void *buffer, s= ize_t len, in first 32 (28) bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ =2Dextern void *sha256_finish_ctx (struct sha256_ctx *ctx, void *resbuf); =2Dextern void *sha224_finish_ctx (struct sha256_ctx *ctx, void *resbuf); +extern void *sha256_finish_ctx (struct sha256_ctx *ctx, void * restrict re= sbuf); +extern void *sha224_finish_ctx (struct sha256_ctx *ctx, void * restrict re= sbuf); =20 =20 /* Put result from CTX in first 32 (28) bytes following RESBUF. The resul= t is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ =2Dextern void *sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf= ); =2Dextern void *sha224_read_ctx (const struct sha256_ctx *ctx, void *resbuf= ); +extern void *sha256_read_ctx (const struct sha256_ctx *ctx, + void * restrict resbuf); +extern void *sha224_read_ctx (const struct sha256_ctx *ctx, + void * restrict resbuf); =20 =20 /* Compute SHA256 (SHA224) message digest for LEN bytes beginning at BUFFE= R. The diff --git a/lib/sha512.h b/lib/sha512.h index aaf35a5..20818e0 100644 =2D-- a/lib/sha512.h +++ b/lib/sha512.h @@ -70,8 +70,8 @@ extern void sha512_process_bytes (const void *buffer, siz= e_t len, in first 64 (48) bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ =2Dextern void *sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf); =2Dextern void *sha384_finish_ctx (struct sha512_ctx *ctx, void *resbuf); +extern void *sha512_finish_ctx (struct sha512_ctx *ctx, void * restrict re= sbuf); +extern void *sha384_finish_ctx (struct sha512_ctx *ctx, void * restrict re= sbuf); =20 =20 /* Put result from CTX in first 64 (48) bytes following RESBUF. The resul= t is @@ -80,8 +80,10 @@ extern void *sha384_finish_ctx (struct sha512_ctx *ctx, = void *resbuf); =20 IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ =2Dextern void *sha512_read_ctx (const struct sha512_ctx *ctx, void *resbuf= ); =2Dextern void *sha384_read_ctx (const struct sha512_ctx *ctx, void *resbuf= ); +extern void *sha512_read_ctx (const struct sha512_ctx *ctx, + void * restrict resbuf); +extern void *sha384_read_ctx (const struct sha512_ctx *ctx, + void * restrict resbuf); =20 =20 /* Compute SHA512 (SHA384) message digest for LEN bytes beginning at BUFFE= R. The diff --git a/lib/signal.in.h b/lib/signal.in.h index 9fe9f60..9690953 100644 =2D-- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -133,16 +133,20 @@ typedef void (*sighandler_t) (int); # define pthread_sigmask rpl_pthread_sigmask # endif _GL_FUNCDECL_RPL (pthread_sigmask, int, =2D (int how, const sigset_t *new_mask, sigset_t *old_mask= )); + (int how, const sigset_t *new_mask, + sigset_t * restrict old_mask)); _GL_CXXALIAS_RPL (pthread_sigmask, int, =2D (int how, const sigset_t *new_mask, sigset_t *old_mask= )); + (int how, const sigset_t *new_mask, + sigset_t * restrict old_mask)); # else # if !(@HAVE_PTHREAD_SIGMASK@ || defined pthread_sigmask) _GL_FUNCDECL_SYS (pthread_sigmask, int, =2D (int how, const sigset_t *new_mask, sigset_t *old_mask= )); + (int how, const sigset_t *new_mask, + sigset_t * restrict old_mask)); # endif _GL_CXXALIAS_SYS (pthread_sigmask, int, =2D (int how, const sigset_t *new_mask, sigset_t *old_mask= )); + (int how, const sigset_t *new_mask, + sigset_t * restrict old_mask)); # endif # if __GLIBC__ >=3D 2 _GL_CXXALIASWARN (pthread_sigmask); @@ -295,10 +299,12 @@ _GL_CXXALIASWARN (sigpending); # define SIG_SETMASK 1 /* blocked_set =3D *set; */ # define SIG_UNBLOCK 2 /* blocked_set =3D blocked_set & ~*set; */ _GL_FUNCDECL_SYS (sigprocmask, int, =2D (int operation, const sigset_t *set, sigset_t *old_set= )); + (int operation, const sigset_t *set, + sigset_t * restrict old_set)); # endif _GL_CXXALIAS_SYS (sigprocmask, int, =2D (int operation, const sigset_t *set, sigset_t *old_set= )); + (int operation, const sigset_t *set, + sigset_t * restrict old_set)); _GL_CXXALIASWARN (sigprocmask); =20 /* Install the handler FUNC for signal SIG, and return the previous diff --git a/lib/sm3.h b/lib/sm3.h index e0bdd90..9da0ab3 100644 =2D-- a/lib/sm3.h +++ b/lib/sm3.h @@ -75,12 +75,12 @@ extern void sm3_process_bytes (const void *buffer, size= _t len, in first 32 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ =2Dextern void *sm3_finish_ctx (struct sm3_ctx *ctx, void *resbuf); +extern void *sm3_finish_ctx (struct sm3_ctx *ctx, void * restrict resbuf); =20 /* Put result from CTX in first 32 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ =2Dextern void *sm3_read_ctx (const struct sm3_ctx *ctx, void *resbuf); +extern void *sm3_read_ctx (const struct sm3_ctx *ctx, void * restrict resb= uf); =20 /* Compute SM3 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise diff --git a/lib/stdio.in.h b/lib/stdio.in.h index 388565d..2386852 100644 =2D-- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -1113,20 +1113,20 @@ _GL_CXXALIASWARN (scanf); # define snprintf rpl_snprintf # endif _GL_FUNCDECL_RPL (snprintf, int, =2D (char *str, size_t size, const char *format, ...) + (char * restrict str, size_t size, const char *format, .= =2E.) _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) _GL_ARG_NONNULL ((3))); _GL_CXXALIAS_RPL (snprintf, int, =2D (char *str, size_t size, const char *format, ...)); + (char * restrict str, size_t size, const char *format, .= =2E.)); # else # if !@HAVE_DECL_SNPRINTF@ _GL_FUNCDECL_SYS (snprintf, int, =2D (char *str, size_t size, const char *format, ...) + (char * restrict str, size_t size, const char *format, .= =2E.) _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) _GL_ARG_NONNULL ((3))); # endif _GL_CXXALIAS_SYS (snprintf, int, =2D (char *str, size_t size, const char *format, ...)); + (char * restrict str, size_t size, const char *format, .= =2E.)); # endif _GL_CXXALIASWARN (snprintf); #elif defined GNULIB_POSIXCHECK @@ -1151,12 +1151,12 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable = =2D " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define sprintf rpl_sprintf # endif =2D_GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...) +_GL_FUNCDECL_RPL (sprintf, int, (char * restrict str, const char *format, = =2E..) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((1, 2))); =2D_GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...)); +_GL_CXXALIAS_RPL (sprintf, int, (char * restrict str, const char *format, = =2E..)); # else =2D_GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...)); +_GL_CXXALIAS_SYS (sprintf, int, (char * restrict str, const char *format, = =2E..)); # endif # if __GLIBC__ >=3D 2 _GL_CXXALIASWARN (sprintf); @@ -1386,20 +1386,24 @@ _GL_CXXALIASWARN (vscanf); # define vsnprintf rpl_vsnprintf # endif _GL_FUNCDECL_RPL (vsnprintf, int, =2D (char *str, size_t size, const char *format, va_list a= rgs) + (char * restrict str, size_t size, + const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) _GL_ARG_NONNULL ((3))); _GL_CXXALIAS_RPL (vsnprintf, int, =2D (char *str, size_t size, const char *format, va_list a= rgs)); + (char * restrict str, size_t size, + const char *format, va_list args)); # else # if !@HAVE_DECL_VSNPRINTF@ _GL_FUNCDECL_SYS (vsnprintf, int, =2D (char *str, size_t size, const char *format, va_list a= rgs) + (char * restrict str, size_t size, + const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) _GL_ARG_NONNULL ((3))); # endif _GL_CXXALIAS_SYS (vsnprintf, int, =2D (char *str, size_t size, const char *format, va_list a= rgs)); + (char * restrict str, size_t size, + const char *format, va_list args)); # endif _GL_CXXALIASWARN (vsnprintf); #elif defined GNULIB_POSIXCHECK @@ -1416,17 +1420,17 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportabl= e - " # define vsprintf rpl_vsprintf # endif _GL_FUNCDECL_RPL (vsprintf, int, =2D (char *str, const char *format, va_list args) + (char * restrict str, const char *format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (vsprintf, int, =2D (char *str, const char *format, va_list args)); + (char * restrict str, const char *format, va_list args)); # else /* Need to cast, because on Solaris, the third parameter is __va_list args and GCC's fixincludes did not change this to __gnuc_va_list. */ _GL_CXXALIAS_SYS_CAST (vsprintf, int, =2D (char *str, const char *format, va_list args)); + (char * restrict str, const char *format, va_list a= rgs)); # endif # if __GLIBC__ >=3D 2 _GL_CXXALIASWARN (vsprintf); diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 49bbf6f..5ae909d 100644 =2D-- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -866,15 +866,19 @@ _GL_WARN_ON_USE (reallocarray, "reallocarray is not p= ortable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define realpath rpl_realpath # endif =2D_GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved) =2D _GL_ARG_NONNULL ((1))); =2D_GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved)); +_GL_FUNCDECL_RPL (realpath, char *, + (const char *name, char * restrict resolved) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (realpath, char *, + (const char *name, char * restrict resolved)); # else # if !@HAVE_REALPATH@ =2D_GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved) =2D _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (realpath, char *, + (const char *name, char * restrict resolved) + _GL_ARG_NONNULL ((1))); # endif =2D_GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved)); +_GL_CXXALIAS_SYS (realpath, char *, + (const char *name, char * restrict resolved)); # endif _GL_CXXALIASWARN (realpath); #elif defined GNULIB_POSIXCHECK diff --git a/lib/strftime.h b/lib/strftime.h index 97a062c..d0ac48e 100644 =2D-- a/lib/strftime.h +++ b/lib/strftime.h @@ -25,7 +25,7 @@ extern "C" { POSIX requires that strftime use the local timezone information. Use the timezone __TZ instead. Use __NS as the number of nanoseconds in the %N directive. */ =2Dsize_t nstrftime (char *, size_t, char const *, struct tm const *, +size_t nstrftime (char * restrict, size_t, char const *, struct tm const *, timezone_t __tz, int __ns); =20 #ifdef __cplusplus diff --git a/lib/string.in.h b/lib/string.in.h index 2be474d..de97453 100644 =2D-- a/lib/string.in.h +++ b/lib/string.in.h @@ -411,11 +411,14 @@ _GL_WARN_ON_USE (strdup, "strdup is unportable - " # undef strncat # define strncat rpl_strncat # endif =2D_GL_FUNCDECL_RPL (strncat, char *, (char *dest, const char *src, size_t = n) =2D _GL_ARG_NONNULL ((1, 2))); =2D_GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t = n)); +_GL_FUNCDECL_RPL (strncat, char *, + (char * restrict dest, const char *src, size_t n) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (strncat, char *, + (char * restrict dest, const char *src, size_t n)); # else =2D_GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t = n)); +_GL_CXXALIAS_SYS (strncat, char *, + (char * restrict dest, const char *src, size_t n)); # endif # if __GLIBC__ >=3D 2 _GL_CXXALIASWARN (strncat); @@ -966,7 +969,8 @@ _GL_EXTERN_C char * mbssep (char **stringp, const char = *delim) Caveat: The identity of the delimiting character is lost. =20 See also mbssep(). */ =2D_GL_EXTERN_C char * mbstok_r (char *string, const char *delim, char **sa= ve_ptr) +_GL_EXTERN_C char * mbstok_r (char * restrict string, const char *delim, + char **save_ptr) _GL_ARG_NONNULL ((2, 3)); #endif =20 diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h index 8e013e6..2c44801 100644 =2D-- a/lib/sys_socket.in.h +++ b/lib/sys_socket.in.h @@ -462,15 +462,18 @@ _GL_WARN_ON_USE (getsockname, "getsockname is not alw= ays POSIX compliant - " # define getsockopt rpl_getsockopt # endif _GL_FUNCDECL_RPL (getsockopt, int, (int fd, int level, int optname, =2D void *optval, socklen_t *optlen) + void * restrict optval, + socklen_t * restrict optlen) _GL_ARG_NONNULL ((4, 5))); _GL_CXXALIAS_RPL (getsockopt, int, (int fd, int level, int optname, =2D void *optval, socklen_t *optlen)); + void * restrict optval, + socklen_t * restrict optlen)); # else /* Need to cast, because on Solaris 10 systems, the fifth parameter is void *optlen. */ _GL_CXXALIAS_SYS_CAST (getsockopt, int, (int fd, int level, int optname, =2D void *optval, socklen_t *optlen= )); + void * restrict optval, + socklen_t * restrict optlen)); # endif _GL_CXXALIASWARN (getsockopt); #elif @HAVE_WINSOCK2_H@ @@ -571,17 +574,17 @@ _GL_WARN_ON_USE (send, "send is not always POSIX comp= liant - " # define recvfrom rpl_recvfrom # endif _GL_FUNCDECL_RPL (recvfrom, ssize_t, =2D (int fd, void *buf, size_t len, int flags, + (int fd, void * restrict buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (recvfrom, ssize_t, =2D (int fd, void *buf, size_t len, int flags, + (int fd, void * restrict buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen)); # else /* Need to cast, because on Solaris 10 systems, the sixth parameter is void *fromlen. */ _GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t, =2D (int fd, void *buf, size_t len, int flags, + (int fd, void * restrict buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen)); # endif _GL_CXXALIASWARN (recvfrom); diff --git a/lib/system-quote.h b/lib/system-quote.h index d31d47f..2f50779 100644 =2D-- a/lib/system-quote.h +++ b/lib/system-quote.h @@ -77,7 +77,7 @@ extern size_t /* Copies the quoted string to p and returns the incremented p. There must be room for system_quote_length (string) + 1 bytes at p. */ extern char * =2D system_quote_copy (char *p, + system_quote_copy (char * restrict p, enum system_command_interpreter interpreter, const char *string); =20 diff --git a/lib/time.in.h b/lib/time.in.h index 7304668..0edf0b3 100644 =2D-- a/lib/time.in.h +++ b/lib/time.in.h @@ -286,13 +286,13 @@ _GL_CXXALIASWARN (ctime); # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strftime rpl_strftime # endif =2D_GL_FUNCDECL_RPL (strftime, size_t, (char *__buf, size_t __bufsize, +_GL_FUNCDECL_RPL (strftime, size_t, (char * restrict __buf, size_t __bufsi= ze, const char *__fmt, const struct tm *_= _tp) _GL_ARG_NONNULL ((1, 3, 4))); =2D_GL_CXXALIAS_RPL (strftime, size_t, (char *__buf, size_t __bufsize, +_GL_CXXALIAS_RPL (strftime, size_t, (char * restrict __buf, size_t __bufsi= ze, const char *__fmt, const struct tm *_= _tp)); # else =2D_GL_CXXALIAS_SYS (strftime, size_t, (char *__buf, size_t __bufsize, +_GL_CXXALIAS_SYS (strftime, size_t, (char * restrict __buf, size_t __bufsi= ze, const char *__fmt, const struct tm *_= _tp)); # endif # if __GLIBC__ >=3D 2 diff --git a/lib/unicase.in.h b/lib/unicase.in.h index 45c5f91..b622ac4 100644 =2D-- a/lib/unicase.in.h +++ b/lib/unicase.in.h @@ -96,15 +96,15 @@ extern const char * extern uint8_t * u8_toupper (const uint8_t *s, size_t n, const char *iso639_language, uninorm_t nf, =2D uint8_t *resultbuf, size_t *lengthp); + uint8_t * restrict resultbuf, size_t *lengthp); extern uint16_t * u16_toupper (const uint16_t *s, size_t n, const char *iso639_langua= ge, uninorm_t nf, =2D uint16_t *resultbuf, size_t *lengthp); + uint16_t * restrict resultbuf, size_t *lengthp); extern uint32_t * u32_toupper (const uint32_t *s, size_t n, const char *iso639_langua= ge, uninorm_t nf, =2D uint32_t *resultbuf, size_t *lengthp); + uint32_t * restrict resultbuf, size_t *lengthp); =20 /* Return the lowercase mapping of a string. The nf argument identifies the normalization form to apply after the @@ -112,15 +112,15 @@ extern uint32_t * extern uint8_t * u8_tolower (const uint8_t *s, size_t n, const char *iso639_language, uninorm_t nf, =2D uint8_t *resultbuf, size_t *lengthp); + uint8_t * restrict resultbuf, size_t *lengthp); extern uint16_t * u16_tolower (const uint16_t *s, size_t n, const char *iso639_langua= ge, uninorm_t nf, =2D uint16_t *resultbuf, size_t *lengthp); + uint16_t * restrict resultbuf, size_t *lengthp); extern uint32_t * u32_tolower (const uint32_t *s, size_t n, const char *iso639_langua= ge, uninorm_t nf, =2D uint32_t *resultbuf, size_t *lengthp); + uint32_t * restrict resultbuf, size_t *lengthp); =20 /* Return the titlecase mapping of a string. The nf argument identifies the normalization form to apply after the @@ -128,15 +128,15 @@ extern uint32_t * extern uint8_t * u8_totitle (const uint8_t *s, size_t n, const char *iso639_language, uninorm_t nf, =2D uint8_t *resultbuf, size_t *lengthp); + uint8_t * restrict resultbuf, size_t *lengthp); extern uint16_t * u16_totitle (const uint16_t *s, size_t n, const char *iso639_langua= ge, uninorm_t nf, =2D uint16_t *resultbuf, size_t *lengthp); + uint16_t * restrict resultbuf, size_t *lengthp); extern uint32_t * u32_totitle (const uint32_t *s, size_t n, const char *iso639_langua= ge, uninorm_t nf, =2D uint32_t *resultbuf, size_t *lengthp); + uint32_t * restrict resultbuf, size_t *lengthp); =20 /* The case-mapping context given by a prefix string. */ typedef struct casing_prefix_context @@ -204,21 +204,21 @@ extern uint8_t * casing_suffix_context_t suffix_context, const char *iso639_language, uninorm_t nf, =2D uint8_t *resultbuf, size_t *lengthp); + uint8_t * restrict resultbuf, size_t *lengthp); extern uint16_t * u16_ct_toupper (const uint16_t *s, size_t n, casing_prefix_context_t prefix_context, casing_suffix_context_t suffix_context, const char *iso639_language, uninorm_t nf, =2D uint16_t *resultbuf, size_t *lengthp); + uint16_t * restrict resultbuf, size_t *lengthp); extern uint32_t * u32_ct_toupper (const uint32_t *s, size_t n, casing_prefix_context_t prefix_context, casing_suffix_context_t suffix_context, const char *iso639_language, uninorm_t nf, =2D uint32_t *resultbuf, size_t *lengthp); + uint32_t * restrict resultbuf, size_t *lengthp); =20 /* Return the lowercase mapping of a string that is surrounded by a prefix and a suffix. */ @@ -228,21 +228,21 @@ extern uint8_t * casing_suffix_context_t suffix_context, const char *iso639_language, uninorm_t nf, =2D uint8_t *resultbuf, size_t *lengthp); + uint8_t * restrict resultbuf, size_t *lengthp); extern uint16_t * u16_ct_tolower (const uint16_t *s, size_t n, casing_prefix_context_t prefix_context, casing_suffix_context_t suffix_context, const char *iso639_language, uninorm_t nf, =2D uint16_t *resultbuf, size_t *lengthp); + uint16_t * restrict resultbuf, size_t *lengthp); extern uint32_t * u32_ct_tolower (const uint32_t *s, size_t n, casing_prefix_context_t prefix_context, casing_suffix_context_t suffix_context, const char *iso639_language, uninorm_t nf, =2D uint32_t *resultbuf, size_t *lengthp); + uint32_t * restrict resultbuf, size_t *lengthp); =20 /* Return the titlecase mapping of a string that is surrounded by a prefix and a suffix. */ @@ -252,21 +252,21 @@ extern uint8_t * casing_suffix_context_t suffix_context, const char *iso639_language, uninorm_t nf, =2D uint8_t *resultbuf, size_t *lengthp); + uint8_t * restrict resultbuf, size_t *lengthp); extern uint16_t * u16_ct_totitle (const uint16_t *s, size_t n, casing_prefix_context_t prefix_context, casing_suffix_context_t suffix_context, const char *iso639_language, uninorm_t nf, =2D uint16_t *resultbuf, size_t *lengthp); + uint16_t * restrict resultbuf, size_t *lengthp); extern uint32_t * u32_ct_totitle (const uint32_t *s, size_t n, casing_prefix_context_t prefix_context, casing_suffix_context_t suffix_context, const char *iso639_language, uninorm_t nf, =2D uint32_t *resultbuf, size_t *lengthp); + uint32_t * restrict resultbuf, size_t *lengthp); =20 /* Return the case folded string. Comparing uN_casefold (S1) and uN_casefold (S2) with uN_cmp2() is equiv= alent @@ -276,15 +276,15 @@ extern uint32_t * extern uint8_t * u8_casefold (const uint8_t *s, size_t n, const char *iso639_languag= e, uninorm_t nf, =2D uint8_t *resultbuf, size_t *lengthp); + uint8_t * restrict resultbuf, size_t *lengthp); extern uint16_t * u16_casefold (const uint16_t *s, size_t n, const char *iso639_langu= age, uninorm_t nf, =2D uint16_t *resultbuf, size_t *lengthp); + uint16_t * restrict resultbuf, size_t *lengthp); extern uint32_t * u32_casefold (const uint32_t *s, size_t n, const char *iso639_langu= age, uninorm_t nf, =2D uint32_t *resultbuf, size_t *lengthp); + uint32_t * restrict resultbuf, size_t *lengthp); /* Likewise, for a string that is surrounded by a prefix and a suffix. */ extern uint8_t * u8_ct_casefold (const uint8_t *s, size_t n, @@ -292,21 +292,21 @@ extern uint8_t * casing_suffix_context_t suffix_context, const char *iso639_language, uninorm_t nf, =2D uint8_t *resultbuf, size_t *lengthp); + uint8_t * restrict resultbuf, size_t *lengthp); extern uint16_t * u16_ct_casefold (const uint16_t *s, size_t n, casing_prefix_context_t prefix_context, casing_suffix_context_t suffix_context, const char *iso639_language, uninorm_t nf, =2D uint16_t *resultbuf, size_t *lengthp); + uint16_t * restrict resultbuf, size_t *lengthp); extern uint32_t * u32_ct_casefold (const uint32_t *s, size_t n, casing_prefix_context_t prefix_context, casing_suffix_context_t suffix_context, const char *iso639_language, uninorm_t nf, =2D uint32_t *resultbuf, size_t *lengthp); + uint32_t * restrict resultbuf, size_t *lengthp); =20 /* Compare S1 and S2, ignoring differences in case and normalization. The nf argument identifies the normalization form to apply after the @@ -336,16 +336,16 @@ extern int NF must be either UNINORM_NFC, UNINORM_NFKC, or NULL for no normalizati= on. */ extern char * u8_casexfrm (const uint8_t *s, size_t n, const char *iso639_languag= e, =2D uninorm_t nf, char *resultbuf, size_t *lengthp); + uninorm_t nf, char * restrict resultbuf, size_t *lengt= hp); extern char * u16_casexfrm (const uint16_t *s, size_t n, const char *iso639_langu= age, =2D uninorm_t nf, char *resultbuf, size_t *lengthp); + uninorm_t nf, char * restrict resultbuf, size_t *leng= thp); extern char * u32_casexfrm (const uint32_t *s, size_t n, const char *iso639_langu= age, =2D uninorm_t nf, char *resultbuf, size_t *lengthp); + uninorm_t nf, char * restrict resultbuf, size_t *leng= thp); extern char * ulc_casexfrm (const char *s, size_t n, const char *iso639_language, =2D uninorm_t nf, char *resultbuf, size_t *lengthp); + uninorm_t nf, char * restrict resultbuf, size_t *leng= thp); =20 /* Compare S1 and S2, ignoring differences in case and normalization, usin= g the collation rules of the current locale. diff --git a/lib/uniconv.in.h b/lib/uniconv.in.h index 53dc3fc..4e7f872 100644 =2D-- a/lib/uniconv.in.h +++ b/lib/uniconv.in.h @@ -98,19 +98,19 @@ extern char * enum iconv_ilseq_handler handler, const uint8_t *src, size_t srclen, size_t *offsets, =2D char *resultbuf, size_t *lengthp); + char * restrict resultbuf, size_t *lengthp); extern char * u16_conv_to_encoding (const char *tocode, enum iconv_ilseq_handler handler, const uint16_t *src, size_t srclen, size_t *offsets, =2D char *resultbuf, size_t *lengthp); + char * restrict resultbuf, size_t *lengthp); extern char * u32_conv_to_encoding (const char *tocode, enum iconv_ilseq_handler handler, const uint32_t *src, size_t srclen, size_t *offsets, =2D char *resultbuf, size_t *lengthp); + char * restrict resultbuf, size_t *lengthp); =20 /* Converts a NUL terminated string from a given encoding. The result is malloc allocated, or NULL (with errno set) in case of err= or. diff --git a/lib/unilbrk.in.h b/lib/unilbrk.in.h index 408b905..83ba59c 100644 =2D-- a/lib/unilbrk.in.h +++ b/lib/unilbrk.in.h @@ -58,16 +58,16 @@ enum */ extern void u8_possible_linebreaks (const uint8_t *s, size_t n, =2D const char *encoding, char *p); + const char *encoding, char * restrict p); extern void u16_possible_linebreaks (const uint16_t *s, size_t n, =2D const char *encoding, char *p); + const char *encoding, char * restrict p); extern void u32_possible_linebreaks (const uint32_t *s, size_t n, =2D const char *encoding, char *p); + const char *encoding, char * restrict p); extern void ulc_possible_linebreaks (const char *s, size_t n, =2D const char *encoding, char *p); + const char *encoding, char * restrict p); =20 /* Choose the best line breaks, assuming the uc_width function. The string is s[0..n-1]. The maximum number of columns per line is giv= en @@ -84,22 +84,22 @@ extern int u8_width_linebreaks (const uint8_t *s, size_t n, int width, int start_column, int at_end_columns, const char *o, const char *encoding, =2D char *p); + char * restrict p); extern int u16_width_linebreaks (const uint16_t *s, size_t n, int width, int start_column, int at_end_columns, const char *o, const char *encoding, =2D char *p); + char * restrict p); extern int u32_width_linebreaks (const uint32_t *s, size_t n, int width, int start_column, int at_end_columns, const char *o, const char *encoding, =2D char *p); + char * restrict p); extern int ulc_width_linebreaks (const char *s, size_t n, int width, int start_column, int at_end_columns, const char *o, const char *encoding, =2D char *p); + char * restrict p); =20 =20 #ifdef __cplusplus diff --git a/lib/uninorm.in.h b/lib/uninorm.in.h index 9ebdb6b..e4cb7d9 100644 =2D-- a/lib/uninorm.in.h +++ b/lib/uninorm.in.h @@ -143,13 +143,13 @@ extern uninorm_t /* Return the specified normalization form of a string. */ extern uint8_t * u8_normalize (uninorm_t nf, const uint8_t *s, size_t n, =2D uint8_t *resultbuf, size_t *lengthp); + uint8_t * restrict resultbuf, size_t *lengthp); extern uint16_t * u16_normalize (uninorm_t nf, const uint16_t *s, size_t n, =2D uint16_t *resultbuf, size_t *lengthp); + uint16_t * restrict resultbuf, size_t *lengthp); extern uint32_t * u32_normalize (uninorm_t nf, const uint32_t *s, size_t n, =2D uint32_t *resultbuf, size_t *lengthp); + uint32_t * restrict resultbuf, size_t *lengthp); =20 =20 /* Compare S1 and S2, ignoring differences in normalization. diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 6db7ff2..297f6dd 100644 =2D-- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -1370,18 +1370,18 @@ _GL_CXXALIASWARN (read); # define readlink rpl_readlink # endif _GL_FUNCDECL_RPL (readlink, ssize_t, =2D (const char *file, char *buf, size_t bufsize) + (const char *file, char * restrict buf, size_t bufsize) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (readlink, ssize_t, =2D (const char *file, char *buf, size_t bufsize)); + (const char *file, char * restrict buf, size_t bufsize)); # else # if !@HAVE_READLINK@ _GL_FUNCDECL_SYS (readlink, ssize_t, =2D (const char *file, char *buf, size_t bufsize) + (const char *file, char * restrict buf, size_t bufsize) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (readlink, ssize_t, =2D (const char *file, char *buf, size_t bufsize)); + (const char *file, char * restrict buf, size_t bufsize)); # endif _GL_CXXALIASWARN (readlink); #elif defined GNULIB_POSIXCHECK @@ -1399,18 +1399,18 @@ _GL_WARN_ON_USE (readlink, "readlink is unportable = =2D " # define readlinkat rpl_readlinkat # endif _GL_FUNCDECL_RPL (readlinkat, ssize_t, =2D (int fd, char const *file, char *buf, size_t len) + (int fd, char const *file, char * restrict buf, size_t l= en) _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (readlinkat, ssize_t, =2D (int fd, char const *file, char *buf, size_t len)); + (int fd, char const *file, char * restrict buf, size_t l= en)); # else # if !@HAVE_READLINKAT@ _GL_FUNCDECL_SYS (readlinkat, ssize_t, =2D (int fd, char const *file, char *buf, size_t len) + (int fd, char const *file, char * restrict buf, size_t l= en) _GL_ARG_NONNULL ((2, 3))); # endif _GL_CXXALIAS_SYS (readlinkat, ssize_t, =2D (int fd, char const *file, char *buf, size_t len)); + (int fd, char const *file, char * restrict buf, size_t l= en)); # endif _GL_CXXALIASWARN (readlinkat); #elif defined GNULIB_POSIXCHECK diff --git a/lib/unistdio.in.h b/lib/unistdio.in.h index e6091ec..615d21b 100644 =2D-- a/lib/unistdio.in.h +++ b/lib/unistdio.in.h @@ -61,28 +61,28 @@ extern "C" { =20 /* ASCII format string, result in locale dependent encoded 'char *'. */ extern int =2D ulc_sprintf (char *buf, + ulc_sprintf (char * restrict buf, const char *format, ...); extern int =2D ulc_snprintf (char *buf, size_t size, + ulc_snprintf (char * restrict buf, size_t size, const char *format, ...); extern int ulc_asprintf (char **resultp, const char *format, ...); extern char * =2D ulc_asnprintf (char *resultbuf, size_t *lengthp, + ulc_asnprintf (char * restrict resultbuf, size_t *lengthp, const char *format, ...); extern int =2D ulc_vsprintf (char *buf, + ulc_vsprintf (char * restrict buf, const char *format, va_list ap); extern int =2D ulc_vsnprintf (char *buf, size_t size, + ulc_vsnprintf (char * restrict buf, size_t size, const char *format, va_list ap); extern int ulc_vasprintf (char **resultp, const char *format, va_list ap); extern char * =2D ulc_vasnprintf (char *resultbuf, size_t *lengthp, + ulc_vasnprintf (char * restrict resultbuf, size_t *lengthp, const char *format, va_list ap); =20 /* ASCII format string, result in UTF-8 format. */ @@ -113,28 +113,28 @@ extern uint8_t * =20 /* UTF-8 format string, result in UTF-8 format. */ extern int =2D u8_u8_sprintf (uint8_t *buf, + u8_u8_sprintf (uint8_t * restrict buf, const uint8_t *format, ...); extern int =2D u8_u8_snprintf (uint8_t *buf, size_t size, + u8_u8_snprintf (uint8_t * restrict buf, size_t size, const uint8_t *format, ...); extern int u8_u8_asprintf (uint8_t **resultp, const uint8_t *format, ...); extern uint8_t * =2D u8_u8_asnprintf (uint8_t *resultbuf, size_t *lengthp, + u8_u8_asnprintf (uint8_t * restrict resultbuf, size_t *lengthp, const uint8_t *format, ...); extern int =2D u8_u8_vsprintf (uint8_t *buf, + u8_u8_vsprintf (uint8_t * restrict buf, const uint8_t *format, va_list ap); extern int =2D u8_u8_vsnprintf (uint8_t *buf, size_t size, + u8_u8_vsnprintf (uint8_t * restrict buf, size_t size, const uint8_t *format, va_list ap); extern int u8_u8_vasprintf (uint8_t **resultp, const uint8_t *format, va_list ap); extern uint8_t * =2D u8_u8_vasnprintf (uint8_t *resultbuf, size_t *lengthp, + u8_u8_vasnprintf (uint8_t * restrict resultbuf, size_t *lengthp, const uint8_t *format, va_list ap); =20 /* ASCII format string, result in UTF-16 format. */ @@ -165,28 +165,28 @@ extern uint16_t * =20 /* UTF-16 format string, result in UTF-16 format. */ extern int =2D u16_u16_sprintf (uint16_t *buf, + u16_u16_sprintf (uint16_t * restrict buf, const uint16_t *format, ...); extern int =2D u16_u16_snprintf (uint16_t *buf, size_t size, + u16_u16_snprintf (uint16_t * restrict buf, size_t size, const uint16_t *format, ...); extern int u16_u16_asprintf (uint16_t **resultp, const uint16_t *format, ...); extern uint16_t * =2D u16_u16_asnprintf (uint16_t *resultbuf, size_t *lengthp, + u16_u16_asnprintf (uint16_t * restrict resultbuf, size_t *lengthp, const uint16_t *format, ...); extern int =2D u16_u16_vsprintf (uint16_t *buf, + u16_u16_vsprintf (uint16_t * restrict buf, const uint16_t *format, va_list ap); extern int =2D u16_u16_vsnprintf (uint16_t *buf, size_t size, + u16_u16_vsnprintf (uint16_t * restrict buf, size_t size, const uint16_t *format, va_list ap); extern int u16_u16_vasprintf (uint16_t **resultp, const uint16_t *format, va_list ap); extern uint16_t * =2D u16_u16_vasnprintf (uint16_t *resultbuf, size_t *lengthp, + u16_u16_vasnprintf (uint16_t * restrict resultbuf, size_t *lengthp, const uint16_t *format, va_list ap); =20 /* ASCII format string, result in UTF-32 format. */ @@ -217,28 +217,28 @@ extern uint32_t * =20 /* UTF-32 format string, result in UTF-32 format. */ extern int =2D u32_u32_sprintf (uint32_t *buf, + u32_u32_sprintf (uint32_t * restrict buf, const uint32_t *format, ...); extern int =2D u32_u32_snprintf (uint32_t *buf, size_t size, + u32_u32_snprintf (uint32_t * restrict buf, size_t size, const uint32_t *format, ...); extern int u32_u32_asprintf (uint32_t **resultp, const uint32_t *format, ...); extern uint32_t * =2D u32_u32_asnprintf (uint32_t *resultbuf, size_t *lengthp, + u32_u32_asnprintf (uint32_t * restrict resultbuf, size_t *lengthp, const uint32_t *format, ...); extern int =2D u32_u32_vsprintf (uint32_t *buf, + u32_u32_vsprintf (uint32_t * restrict buf, const uint32_t *format, va_list ap); extern int =2D u32_u32_vsnprintf (uint32_t *buf, size_t size, + u32_u32_vsnprintf (uint32_t * restrict buf, size_t size, const uint32_t *format, va_list ap); extern int u32_u32_vasprintf (uint32_t **resultp, const uint32_t *format, va_list ap); extern uint32_t * =2D u32_u32_vasnprintf (uint32_t *resultbuf, size_t *lengthp, + u32_u32_vasnprintf (uint32_t * restrict resultbuf, size_t *lengthp, const uint32_t *format, va_list ap); =20 /* ASCII format string, output to FILE in locale dependent encoding. */ diff --git a/lib/unistr.in.h b/lib/unistr.in.h index bc0d237..c580774 100644 =2D-- a/lib/unistr.in.h +++ b/lib/unistr.in.h @@ -373,11 +373,11 @@ u32_uctomb (uint32_t *s, ucs4_t uc, int n) /* Copy N units from SRC to DEST. */ /* Similar to memcpy(). */ extern uint8_t * =2D u8_cpy (uint8_t *dest, const uint8_t *src, size_t n); + u8_cpy (uint8_t * restrict dest, const uint8_t *src, size_t n); extern uint16_t * =2D u16_cpy (uint16_t *dest, const uint16_t *src, size_t n); + u16_cpy (uint16_t * restrict dest, const uint16_t *src, size_t n); extern uint32_t * =2D u32_cpy (uint32_t *dest, const uint32_t *src, size_t n); + u32_cpy (uint32_t * restrict dest, const uint32_t *src, size_t n); =20 /* Copy N units from SRC to DEST, guaranteeing correct behavior for overlapping memory areas. */ @@ -528,57 +528,57 @@ extern size_t /* Copy SRC to DEST. */ /* Similar to strcpy(), wcscpy(). */ extern uint8_t * =2D u8_strcpy (uint8_t *dest, const uint8_t *src); + u8_strcpy (uint8_t * restrict dest, const uint8_t *src); extern uint16_t * =2D u16_strcpy (uint16_t *dest, const uint16_t *src); + u16_strcpy (uint16_t * restrict dest, const uint16_t *src); extern uint32_t * =2D u32_strcpy (uint32_t *dest, const uint32_t *src); + u32_strcpy (uint32_t * restrict dest, const uint32_t *src); =20 /* Copy SRC to DEST, returning the address of the terminating NUL in DEST.= */ /* Similar to stpcpy(). */ extern uint8_t * =2D u8_stpcpy (uint8_t *dest, const uint8_t *src); + u8_stpcpy (uint8_t * restrict dest, const uint8_t *src); extern uint16_t * =2D u16_stpcpy (uint16_t *dest, const uint16_t *src); + u16_stpcpy (uint16_t * restrict dest, const uint16_t *src); extern uint32_t * =2D u32_stpcpy (uint32_t *dest, const uint32_t *src); + u32_stpcpy (uint32_t * restrict dest, const uint32_t *src); =20 /* Copy no more than N units of SRC to DEST. */ /* Similar to strncpy(), wcsncpy(). */ extern uint8_t * =2D u8_strncpy (uint8_t *dest, const uint8_t *src, size_t n); + u8_strncpy (uint8_t * restrict dest, const uint8_t *src, size_t n); extern uint16_t * =2D u16_strncpy (uint16_t *dest, const uint16_t *src, size_t n); + u16_strncpy (uint16_t * restrict dest, const uint16_t *src, size_t = n); extern uint32_t * =2D u32_strncpy (uint32_t *dest, const uint32_t *src, size_t n); + u32_strncpy (uint32_t * restrict dest, const uint32_t *src, size_t = n); =20 /* Copy no more than N units of SRC to DEST. Return a pointer past the la= st non-NUL unit written into DEST. */ /* Similar to stpncpy(). */ extern uint8_t * =2D u8_stpncpy (uint8_t *dest, const uint8_t *src, size_t n); + u8_stpncpy (uint8_t * restrict dest, const uint8_t *src, size_t n); extern uint16_t * =2D u16_stpncpy (uint16_t *dest, const uint16_t *src, size_t n); + u16_stpncpy (uint16_t * restrict dest, const uint16_t *src, size_t = n); extern uint32_t * =2D u32_stpncpy (uint32_t *dest, const uint32_t *src, size_t n); + u32_stpncpy (uint32_t * restrict dest, const uint32_t *src, size_t = n); =20 /* Append SRC onto DEST. */ /* Similar to strcat(), wcscat(). */ extern uint8_t * =2D u8_strcat (uint8_t *dest, const uint8_t *src); + u8_strcat (uint8_t * restrict dest, const uint8_t *src); extern uint16_t * =2D u16_strcat (uint16_t *dest, const uint16_t *src); + u16_strcat (uint16_t * restrict dest, const uint16_t *src); extern uint32_t * =2D u32_strcat (uint32_t *dest, const uint32_t *src); + u32_strcat (uint32_t * restrict dest, const uint32_t *src); =20 /* Append no more than N units of SRC onto DEST. */ /* Similar to strncat(), wcsncat(). */ extern uint8_t * =2D u8_strncat (uint8_t *dest, const uint8_t *src, size_t n); + u8_strncat (uint8_t * restrict dest, const uint8_t *src, size_t n); extern uint16_t * =2D u16_strncat (uint16_t *dest, const uint16_t *src, size_t n); + u16_strncat (uint16_t * restrict dest, const uint16_t *src, size_t = n); extern uint32_t * =2D u32_strncat (uint32_t *dest, const uint32_t *src, size_t n); + u32_strncat (uint32_t * restrict dest, const uint32_t *src, size_t = n); =20 /* Compare S1 and S2. */ /* Similar to strcmp(), wcscmp(). */ @@ -732,11 +732,14 @@ extern bool This interface is actually more similar to wcstok than to strtok. */ /* Similar to strtok_r(), wcstok(). */ extern uint8_t * =2D u8_strtok (uint8_t *str, const uint8_t *delim, uint8_t **ptr); + u8_strtok (uint8_t * restrict str, const uint8_t *delim, + uint8_t **ptr); extern uint16_t * =2D u16_strtok (uint16_t *str, const uint16_t *delim, uint16_t **ptr); + u16_strtok (uint16_t * restrict str, const uint16_t *delim, + uint16_t **ptr); extern uint32_t * =2D u32_strtok (uint32_t *str, const uint32_t *delim, uint32_t **ptr); + u32_strtok (uint32_t * restrict str, const uint32_t *delim, + uint32_t **ptr); =20 =20 #ifdef __cplusplus diff --git a/lib/uniwbrk.in.h b/lib/uniwbrk.in.h index 1407644..940ae7d 100644 =2D-- a/lib/uniwbrk.in.h +++ b/lib/uniwbrk.in.h @@ -81,7 +81,7 @@ extern void extern void u32_wordbreaks (const uint32_t *s, size_t n, char *p); extern void =2D ulc_wordbreaks (const char *s, size_t n, char *p); + ulc_wordbreaks (const char *s, size_t n, char * restrict p); =20 /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= */ =20 diff --git a/lib/vasnprintf.h b/lib/vasnprintf.h index 345e6a8..58b9912 100644 =2D-- a/lib/vasnprintf.h +++ b/lib/vasnprintf.h @@ -67,9 +67,11 @@ extern "C" { # define asnprintf rpl_asnprintf # define vasnprintf rpl_vasnprintf #endif =2Dextern char * asnprintf (char *resultbuf, size_t *lengthp, const char *f= ormat, ...) +extern char * asnprintf (char * restrict resultbuf, size_t *lengthp, + const char *format, ...) _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 4)); =2Dextern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *= format, va_list args) +extern char * vasnprintf (char * restrict resultbuf, size_t *lengthp, + const char *format, va_list args) _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 0)); =20 #ifdef __cplusplus diff --git a/lib/wchar.in.h b/lib/wchar.in.h index 74cd670..16f9d6c 100644 =2D-- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -547,10 +547,10 @@ _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - " #if @GNULIB_WMEMCPY@ # if !@HAVE_WMEMCPY@ _GL_FUNCDECL_SYS (wmemcpy, wchar_t *, =2D (wchar_t *dest, const wchar_t *src, size_t n)); + (wchar_t * restrict dest, const wchar_t *src, size_t n)); # endif _GL_CXXALIAS_SYS (wmemcpy, wchar_t *, =2D (wchar_t *dest, const wchar_t *src, size_t n)); + (wchar_t * restrict dest, const wchar_t *src, size_t n)); # if __GLIBC__ >=3D 2 _GL_CXXALIASWARN (wmemcpy); # endif @@ -640,9 +640,11 @@ _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - " /* Copy SRC to DEST. */ #if @GNULIB_WCSCPY@ # if !@HAVE_WCSCPY@ =2D_GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)= ); +_GL_FUNCDECL_SYS (wcscpy, wchar_t *, + (wchar_t * restrict dest, const wchar_t *src)); # endif =2D_GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src)= ); +_GL_CXXALIAS_SYS (wcscpy, wchar_t *, + (wchar_t * restrict dest, const wchar_t *src)); # if __GLIBC__ >=3D 2 _GL_CXXALIASWARN (wcscpy); # endif @@ -658,9 +660,11 @@ _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - " /* Copy SRC to DEST, returning the address of the terminating L'\0' in DES= T. */ #if @GNULIB_WCPCPY@ # if !@HAVE_WCPCPY@ =2D_GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src)= ); +_GL_FUNCDECL_SYS (wcpcpy, wchar_t *, + (wchar_t * restrict dest, const wchar_t *src)); # endif =2D_GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src)= ); +_GL_CXXALIAS_SYS (wcpcpy, wchar_t *, + (wchar_t * restrict dest, const wchar_t *src)); _GL_CXXALIASWARN (wcpcpy); #elif defined GNULIB_POSIXCHECK # undef wcpcpy @@ -675,10 +679,10 @@ _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - " #if @GNULIB_WCSNCPY@ # if !@HAVE_WCSNCPY@ _GL_FUNCDECL_SYS (wcsncpy, wchar_t *, =2D (wchar_t *dest, const wchar_t *src, size_t n)); + (wchar_t * restrict dest, const wchar_t *src, size_t n)); # endif _GL_CXXALIAS_SYS (wcsncpy, wchar_t *, =2D (wchar_t *dest, const wchar_t *src, size_t n)); + (wchar_t * restrict dest, const wchar_t *src, size_t n)); # if __GLIBC__ >=3D 2 _GL_CXXALIASWARN (wcsncpy); # endif @@ -696,10 +700,10 @@ _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - " #if @GNULIB_WCPNCPY@ # if !@HAVE_WCPNCPY@ _GL_FUNCDECL_SYS (wcpncpy, wchar_t *, =2D (wchar_t *dest, const wchar_t *src, size_t n)); + (wchar_t * restrict dest, const wchar_t *src, size_t n)); # endif _GL_CXXALIAS_SYS (wcpncpy, wchar_t *, =2D (wchar_t *dest, const wchar_t *src, size_t n)); + (wchar_t * restrict dest, const wchar_t *src, size_t n)); _GL_CXXALIASWARN (wcpncpy); #elif defined GNULIB_POSIXCHECK # undef wcpncpy @@ -713,9 +717,11 @@ _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - " /* Append SRC onto DEST. */ #if @GNULIB_WCSCAT@ # if !@HAVE_WCSCAT@ =2D_GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)= ); +_GL_FUNCDECL_SYS (wcscat, wchar_t *, + (wchar_t * restrict dest, const wchar_t *src)); # endif =2D_GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src)= ); +_GL_CXXALIAS_SYS (wcscat, wchar_t *, + (wchar_t * restrict dest, const wchar_t *src)); # if __GLIBC__ >=3D 2 _GL_CXXALIASWARN (wcscat); # endif @@ -732,10 +738,10 @@ _GL_WARN_ON_USE (wcscat, "wcscat is unportable - " #if @GNULIB_WCSNCAT@ # if !@HAVE_WCSNCAT@ _GL_FUNCDECL_SYS (wcsncat, wchar_t *, =2D (wchar_t *dest, const wchar_t *src, size_t n)); + (wchar_t * restrict dest, const wchar_t *src, size_t n)); # endif _GL_CXXALIAS_SYS (wcsncat, wchar_t *, =2D (wchar_t *dest, const wchar_t *src, size_t n)); + (wchar_t * restrict dest, const wchar_t *src, size_t n)); # if __GLIBC__ >=3D 2 _GL_CXXALIASWARN (wcsncat); # endif @@ -848,9 +854,11 @@ _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - " original strings. */ #if @GNULIB_WCSXFRM@ # if !@HAVE_WCSXFRM@ =2D_GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size= _t n)); +_GL_FUNCDECL_SYS (wcsxfrm, size_t, + (wchar_t * restrict s1, const wchar_t *s2, size_t n)); # endif =2D_GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size= _t n)); +_GL_CXXALIAS_SYS (wcsxfrm, size_t, + (wchar_t * restrict s1, const wchar_t *s2, size_t n)); # if __GLIBC__ >=3D 2 _GL_CXXALIASWARN (wcsxfrm); # endif @@ -1053,16 +1061,20 @@ _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - " # define wcstok rpl_wcstok # endif _GL_FUNCDECL_RPL (wcstok, wchar_t *, =2D (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); + (wchar_t * restrict wcs, const wchar_t *delim, + wchar_t **ptr)); _GL_CXXALIAS_RPL (wcstok, wchar_t *, =2D (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); + (wchar_t * restrict wcs, const wchar_t *delim, + wchar_t **ptr)); # else # if !@HAVE_WCSTOK@ _GL_FUNCDECL_SYS (wcstok, wchar_t *, =2D (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); + (wchar_t * restrict wcs, const wchar_t *delim, + wchar_t **ptr)); # endif _GL_CXXALIAS_SYS (wcstok, wchar_t *, =2D (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); + (wchar_t * restrict wcs, const wchar_t *delim, + wchar_t **ptr)); # endif # if __GLIBC__ >=3D 2 _GL_CXXALIASWARN (wcstok); @@ -1114,18 +1126,18 @@ _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable = =2D " # undef wcsftime # define wcsftime rpl_wcsftime # endif =2D_GL_FUNCDECL_RPL (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, +_GL_FUNCDECL_RPL (wcsftime, size_t, (wchar_t * restrict __buf, size_t __bu= fsize, const wchar_t *__fmt, const struct tm= *__tp) _GL_ARG_NONNULL ((1, 3, 4))); =2D_GL_CXXALIAS_RPL (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, +_GL_CXXALIAS_RPL (wcsftime, size_t, (wchar_t * restrict __buf, size_t __bu= fsize, const wchar_t *__fmt, const struct tm= *__tp)); # else # if !@HAVE_WCSFTIME@ =2D_GL_FUNCDECL_SYS (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, +_GL_FUNCDECL_SYS (wcsftime, size_t, (wchar_t * restrict __buf, size_t __bu= fsize, const wchar_t *__fmt, const struct tm= *__tp) _GL_ARG_NONNULL ((1, 3, 4))); # endif =2D_GL_CXXALIAS_SYS (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, +_GL_CXXALIAS_SYS (wcsftime, size_t, (wchar_t * restrict __buf, size_t __bu= fsize, const wchar_t *__fmt, const struct tm= *__tp)); # endif # if __GLIBC__ >=3D 2 diff --git a/lib/xmemcoll.h b/lib/xmemcoll.h index 4170b9b..ea546b8 100644 =2D-- a/lib/xmemcoll.h +++ b/lib/xmemcoll.h @@ -1,3 +1,3 @@ #include =2Dint xmemcoll (char *, size_t, char *, size_t); +int xmemcoll (char * restrict, size_t, char * restrict, size_t); int xmemcoll0 (char const *, size_t, char const *, size_t);