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=-3.0 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,LONGWORDS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=no 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 C39D11F619 for ; Sat, 22 Feb 2020 22:52:26 +0000 (UTC) Received: from localhost ([::1]:47676 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5ddJ-0006wU-US for normalperson@yhbt.net; Sat, 22 Feb 2020 17:52:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52033) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5dd4-0006wA-J7 for bug-gnulib@gnu.org; Sat, 22 Feb 2020 17:52:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j5dcx-0002Av-9F for bug-gnulib@gnu.org; Sat, 22 Feb 2020 17:52:10 -0500 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::2]:24881) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j5dcw-0002Aa-9M for bug-gnulib@gnu.org; Sat, 22 Feb 2020 17:52:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1582411920; 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=fs7iKll3LqTQCXZwCsndQ8VeifAifUAf3pv94Fkdhqc=; b=n8SN5SZlhk3cWRKgPacJ4uwdFgsbSGez1RUyUTRCzV2X1keITz/CSXZAtSswDpNACF qvfS0HHUF4Go6hNe4Q7vkbdsZdGFoGVGs+qUpxkCqDzS27i3OnCaXmh0vBt9yFPfay85 7pdgjKVZ1TGfwUTDqUzMCvjWVs6PgKuQiyKZxqrWMVI7RLDNBQbHI4Tr9fKnI6bckC48 04WsN5EswdSBYkbMkkfYxD7TfzmlFItxtucElHzHsZ9JKwxbOXaEjbmK7usmq6BjiHX9 +iX5vyheKWKKOfCTfhoGKoxD90ynKcgto/u9wkvOFnAFsyOOGTNns+P6rjNv+YzHu1jG SZdA== 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 g00701w1MMplgpM (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); Sat, 22 Feb 2020 23:51:47 +0100 (CET) From: Bruno Haible To: bug-gnulib@gnu.org Subject: Re: restrict - summary Date: Sat, 22 Feb 2020 23:51:46 +0100 Message-ID: <5404770.1kdr2JyrPn@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-171-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <5207910.RxYcQDdI9g@omega> References: <20200209144434.GA19087@aun.utmark.mea> <1751343.mXlyrFEpWx@omega> <5207910.RxYcQDdI9g@omega> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:238:20a:202:5300::2 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" Here comes the first part: the 'restrict' in the POSIX function declarations. Note that the POSIX declarations of posix_spawn and posix_spawnp [1] are incorrect: They lack a 'restrict' for the file_actions argument. [1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn.html 2020-02-22 Bruno Haible Use 'restrict' in all POSIX function declarations. * lib/iconv.in.h (iconv): Use 'restrict'. * lib/inttypes.in.h (strtoimax, strtoumax): Likewise. * lib/monetary.in.h (strfmon_l): Likewise. * lib/pthread.in.h (pthread_create, pthread_mutex_init, pthread_mutexattr_gettype, pthread_mutexattr_getrobust, pthread_mutex_timedlock, pthread_rwlock_init, pthread_rwlock_timedrdlock, pthread_rwlock_timedwrlock, pthread_cond_init, pthread_cond_wait, pthread_cond_timedwait): Likewise. * lib/search.in.h (tdelete): Likewise. * lib/signal.in.h (pthread_sigmask, sigprocmask): Likewise. * lib/stdio.in.h (dprintf, fgets, fopen, fprintf, fputs, fread, freopen, fscanf, fwrite, getdelim, getline, printf, scanf, snprintf, sprintf, vdprintf, vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf): Likewise. * lib/stdlib.in.h (mbtowc, realpath, strtod, strtold, strtoll, strtoull): Likewise. * lib/string.in.h (strncat): Likewise. * lib/sys_socket.in.h (accept, getpeername, getsockname, getsockopt, recvfrom): Likewise. * lib/sys_stat.in.h (fstatat, lstat, stat): Likewise. * lib/time.in.h (strftime): Likewise. * lib/unistd.in.h (readlink, readlinkat): Likewise. * lib/wchar.in.h (mbrtowc, mbrlen, mbsrtowcs, mbsnrtowcs, wcrtomb, wcsrtombs, wcsnrtombs, wmemcpy, wcscpy, wcpcpy, wcsncpy, wcpncpy, wcscat, wcsncat, wcsxfrm, wcsstr, wcstok, wcsftime): Likewise. * m4/iconv_h.m4 (gl_ICONV_H): Require AC_C_RESTRICT. * m4/inttypes.m4 (gl_INTTYPES_INCOMPLETE): Likewise. * m4/monetary_h.m4 (gl_MONETARY_H): Likewise. * m4/search_h.m4 (gl_SEARCH_H): Likewise. * m4/signal_h.m4 (gl_SIGNAL_H): Likewise. * m4/stdio_h.m4 (gl_STDIO_H): Likewise. * m4/stdlib_h.m4 (gl_STDLIB_H): Likewise. * m4/sys_socket_h.m4 (gl_HEADER_SYS_SOCKET): Likewise. * m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Likewise. * m4/unistd_h.m4 (gl_UNISTD_H): Likewise. * m4/wchar_h.m4 (gl_WCHAR_H): Likewise. * m4/string_h.m4 (gl_HEADER_STRING_H_BODY): Make consistent with the other *_h.m4 files. * m4/time_h.m4 (gl_HEADER_TIME_H): Likewise. diff --git a/lib/iconv.in.h b/lib/iconv.in.h index 125fa37..904e8f6 100644 --- a/lib/iconv.in.h +++ b/lib/iconv.in.h @@ -80,19 +80,22 @@ _GL_WARN_ON_USE (iconv_open, "iconv_open is not working correctly everywhere - " # endif _GL_FUNCDECL_RPL (iconv, size_t, (iconv_t cd, - @ICONV_CONST@ char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft)); + @ICONV_CONST@ char **restrict inbuf, + size_t *restrict inbytesleft, + char **restrict outbuf, size_t *restrict outbytesleft)); _GL_CXXALIAS_RPL (iconv, size_t, (iconv_t cd, - @ICONV_CONST@ char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft)); + @ICONV_CONST@ char **restrict inbuf, + size_t *restrict inbytesleft, + char **restrict outbuf, size_t *restrict outbytesleft)); # else /* Need to cast, because on some versions of Solaris, ICONV_CONST does not have the right value for C++. */ _GL_CXXALIAS_SYS_CAST (iconv, size_t, (iconv_t cd, - @ICONV_CONST@ char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft)); + @ICONV_CONST@ char **restrict inbuf, + size_t *restrict inbytesleft, + char **restrict outbuf, size_t *restrict outbytesleft)); # endif _GL_CXXALIASWARN (iconv); # ifndef ICONV_CONST diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h index d6efc7e..9f04a6c 100644 --- a/lib/inttypes.in.h +++ b/lib/inttypes.in.h @@ -1093,15 +1093,19 @@ _GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - " # define strtoimax rpl_strtoimax # endif _GL_FUNCDECL_RPL (strtoimax, intmax_t, - (const char *, char **, int) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (strtoimax, intmax_t, (const char *, char **, int)); + (const char *restrict, char **restrict, int) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strtoimax, intmax_t, + (const char *restrict, char **restrict, int)); # else # if !@HAVE_DECL_STRTOIMAX@ # undef strtoimax _GL_FUNCDECL_SYS (strtoimax, intmax_t, - (const char *, char **, int) _GL_ARG_NONNULL ((1))); + (const char *restrict, char **restrict, int) + _GL_ARG_NONNULL ((1))); # endif -_GL_CXXALIAS_SYS (strtoimax, intmax_t, (const char *, char **, int)); +_GL_CXXALIAS_SYS (strtoimax, intmax_t, + (const char *restrict, char **restrict, int)); # endif _GL_CXXALIASWARN (strtoimax); #elif defined GNULIB_POSIXCHECK @@ -1119,15 +1123,19 @@ _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - " # define strtoumax rpl_strtoumax # endif _GL_FUNCDECL_RPL (strtoumax, uintmax_t, - (const char *, char **, int) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (strtoumax, uintmax_t, (const char *, char **, int)); + (const char *restrict, char **restrict, int) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strtoumax, uintmax_t, + (const char *restrict, char **restrict, int)); # else # if !@HAVE_DECL_STRTOUMAX@ # undef strtoumax _GL_FUNCDECL_SYS (strtoumax, uintmax_t, - (const char *, char **, int) _GL_ARG_NONNULL ((1))); + (const char *restrict, char **restrict, int) + _GL_ARG_NONNULL ((1))); # endif -_GL_CXXALIAS_SYS (strtoumax, uintmax_t, (const char *, char **, int)); +_GL_CXXALIAS_SYS (strtoumax, uintmax_t, + (const char *restrict, char **restrict, int)); # endif _GL_CXXALIASWARN (strtoumax); #elif defined GNULIB_POSIXCHECK diff --git a/lib/monetary.in.h b/lib/monetary.in.h index ab17917..456a153 100644 --- a/lib/monetary.in.h +++ b/lib/monetary.in.h @@ -79,16 +79,19 @@ extern "C" { # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strfmon_l rpl_strfmon_l # endif -_GL_FUNCDECL_RPL (strfmon_l, ssize_t, (char *s, size_t maxsize, locale_t locale, - const char *format, ...) - _GL_ATTRIBUTE_FORMAT_STRFMON (4, 5) - _GL_ARG_NONNULL ((4))); -_GL_CXXALIAS_RPL (strfmon_l, ssize_t, (char *s, size_t maxsize, locale_t locale, - const char *format, ...)); +_GL_FUNCDECL_RPL (strfmon_l, ssize_t, + (char *restrict s, size_t maxsize, locale_t locale, + const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_STRFMON (4, 5) + _GL_ARG_NONNULL ((4))); +_GL_CXXALIAS_RPL (strfmon_l, ssize_t, + (char *restrict s, size_t maxsize, locale_t locale, + const char *restrict format, ...)); # else # if @HAVE_STRFMON_L@ -_GL_CXXALIAS_SYS (strfmon_l, ssize_t, (char *s, size_t maxsize, locale_t locale, - const char *format, ...)); +_GL_CXXALIAS_SYS (strfmon_l, ssize_t, + (char *restrict s, size_t maxsize, locale_t locale, + const char *restrict format, ...)); # endif # endif # if __GLIBC__ >= 2 diff --git a/lib/pthread.in.h b/lib/pthread.in.h index 8f1f13c..0f743ca 100644 --- a/lib/pthread.in.h +++ b/lib/pthread.in.h @@ -449,28 +449,34 @@ typedef unsigned int pthread_barrierattr_t; /* =========== Thread functions =========== */ #if @GNULIB_PTHREAD_THREAD@ +/* The 'restrict' qualifier on ARG is nonsense, but POSIX specifies it this way. + Sigh. */ # if @REPLACE_PTHREAD_CREATE@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef pthread_create # define pthread_create rpl_pthread_create # endif _GL_FUNCDECL_RPL (pthread_create, int, - (pthread_t *threadp, const pthread_attr_t *attr, - void * (*mainfunc) (void *), void *arg) + (pthread_t *restrict threadp, + const pthread_attr_t *restrict attr, + void * (*mainfunc) (void *), void *restrict arg) _GL_ARG_NONNULL ((1, 3))); _GL_CXXALIAS_RPL (pthread_create, int, - (pthread_t *threadp, const pthread_attr_t *attr, - void * (*mainfunc) (void *), void *arg)); + (pthread_t *restrict threadp, + const pthread_attr_t *restrict attr, + void * (*mainfunc) (void *), void *restrict arg)); # else # if !@HAVE_PTHREAD_CREATE@ _GL_FUNCDECL_SYS (pthread_create, int, - (pthread_t *threadp, const pthread_attr_t *attr, - void * (*mainfunc) (void *), void *arg) + (pthread_t *restrict threadp, + const pthread_attr_t *restrict attr, + void * (*mainfunc) (void *), void *restrict arg) _GL_ARG_NONNULL ((1, 3))); # endif _GL_CXXALIAS_SYS_CAST (pthread_create, int, - (pthread_t *threadp, const pthread_attr_t *attr, - void * (*mainfunc) (void *), void *arg)); + (pthread_t *restrict threadp, + const pthread_attr_t *restrict attr, + void * (*mainfunc) (void *), void *restrict arg)); # endif _GL_CXXALIASWARN (pthread_create); #elif defined GNULIB_POSIXCHECK @@ -746,18 +752,22 @@ _GL_WARN_ON_USE (pthread_once, "pthread_once is not portable - " # define pthread_mutex_init rpl_pthread_mutex_init # endif _GL_FUNCDECL_RPL (pthread_mutex_init, int, - (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) + (pthread_mutex_t *restrict mutex, + const pthread_mutexattr_t *restrict attr) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_mutex_init, int, - (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); + (pthread_mutex_t *restrict mutex, + const pthread_mutexattr_t *restrict attr)); # else # if !@HAVE_PTHREAD_MUTEX_INIT@ _GL_FUNCDECL_SYS (pthread_mutex_init, int, - (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) + (pthread_mutex_t *restrict mutex, + const pthread_mutexattr_t *restrict attr) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_mutex_init, int, - (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)); + (pthread_mutex_t *restrict mutex, + const pthread_mutexattr_t *restrict attr)); # endif _GL_CXXALIASWARN (pthread_mutex_init); #elif defined GNULIB_POSIXCHECK @@ -800,20 +810,24 @@ _GL_WARN_ON_USE (pthread_mutexattr_init, "pthread_mutexattr_init is not portable # define pthread_mutexattr_gettype rpl_pthread_mutexattr_gettype # endif _GL_FUNCDECL_RPL (pthread_mutexattr_gettype, int, - (const pthread_mutexattr_t *attr, int *typep) + (const pthread_mutexattr_t *restrict attr, + int *restrict typep) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (pthread_mutexattr_gettype, int, - (const pthread_mutexattr_t *attr, int *typep)); + (const pthread_mutexattr_t *restrict attr, + int *restrict typep)); # else # if !@HAVE_PTHREAD_MUTEXATTR_GETTYPE@ _GL_FUNCDECL_SYS (pthread_mutexattr_gettype, int, - (const pthread_mutexattr_t *attr, int *typep) + (const pthread_mutexattr_t *restrict attr, + int *restrict typep) _GL_ARG_NONNULL ((1, 2))); # endif /* Need to cast, because on FreeBSD the first parameter is pthread_mutexattr_t *attr. */ _GL_CXXALIAS_SYS_CAST (pthread_mutexattr_gettype, int, - (const pthread_mutexattr_t *attr, int *typep)); + (const pthread_mutexattr_t *restrict attr, + int *restrict typep)); # endif _GL_CXXALIASWARN (pthread_mutexattr_gettype); #elif defined GNULIB_POSIXCHECK @@ -858,20 +872,24 @@ _GL_WARN_ON_USE (pthread_mutexattr_settype, "pthread_mutexattr_settype is not po # define pthread_mutexattr_getrobust rpl_pthread_mutexattr_getrobust # endif _GL_FUNCDECL_RPL (pthread_mutexattr_getrobust, int, - (const pthread_mutexattr_t *attr, int *robustp) + (const pthread_mutexattr_t *restrict attr, + int *restrict robustp) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (pthread_mutexattr_getrobust, int, - (const pthread_mutexattr_t *attr, int *robustp)); + (const pthread_mutexattr_t *restrict attr, + int *restrict robustp)); # else # if !@HAVE_PTHREAD_MUTEXATTR_GETROBUST@ _GL_FUNCDECL_SYS (pthread_mutexattr_getrobust, int, - (const pthread_mutexattr_t *attr, int *robustp) + (const pthread_mutexattr_t *restrict attr, + int *restrict robustp) _GL_ARG_NONNULL ((1, 2))); # endif /* Need to cast, because on FreeBSD the first parameter is pthread_mutexattr_t *attr. */ _GL_CXXALIAS_SYS_CAST (pthread_mutexattr_getrobust, int, - (const pthread_mutexattr_t *attr, int *robustp)); + (const pthread_mutexattr_t *restrict attr, + int *restrict robustp)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_mutexattr_getrobust); @@ -999,18 +1017,22 @@ _GL_WARN_ON_USE (pthread_mutex_trylock, "pthread_mutex_trylock is not portable - # define pthread_mutex_timedlock rpl_pthread_mutex_timedlock # endif _GL_FUNCDECL_RPL (pthread_mutex_timedlock, int, - (pthread_mutex_t *mutex, const struct timespec *abstime) + (pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (pthread_mutex_timedlock, int, - (pthread_mutex_t *mutex, const struct timespec *abstime)); + (pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime)); # else # if !@HAVE_PTHREAD_MUTEX_TIMEDLOCK@ _GL_FUNCDECL_SYS (pthread_mutex_timedlock, int, - (pthread_mutex_t *mutex, const struct timespec *abstime) + (pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (pthread_mutex_timedlock, int, - (pthread_mutex_t *mutex, const struct timespec *abstime)); + (pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime)); # endif _GL_CXXALIASWARN (pthread_mutex_timedlock); #elif defined GNULIB_POSIXCHECK @@ -1080,18 +1102,22 @@ _GL_WARN_ON_USE (pthread_mutex_destroy, "pthread_mutex_destroy is not portable - # define pthread_rwlock_init rpl_pthread_rwlock_init # endif _GL_FUNCDECL_RPL (pthread_rwlock_init, int, - (pthread_rwlock_t *lock, const pthread_rwlockattr_t *attr) + (pthread_rwlock_t *restrict lock, + const pthread_rwlockattr_t *restrict attr) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_rwlock_init, int, - (pthread_rwlock_t *lock, const pthread_rwlockattr_t *attr)); + (pthread_rwlock_t *restrict lock, + const pthread_rwlockattr_t *restrict attr)); # else # if !@HAVE_PTHREAD_RWLOCK_INIT@ _GL_FUNCDECL_SYS (pthread_rwlock_init, int, - (pthread_rwlock_t *lock, const pthread_rwlockattr_t *attr) + (pthread_rwlock_t *restrict lock, + const pthread_rwlockattr_t *restrict attr) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_rwlock_init, int, - (pthread_rwlock_t *lock, const pthread_rwlockattr_t *attr)); + (pthread_rwlock_t *restrict lock, + const pthread_rwlockattr_t *restrict attr)); # endif _GL_CXXALIASWARN (pthread_rwlock_init); #elif defined GNULIB_POSIXCHECK @@ -1261,18 +1287,22 @@ _GL_WARN_ON_USE (pthread_rwlock_trywrlock, "pthread_rwlock_trywrlock is not port # define pthread_rwlock_timedrdlock rpl_pthread_rwlock_timedrdlock # endif _GL_FUNCDECL_RPL (pthread_rwlock_timedrdlock, int, - (pthread_rwlock_t *lock, const struct timespec *abstime) + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (pthread_rwlock_timedrdlock, int, - (pthread_rwlock_t *lock, const struct timespec *abstime)); + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime)); # else # if !@HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@ _GL_FUNCDECL_SYS (pthread_rwlock_timedrdlock, int, - (pthread_rwlock_t *lock, const struct timespec *abstime) + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (pthread_rwlock_timedrdlock, int, - (pthread_rwlock_t *lock, const struct timespec *abstime)); + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime)); # endif _GL_CXXALIASWARN (pthread_rwlock_timedrdlock); #elif defined GNULIB_POSIXCHECK @@ -1290,18 +1320,22 @@ _GL_WARN_ON_USE (pthread_rwlock_timedrdlock, "pthread_rwlock_timedrdlock is not # define pthread_rwlock_timedwrlock rpl_pthread_rwlock_timedwrlock # endif _GL_FUNCDECL_RPL (pthread_rwlock_timedwrlock, int, - (pthread_rwlock_t *lock, const struct timespec *abstime) + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (pthread_rwlock_timedwrlock, int, - (pthread_rwlock_t *lock, const struct timespec *abstime)); + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime)); # else # if !@HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@ _GL_FUNCDECL_SYS (pthread_rwlock_timedwrlock, int, - (pthread_rwlock_t *lock, const struct timespec *abstime) + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (pthread_rwlock_timedwrlock, int, - (pthread_rwlock_t *lock, const struct timespec *abstime)); + (pthread_rwlock_t *restrict lock, + const struct timespec *restrict abstime)); # endif _GL_CXXALIASWARN (pthread_rwlock_timedwrlock); #elif defined GNULIB_POSIXCHECK @@ -1371,18 +1405,22 @@ _GL_WARN_ON_USE (pthread_rwlock_destroy, "pthread_rwlock_destroy is not portable # define pthread_cond_init rpl_pthread_cond_init # endif _GL_FUNCDECL_RPL (pthread_cond_init, int, - (pthread_cond_t *cond, const pthread_condattr_t *attr) + (pthread_cond_t *restrict cond, + const pthread_condattr_t *restrict attr) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (pthread_cond_init, int, - (pthread_cond_t *cond, const pthread_condattr_t *attr)); + (pthread_cond_t *restrict cond, + const pthread_condattr_t *restrict attr)); # else # if !@HAVE_PTHREAD_COND_INIT@ _GL_FUNCDECL_SYS (pthread_cond_init, int, - (pthread_cond_t *cond, const pthread_condattr_t *attr) + (pthread_cond_t *restrict cond, + const pthread_condattr_t *restrict attr) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (pthread_cond_init, int, - (pthread_cond_t *cond, const pthread_condattr_t *attr)); + (pthread_cond_t *restrict cond, + const pthread_condattr_t *restrict attr)); # endif _GL_CXXALIASWARN (pthread_cond_init); #elif defined GNULIB_POSIXCHECK @@ -1450,18 +1488,22 @@ _GL_WARN_ON_USE (pthread_condattr_destroy, "pthread_condattr_destroy is not port # define pthread_cond_wait rpl_pthread_cond_wait # endif _GL_FUNCDECL_RPL (pthread_cond_wait, int, - (pthread_cond_t *cond, pthread_mutex_t *mutex) + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (pthread_cond_wait, int, - (pthread_cond_t *cond, pthread_mutex_t *mutex)); + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex)); # else # if !@HAVE_PTHREAD_COND_WAIT@ _GL_FUNCDECL_SYS (pthread_cond_wait, int, - (pthread_cond_t *cond, pthread_mutex_t *mutex) + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (pthread_cond_wait, int, - (pthread_cond_t *cond, pthread_mutex_t *mutex)); + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex)); # endif _GL_CXXALIASWARN (pthread_cond_wait); #elif defined GNULIB_POSIXCHECK @@ -1479,22 +1521,26 @@ _GL_WARN_ON_USE (pthread_cond_wait, "pthread_cond_wait is not portable - " # define pthread_cond_timedwait rpl_pthread_cond_timedwait # endif _GL_FUNCDECL_RPL (pthread_cond_timedwait, int, - (pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec *abstime) + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime) _GL_ARG_NONNULL ((1, 2, 3))); _GL_CXXALIAS_RPL (pthread_cond_timedwait, int, - (pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec *abstime)); + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime)); # else # if !@HAVE_PTHREAD_COND_TIMEDWAIT@ _GL_FUNCDECL_SYS (pthread_cond_timedwait, int, - (pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec *abstime) + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime) _GL_ARG_NONNULL ((1, 2, 3))); # endif _GL_CXXALIAS_SYS (pthread_cond_timedwait, int, - (pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec *abstime)); + (pthread_cond_t *restrict cond, + pthread_mutex_t *restrict mutex, + const struct timespec *restrict abstime)); # endif _GL_CXXALIASWARN (pthread_cond_timedwait); #elif defined GNULIB_POSIXCHECK diff --git a/lib/search.in.h b/lib/search.in.h index b2a9fa9..61116ed 100644 --- a/lib/search.in.h +++ b/lib/search.in.h @@ -132,21 +132,21 @@ _GL_CXXALIASWARN (tfind); returned. Otherwise, NULL is returned. */ # if @REPLACE_TSEARCH@ _GL_FUNCDECL_RPL (tdelete, void *, - (const void *key, void **vrootp, + (const void *restrict key, void **restrict vrootp, _gl_search_compar_fn compar) _GL_ARG_NONNULL ((1, 2, 3))); _GL_CXXALIAS_RPL (tdelete, void *, - (const void *key, void **vrootp, + (const void *restrict key, void **restrict vrootp, _gl_search_compar_fn compar)); # else # if !@HAVE_TSEARCH@ _GL_FUNCDECL_SYS (tdelete, void *, - (const void *key, void **vrootp, + (const void *restrict key, void **restrict vrootp, _gl_search_compar_fn compar) _GL_ARG_NONNULL ((1, 2, 3))); # endif _GL_CXXALIAS_SYS (tdelete, void *, - (const void *key, void **vrootp, + (const void *restrict key, void **restrict vrootp, _gl_search_compar_fn compar)); # endif _GL_CXXALIASWARN (tdelete); diff --git a/lib/signal.in.h b/lib/signal.in.h index 9fe9f60..c94b053 100644 --- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -133,16 +133,24 @@ typedef void (*sighandler_t) (int); # define pthread_sigmask rpl_pthread_sigmask # endif _GL_FUNCDECL_RPL (pthread_sigmask, int, - (int how, const sigset_t *new_mask, sigset_t *old_mask)); + (int how, + const sigset_t *restrict new_mask, + sigset_t *restrict old_mask)); _GL_CXXALIAS_RPL (pthread_sigmask, int, - (int how, const sigset_t *new_mask, sigset_t *old_mask)); + (int how, + const sigset_t *restrict new_mask, + sigset_t *restrict old_mask)); # else # if !(@HAVE_PTHREAD_SIGMASK@ || defined pthread_sigmask) _GL_FUNCDECL_SYS (pthread_sigmask, int, - (int how, const sigset_t *new_mask, sigset_t *old_mask)); + (int how, + const sigset_t *restrict new_mask, + sigset_t *restrict old_mask)); # endif _GL_CXXALIAS_SYS (pthread_sigmask, int, - (int how, const sigset_t *new_mask, sigset_t *old_mask)); + (int how, + const sigset_t *restrict new_mask, + sigset_t *restrict old_mask)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (pthread_sigmask); @@ -295,10 +303,14 @@ _GL_CXXALIASWARN (sigpending); # define SIG_SETMASK 1 /* blocked_set = *set; */ # define SIG_UNBLOCK 2 /* blocked_set = blocked_set & ~*set; */ _GL_FUNCDECL_SYS (sigprocmask, int, - (int operation, const sigset_t *set, sigset_t *old_set)); + (int operation, + const sigset_t *restrict set, + sigset_t *restrict old_set)); # endif _GL_CXXALIAS_SYS (sigprocmask, int, - (int operation, const sigset_t *set, sigset_t *old_set)); + (int operation, + const sigset_t *restrict set, + sigset_t *restrict old_set)); _GL_CXXALIASWARN (sigprocmask); /* Install the handler FUNC for signal SIG, and return the previous diff --git a/lib/stdio.in.h b/lib/stdio.in.h index 388565d..839a14b 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -171,17 +171,17 @@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define dprintf rpl_dprintf # endif -_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...) +_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...)); +_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...)); # else # if !@HAVE_DPRINTF@ -_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...) +_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) _GL_ARG_NONNULL ((2))); # endif -_GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...)); +_GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *restrict format, ...)); # endif _GL_CXXALIASWARN (dprintf); #elif defined GNULIB_POSIXCHECK @@ -281,11 +281,14 @@ _GL_CXXALIASWARN (fgetc); # undef fgets # define fgets rpl_fgets # endif -_GL_FUNCDECL_RPL (fgets, char *, (char *s, int n, FILE *stream) - _GL_ARG_NONNULL ((1, 3))); -_GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream)); +_GL_FUNCDECL_RPL (fgets, char *, + (char *restrict s, int n, FILE *restrict stream) + _GL_ARG_NONNULL ((1, 3))); +_GL_CXXALIAS_RPL (fgets, char *, + (char *restrict s, int n, FILE *restrict stream)); # else -_GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream)); +_GL_CXXALIAS_SYS (fgets, char *, + (char *restrict s, int n, FILE *restrict stream)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fgets); @@ -298,11 +301,14 @@ _GL_CXXALIASWARN (fgets); # undef fopen # define fopen rpl_fopen # endif -_GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode)); +_GL_FUNCDECL_RPL (fopen, FILE *, + (const char *restrict filename, const char *restrict mode) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (fopen, FILE *, + (const char *restrict filename, const char *restrict mode)); # else -_GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode)); +_GL_CXXALIAS_SYS (fopen, FILE *, + (const char *restrict filename, const char *restrict mode)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fopen); @@ -322,17 +328,21 @@ _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX complian # endif # define GNULIB_overrides_fprintf 1 # if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ -_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...) - _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) - _GL_ARG_NONNULL ((1, 2))); +_GL_FUNCDECL_RPL (fprintf, int, + (FILE *restrict fp, const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) + _GL_ARG_NONNULL ((1, 2))); # else -_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...) - _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3) - _GL_ARG_NONNULL ((1, 2))); +_GL_FUNCDECL_RPL (fprintf, int, + (FILE *restrict fp, const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3) + _GL_ARG_NONNULL ((1, 2))); # endif -_GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...)); +_GL_CXXALIAS_RPL (fprintf, int, + (FILE *restrict fp, const char *restrict format, ...)); # else -_GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...)); +_GL_CXXALIAS_SYS (fprintf, int, + (FILE *restrict fp, const char *restrict format, ...)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fprintf); @@ -398,11 +408,14 @@ _GL_CXXALIASWARN (fputc); # undef fputs # define fputs rpl_fputs # endif -_GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream)); +_GL_FUNCDECL_RPL (fputs, int, + (const char *restrict string, FILE *restrict stream) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (fputs, int, + (const char *restrict string, FILE *restrict stream)); # else -_GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream)); +_GL_CXXALIAS_SYS (fputs, int, + (const char *restrict string, FILE *restrict stream)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fputs); @@ -415,11 +428,17 @@ _GL_CXXALIASWARN (fputs); # undef fread # define fread rpl_fread # endif -_GL_FUNCDECL_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream) - _GL_ARG_NONNULL ((4))); -_GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)); +_GL_FUNCDECL_RPL (fread, size_t, + (void *restrict ptr, size_t s, size_t n, + FILE *restrict stream) + _GL_ARG_NONNULL ((4))); +_GL_CXXALIAS_RPL (fread, size_t, + (void *restrict ptr, size_t s, size_t n, + FILE *restrict stream)); # else -_GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)); +_GL_CXXALIAS_SYS (fread, size_t, + (void *restrict ptr, size_t s, size_t n, + FILE *restrict stream)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fread); @@ -433,13 +452,16 @@ _GL_CXXALIASWARN (fread); # define freopen rpl_freopen # endif _GL_FUNCDECL_RPL (freopen, FILE *, - (const char *filename, const char *mode, FILE *stream) + (const char *restrict filename, const char *restrict mode, + FILE *restrict stream) _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (freopen, FILE *, - (const char *filename, const char *mode, FILE *stream)); + (const char *restrict filename, const char *restrict mode, + FILE *restrict stream)); # else _GL_CXXALIAS_SYS (freopen, FILE *, - (const char *filename, const char *mode, FILE *stream)); + (const char *restrict filename, const char *restrict mode, + FILE *restrict stream)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (freopen); @@ -458,12 +480,15 @@ _GL_WARN_ON_USE (freopen, # undef fscanf # define fscanf rpl_fscanf # endif -_GL_FUNCDECL_RPL (fscanf, int, (FILE *stream, const char *format, ...) - _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...)); +_GL_FUNCDECL_RPL (fscanf, int, + (FILE *restrict stream, const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (fscanf, int, + (FILE *restrict stream, const char *restrict format, ...)); # else -_GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...)); +_GL_CXXALIAS_SYS (fscanf, int, + (FILE *restrict stream, const char *restrict format, ...)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fscanf); @@ -634,13 +659,16 @@ _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB " # define fwrite rpl_fwrite # endif _GL_FUNCDECL_RPL (fwrite, size_t, - (const void *ptr, size_t s, size_t n, FILE *stream) + (const void *restrict ptr, size_t s, size_t n, + FILE *restrict stream) _GL_ARG_NONNULL ((1, 4))); _GL_CXXALIAS_RPL (fwrite, size_t, - (const void *ptr, size_t s, size_t n, FILE *stream)); + (const void *restrict ptr, size_t s, size_t n, + FILE *restrict stream)); # else _GL_CXXALIAS_SYS (fwrite, size_t, - (const void *ptr, size_t s, size_t n, FILE *stream)); + (const void *restrict ptr, size_t s, size_t n, + FILE *restrict stream)); /* Work around bug 11959 when fortifying glibc 2.4 through 2.15 , @@ -715,22 +743,26 @@ _GL_CXXALIASWARN (getchar); # define getdelim rpl_getdelim # endif _GL_FUNCDECL_RPL (getdelim, ssize_t, - (char **lineptr, size_t *linesize, int delimiter, - FILE *stream) + (char **restrict lineptr, size_t *restrict linesize, + int delimiter, + FILE *restrict stream) _GL_ARG_NONNULL ((1, 2, 4))); _GL_CXXALIAS_RPL (getdelim, ssize_t, - (char **lineptr, size_t *linesize, int delimiter, - FILE *stream)); + (char **restrict lineptr, size_t *restrict linesize, + int delimiter, + FILE *restrict stream)); # else # if !@HAVE_DECL_GETDELIM@ _GL_FUNCDECL_SYS (getdelim, ssize_t, - (char **lineptr, size_t *linesize, int delimiter, - FILE *stream) + (char **restrict lineptr, size_t *restrict linesize, + int delimiter, + FILE *restrict stream) _GL_ARG_NONNULL ((1, 2, 4))); # endif _GL_CXXALIAS_SYS (getdelim, ssize_t, - (char **lineptr, size_t *linesize, int delimiter, - FILE *stream)); + (char **restrict lineptr, size_t *restrict linesize, + int delimiter, + FILE *restrict stream)); # endif _GL_CXXALIASWARN (getdelim); #elif defined GNULIB_POSIXCHECK @@ -754,18 +786,22 @@ _GL_WARN_ON_USE (getdelim, "getdelim is unportable - " # define getline rpl_getline # endif _GL_FUNCDECL_RPL (getline, ssize_t, - (char **lineptr, size_t *linesize, FILE *stream) + (char **restrict lineptr, size_t *restrict linesize, + FILE *restrict stream) _GL_ARG_NONNULL ((1, 2, 3))); _GL_CXXALIAS_RPL (getline, ssize_t, - (char **lineptr, size_t *linesize, FILE *stream)); + (char **restrict lineptr, size_t *restrict linesize, + FILE *restrict stream)); # else # if !@HAVE_DECL_GETLINE@ _GL_FUNCDECL_SYS (getline, ssize_t, - (char **lineptr, size_t *linesize, FILE *stream) + (char **restrict lineptr, size_t *restrict linesize, + FILE *restrict stream) _GL_ARG_NONNULL ((1, 2, 3))); # endif _GL_CXXALIAS_SYS (getline, ssize_t, - (char **lineptr, size_t *linesize, FILE *stream)); + (char **restrict lineptr, size_t *restrict linesize, + FILE *restrict stream)); # endif # if @HAVE_DECL_GETLINE@ _GL_CXXALIASWARN (getline); @@ -909,14 +945,14 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " # endif # if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ _GL_FUNCDECL_RPL_1 (__printf__, int, - (const char *format, ...) + (const char *restrict format, ...) __asm__ (@ASM_SYMBOL_PREFIX@ _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2) _GL_ARG_NONNULL ((1))); # else _GL_FUNCDECL_RPL_1 (__printf__, int, - (const char *format, ...) + (const char *restrict format, ...) __asm__ (@ASM_SYMBOL_PREFIX@ _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2) @@ -928,14 +964,14 @@ _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...)); # define printf rpl_printf # endif _GL_FUNCDECL_RPL (printf, int, - (const char *format, ...) + (const char *restrict format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (printf, int, (const char *format, ...)); +_GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...)); # endif # define GNULIB_overrides_printf 1 # else -_GL_CXXALIAS_SYS (printf, int, (const char *format, ...)); +_GL_CXXALIAS_SYS (printf, int, (const char *restrict format, ...)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (printf); @@ -1083,24 +1119,24 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - " # define scanf __scanf__ # endif _GL_FUNCDECL_RPL_1 (__scanf__, int, - (const char *format, ...) + (const char *restrict format, ...) __asm__ (@ASM_SYMBOL_PREFIX@ _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)) _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *format, ...)); +_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *restrict format, ...)); # else # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef scanf # define scanf rpl_scanf # endif -_GL_FUNCDECL_RPL (scanf, int, (const char *format, ...) +_GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...) _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (scanf, int, (const char *format, ...)); +_GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...)); # endif # else -_GL_CXXALIAS_SYS (scanf, int, (const char *format, ...)); +_GL_CXXALIAS_SYS (scanf, int, (const char *restrict format, ...)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (scanf); @@ -1113,20 +1149,24 @@ _GL_CXXALIASWARN (scanf); # define snprintf rpl_snprintf # endif _GL_FUNCDECL_RPL (snprintf, int, - (char *str, size_t size, const char *format, ...) + (char *restrict str, size_t size, + const char *restrict format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) _GL_ARG_NONNULL ((3))); _GL_CXXALIAS_RPL (snprintf, int, - (char *str, size_t size, const char *format, ...)); + (char *restrict str, size_t size, + const char *restrict format, ...)); # else # if !@HAVE_DECL_SNPRINTF@ _GL_FUNCDECL_SYS (snprintf, int, - (char *str, size_t size, const char *format, ...) + (char *restrict str, size_t size, + const char *restrict format, ...) _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4) _GL_ARG_NONNULL ((3))); # endif _GL_CXXALIAS_SYS (snprintf, int, - (char *str, size_t size, const char *format, ...)); + (char *restrict str, size_t size, + const char *restrict format, ...)); # endif _GL_CXXALIASWARN (snprintf); #elif defined GNULIB_POSIXCHECK @@ -1151,12 +1191,15 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define sprintf rpl_sprintf # endif -_GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...) - _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...)); +_GL_FUNCDECL_RPL (sprintf, int, + (char *restrict str, const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (sprintf, int, + (char *restrict str, const char *restrict format, ...)); # else -_GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...)); +_GL_CXXALIAS_SYS (sprintf, int, + (char *restrict str, const char *restrict format, ...)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (sprintf); @@ -1244,20 +1287,23 @@ _GL_CXXALIASWARN (vasprintf); # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define vdprintf rpl_vdprintf # endif -_GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args) - _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) - _GL_ARG_NONNULL ((2))); -_GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args)); +_GL_FUNCDECL_RPL (vdprintf, int, + (int fd, const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (vdprintf, int, + (int fd, const char *restrict format, va_list args)); # else # if !@HAVE_VDPRINTF@ -_GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args) - _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) - _GL_ARG_NONNULL ((2))); +_GL_FUNCDECL_SYS (vdprintf, int, + (int fd, const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) + _GL_ARG_NONNULL ((2))); # endif /* Need to cast, because on Solaris, the third parameter will likely be __va_list args. */ _GL_CXXALIAS_SYS_CAST (vdprintf, int, - (int fd, const char *format, va_list args)); + (int fd, const char *restrict format, va_list args)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (vdprintf); @@ -1278,21 +1324,28 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " # endif # define GNULIB_overrides_vfprintf 1 # if @GNULIB_VFPRINTF_POSIX@ -_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args) - _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) - _GL_ARG_NONNULL ((1, 2))); +_GL_FUNCDECL_RPL (vfprintf, int, + (FILE *restrict fp, + const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) + _GL_ARG_NONNULL ((1, 2))); # else -_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args) - _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0) - _GL_ARG_NONNULL ((1, 2))); +_GL_FUNCDECL_RPL (vfprintf, int, + (FILE *restrict fp, + const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0) + _GL_ARG_NONNULL ((1, 2))); # endif -_GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)); +_GL_CXXALIAS_RPL (vfprintf, int, + (FILE *restrict fp, + const char *restrict 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 (vfprintf, int, - (FILE *fp, const char *format, va_list args)); + (FILE *restrict fp, + const char *restrict format, va_list args)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (vfprintf); @@ -1315,14 +1368,17 @@ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " # define vfscanf rpl_vfscanf # endif _GL_FUNCDECL_RPL (vfscanf, int, - (FILE *stream, const char *format, va_list args) + (FILE *restrict stream, + const char *restrict format, va_list args) _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (vfscanf, int, - (FILE *stream, const char *format, va_list args)); + (FILE *restrict stream, + const char *restrict format, va_list args)); # else _GL_CXXALIAS_SYS (vfscanf, int, - (FILE *stream, const char *format, va_list args)); + (FILE *restrict stream, + const char *restrict format, va_list args)); # endif _GL_CXXALIASWARN (vfscanf); #endif @@ -1335,20 +1391,21 @@ _GL_CXXALIASWARN (vfscanf); # endif # define GNULIB_overrides_vprintf 1 # if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ -_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args) +_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0) _GL_ARG_NONNULL ((1))); # else -_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args) +_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0) _GL_ARG_NONNULL ((1))); # endif -_GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args)); +_GL_CXXALIAS_RPL (vprintf, int, (const char *restrict format, va_list args)); # else /* Need to cast, because on Solaris, the second parameter is __va_list args and GCC's fixincludes did not change this to __gnuc_va_list. */ -_GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args)); +_GL_CXXALIAS_SYS_CAST (vprintf, int, + (const char *restrict format, va_list args)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (vprintf); @@ -1370,12 +1427,12 @@ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " # undef vscanf # define vscanf rpl_vscanf # endif -_GL_FUNCDECL_RPL (vscanf, int, (const char *format, va_list args) +_GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args) _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (vscanf, int, (const char *format, va_list args)); +_GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args)); # else -_GL_CXXALIAS_SYS (vscanf, int, (const char *format, va_list args)); +_GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args)); # endif _GL_CXXALIASWARN (vscanf); #endif @@ -1386,20 +1443,24 @@ _GL_CXXALIASWARN (vscanf); # define vsnprintf rpl_vsnprintf # endif _GL_FUNCDECL_RPL (vsnprintf, int, - (char *str, size_t size, const char *format, va_list args) + (char *restrict str, size_t size, + const char *restrict format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) _GL_ARG_NONNULL ((3))); _GL_CXXALIAS_RPL (vsnprintf, int, - (char *str, size_t size, const char *format, va_list args)); + (char *restrict str, size_t size, + const char *restrict format, va_list args)); # else # if !@HAVE_DECL_VSNPRINTF@ _GL_FUNCDECL_SYS (vsnprintf, int, - (char *str, size_t size, const char *format, va_list args) + (char *restrict str, size_t size, + const char *restrict format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) _GL_ARG_NONNULL ((3))); # endif _GL_CXXALIAS_SYS (vsnprintf, int, - (char *str, size_t size, const char *format, va_list args)); + (char *restrict str, size_t size, + const char *restrict format, va_list args)); # endif _GL_CXXALIASWARN (vsnprintf); #elif defined GNULIB_POSIXCHECK @@ -1416,17 +1477,20 @@ _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " # define vsprintf rpl_vsprintf # endif _GL_FUNCDECL_RPL (vsprintf, int, - (char *str, const char *format, va_list args) + (char *restrict str, + const char *restrict format, va_list args) _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (vsprintf, int, - (char *str, const char *format, va_list args)); + (char *restrict str, + const char *restrict 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, - (char *str, const char *format, va_list args)); + (char *restrict str, + const char *restrict format, va_list args)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (vsprintf); diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 49bbf6f..ec5f124 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -311,13 +311,17 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " # undef mbtowc # define mbtowc rpl_mbtowc # endif -_GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); -_GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); +_GL_FUNCDECL_RPL (mbtowc, int, + (wchar_t *restrict pwc, const char *restrict s, size_t n)); +_GL_CXXALIAS_RPL (mbtowc, int, + (wchar_t *restrict pwc, const char *restrict s, size_t n)); # else # if !@HAVE_MBTOWC@ -_GL_FUNCDECL_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); +_GL_FUNCDECL_SYS (mbtowc, int, + (wchar_t *restrict pwc, const char *restrict s, size_t n)); # endif -_GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n)); +_GL_CXXALIAS_SYS (mbtowc, int, + (wchar_t *restrict pwc, const char *restrict s, size_t n)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (mbtowc); @@ -866,15 +870,19 @@ _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define realpath rpl_realpath # endif -_GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved)); +_GL_FUNCDECL_RPL (realpath, char *, + (const char *restrict name, char *restrict resolved) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (realpath, char *, + (const char *restrict name, char *restrict resolved)); # else # if !@HAVE_REALPATH@ -_GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved) - _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (realpath, char *, + (const char *restrict name, char *restrict resolved) + _GL_ARG_NONNULL ((1))); # endif -_GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved)); +_GL_CXXALIAS_SYS (realpath, char *, + (const char *restrict name, char *restrict resolved)); # endif _GL_CXXALIASWARN (realpath); #elif defined GNULIB_POSIXCHECK @@ -957,15 +965,19 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - " # define strtod rpl_strtod # endif # define GNULIB_defined_strtod_function 1 -_GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp)); +_GL_FUNCDECL_RPL (strtod, double, + (const char *restrict str, char **restrict endp) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strtod, double, + (const char *restrict str, char **restrict endp)); # else # if !@HAVE_STRTOD@ -_GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp) - _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (strtod, double, + (const char *restrict str, char **restrict endp) + _GL_ARG_NONNULL ((1))); # endif -_GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp)); +_GL_CXXALIAS_SYS (strtod, double, + (const char *restrict str, char **restrict endp)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (strtod); @@ -985,15 +997,19 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - " # define strtold rpl_strtold # endif # define GNULIB_defined_strtold_function 1 -_GL_FUNCDECL_RPL (strtold, long double, (const char *str, char **endp) - _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (strtold, long double, (const char *str, char **endp)); +_GL_FUNCDECL_RPL (strtold, long double, + (const char *restrict str, char **restrict endp) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strtold, long double, + (const char *restrict str, char **restrict endp)); # else # if !@HAVE_STRTOLD@ -_GL_FUNCDECL_SYS (strtold, long double, (const char *str, char **endp) - _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (strtold, long double, + (const char *restrict str, char **restrict endp) + _GL_ARG_NONNULL ((1))); # endif -_GL_CXXALIAS_SYS (strtold, long double, (const char *str, char **endp)); +_GL_CXXALIAS_SYS (strtold, long double, + (const char *restrict str, char **restrict endp)); # endif _GL_CXXALIASWARN (strtold); #elif defined GNULIB_POSIXCHECK @@ -1015,11 +1031,13 @@ _GL_WARN_ON_USE (strtold, "strtold is unportable - " to ERANGE. */ # if !@HAVE_STRTOLL@ _GL_FUNCDECL_SYS (strtoll, long long, - (const char *string, char **endptr, int base) + (const char *restrict string, char **restrict endptr, + int base) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strtoll, long long, - (const char *string, char **endptr, int base)); + (const char *restrict string, char **restrict endptr, + int base)); _GL_CXXALIASWARN (strtoll); #elif defined GNULIB_POSIXCHECK # undef strtoll @@ -1040,11 +1058,13 @@ _GL_WARN_ON_USE (strtoll, "strtoll is unportable - " ERANGE. */ # if !@HAVE_STRTOULL@ _GL_FUNCDECL_SYS (strtoull, unsigned long long, - (const char *string, char **endptr, int base) + (const char *restrict string, char **restrict endptr, + int base) _GL_ARG_NONNULL ((1))); # endif _GL_CXXALIAS_SYS (strtoull, unsigned long long, - (const char *string, char **endptr, int base)); + (const char *restrict string, char **restrict endptr, + int base)); _GL_CXXALIASWARN (strtoull); #elif defined GNULIB_POSIXCHECK # undef strtoull diff --git a/lib/string.in.h b/lib/string.in.h index 2be474d..625d608 100644 --- 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 -_GL_FUNCDECL_RPL (strncat, char *, (char *dest, const char *src, size_t n) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (strncat, char *, (char *dest, const char *src, size_t n)); +_GL_FUNCDECL_RPL (strncat, char *, + (char *restrict dest, const char *restrict src, size_t n) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (strncat, char *, + (char *restrict dest, const char *restrict src, size_t n)); # else -_GL_CXXALIAS_SYS (strncat, char *, (char *dest, const char *src, size_t n)); +_GL_CXXALIAS_SYS (strncat, char *, + (char *restrict dest, const char *restrict src, size_t n)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (strncat); diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h index 8e013e6..948d689 100644 --- a/lib/sys_socket.in.h +++ b/lib/sys_socket.in.h @@ -346,14 +346,20 @@ _GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - " # define accept rpl_accept # endif _GL_FUNCDECL_RPL (accept, int, - (int fd, struct sockaddr *addr, socklen_t *addrlen)); + (int fd, + struct sockaddr *restrict addr, + socklen_t *restrict addrlen)); _GL_CXXALIAS_RPL (accept, int, - (int fd, struct sockaddr *addr, socklen_t *addrlen)); + (int fd, + struct sockaddr *restrict addr, + socklen_t *restrict addrlen)); # else /* Need to cast, because on Solaris 10 systems, the third parameter is - void *addrlen. */ + void *addrlen. */ _GL_CXXALIAS_SYS_CAST (accept, int, - (int fd, struct sockaddr *addr, socklen_t *addrlen)); + (int fd, + struct sockaddr *restrict addr, + socklen_t *restrict addrlen)); # endif _GL_CXXALIASWARN (accept); #elif @HAVE_WINSOCK2_H@ @@ -404,15 +410,18 @@ _GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - " # define getpeername rpl_getpeername # endif _GL_FUNCDECL_RPL (getpeername, int, - (int fd, struct sockaddr *addr, socklen_t *addrlen) + (int fd, struct sockaddr *restrict addr, + socklen_t *restrict addrlen) _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (getpeername, int, - (int fd, struct sockaddr *addr, socklen_t *addrlen)); + (int fd, struct sockaddr *restrict addr, + socklen_t *restrict addrlen)); # else /* Need to cast, because on Solaris 10 systems, the third parameter is - void *addrlen. */ + void *addrlen. */ _GL_CXXALIAS_SYS_CAST (getpeername, int, - (int fd, struct sockaddr *addr, socklen_t *addrlen)); + (int fd, struct sockaddr *restrict addr, + socklen_t *restrict addrlen)); # endif _GL_CXXALIASWARN (getpeername); #elif @HAVE_WINSOCK2_H@ @@ -433,15 +442,18 @@ _GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - " # define getsockname rpl_getsockname # endif _GL_FUNCDECL_RPL (getsockname, int, - (int fd, struct sockaddr *addr, socklen_t *addrlen) + (int fd, struct sockaddr *restrict addr, + socklen_t *restrict addrlen) _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (getsockname, int, - (int fd, struct sockaddr *addr, socklen_t *addrlen)); + (int fd, struct sockaddr *restrict addr, + socklen_t *restrict addrlen)); # else /* Need to cast, because on Solaris 10 systems, the third parameter is - void *addrlen. */ + void *addrlen. */ _GL_CXXALIAS_SYS_CAST (getsockname, int, - (int fd, struct sockaddr *addr, socklen_t *addrlen)); + (int fd, struct sockaddr *restrict addr, + socklen_t *restrict addrlen)); # endif _GL_CXXALIASWARN (getsockname); #elif @HAVE_WINSOCK2_H@ @@ -461,16 +473,19 @@ _GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - " # undef getsockopt # define getsockopt rpl_getsockopt # endif -_GL_FUNCDECL_RPL (getsockopt, int, (int fd, int level, int optname, - void *optval, socklen_t *optlen) - _GL_ARG_NONNULL ((4, 5))); -_GL_CXXALIAS_RPL (getsockopt, int, (int fd, int level, int optname, - void *optval, socklen_t *optlen)); +_GL_FUNCDECL_RPL (getsockopt, int, + (int fd, int level, int optname, + void *restrict optval, socklen_t *restrict optlen) + _GL_ARG_NONNULL ((4, 5))); +_GL_CXXALIAS_RPL (getsockopt, int, + (int fd, int level, int optname, + 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, - void *optval, socklen_t *optlen)); +_GL_CXXALIAS_SYS_CAST (getsockopt, int, + (int fd, int level, int optname, + void *restrict optval, socklen_t *restrict optlen)); # endif _GL_CXXALIASWARN (getsockopt); #elif @HAVE_WINSOCK2_H@ @@ -571,18 +586,21 @@ _GL_WARN_ON_USE (send, "send is not always POSIX compliant - " # define recvfrom rpl_recvfrom # endif _GL_FUNCDECL_RPL (recvfrom, ssize_t, - (int fd, void *buf, size_t len, int flags, - struct sockaddr *from, socklen_t *fromlen) + (int fd, void *restrict buf, size_t len, int flags, + struct sockaddr *restrict from, + socklen_t *restrict fromlen) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (recvfrom, ssize_t, - (int fd, void *buf, size_t len, int flags, - struct sockaddr *from, socklen_t *fromlen)); + (int fd, void *restrict buf, size_t len, int flags, + struct sockaddr *restrict from, + socklen_t *restrict fromlen)); # else /* Need to cast, because on Solaris 10 systems, the sixth parameter is void *fromlen. */ _GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t, - (int fd, void *buf, size_t len, int flags, - struct sockaddr *from, socklen_t *fromlen)); + (int fd, void *restrict buf, size_t len, int flags, + struct sockaddr *restrict from, + socklen_t *restrict fromlen)); # endif _GL_CXXALIASWARN (recvfrom); #elif @HAVE_WINSOCK2_H@ diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h index 65661f4..a27a79a 100644 --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h @@ -455,18 +455,22 @@ _GL_WARN_ON_USE (fstat, "fstat has portability problems - " # define fstatat rpl_fstatat # endif _GL_FUNCDECL_RPL (fstatat, int, - (int fd, char const *name, struct stat *st, int flags) + (int fd, char const *restrict name, struct stat *restrict st, + int flags) _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (fstatat, int, - (int fd, char const *name, struct stat *st, int flags)); + (int fd, char const *restrict name, struct stat *restrict st, + int flags)); # else # if !@HAVE_FSTATAT@ _GL_FUNCDECL_SYS (fstatat, int, - (int fd, char const *name, struct stat *st, int flags) + (int fd, char const *restrict name, struct stat *restrict st, + int flags) _GL_ARG_NONNULL ((2, 3))); # endif _GL_CXXALIAS_SYS (fstatat, int, - (int fd, char const *name, struct stat *st, int flags)); + (int fd, char const *restrict name, struct stat *restrict st, + int flags)); # endif _GL_CXXALIASWARN (fstatat); #elif @GNULIB_OVERRIDES_STRUCT_STAT@ @@ -548,17 +552,21 @@ _GL_WARN_ON_USE (lchmod, "lchmod is unportable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define lstat stat # endif -_GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf)); +_GL_CXXALIAS_RPL_1 (lstat, stat, int, + (const char *restrict name, struct stat *restrict buf)); # elif @REPLACE_LSTAT@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef lstat # define lstat rpl_lstat # endif -_GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf)); +_GL_FUNCDECL_RPL (lstat, int, + (const char *restrict name, struct stat *restrict buf) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (lstat, int, + (const char *restrict name, struct stat *restrict buf)); # else -_GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf)); +_GL_CXXALIAS_SYS (lstat, int, + (const char *restrict name, struct stat *restrict buf)); # endif # if @HAVE_LSTAT@ _GL_CXXALIASWARN (lstat); @@ -771,7 +779,7 @@ _GL_WARN_ON_USE (mknodat, "mknodat is not portable - " # define stat(name, st) rpl_stat (name, st) # endif /* !_LARGE_FILES */ # endif /* !@GNULIB_OVERRIDES_STRUCT_STAT@ */ -_GL_EXTERN_C int stat (const char *name, struct stat *buf) +_GL_EXTERN_C int stat (const char *restrict name, struct stat *restrict buf) _GL_ARG_NONNULL ((1, 2)); # endif #elif @GNULIB_OVERRIDES_STRUCT_STAT@ diff --git a/lib/time.in.h b/lib/time.in.h index 7304668..e10e90c 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -286,14 +286,17 @@ _GL_CXXALIASWARN (ctime); # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define strftime rpl_strftime # endif -_GL_FUNCDECL_RPL (strftime, size_t, (char *__buf, size_t __bufsize, - const char *__fmt, const struct tm *__tp) - _GL_ARG_NONNULL ((1, 3, 4))); -_GL_CXXALIAS_RPL (strftime, size_t, (char *__buf, size_t __bufsize, - const char *__fmt, const struct tm *__tp)); +_GL_FUNCDECL_RPL (strftime, size_t, + (char *restrict __buf, size_t __bufsize, + const char *restrict __fmt, const struct tm *restrict __tp) + _GL_ARG_NONNULL ((1, 3, 4))); +_GL_CXXALIAS_RPL (strftime, size_t, + (char *restrict __buf, size_t __bufsize, + const char *restrict __fmt, const struct tm *restrict __tp)); # else -_GL_CXXALIAS_SYS (strftime, size_t, (char *__buf, size_t __bufsize, - const char *__fmt, const struct tm *__tp)); +_GL_CXXALIAS_SYS (strftime, size_t, + (char *restrict __buf, size_t __bufsize, + const char *restrict __fmt, const struct tm *restrict __tp)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (strftime); diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 6db7ff2..1454d7e 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -1370,18 +1370,22 @@ _GL_CXXALIASWARN (read); # define readlink rpl_readlink # endif _GL_FUNCDECL_RPL (readlink, ssize_t, - (const char *file, char *buf, size_t bufsize) + (const char *restrict file, + char *restrict buf, size_t bufsize) _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (readlink, ssize_t, - (const char *file, char *buf, size_t bufsize)); + (const char *restrict file, + char *restrict buf, size_t bufsize)); # else # if !@HAVE_READLINK@ _GL_FUNCDECL_SYS (readlink, ssize_t, - (const char *file, char *buf, size_t bufsize) + (const char *restrict file, + char *restrict buf, size_t bufsize) _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (readlink, ssize_t, - (const char *file, char *buf, size_t bufsize)); + (const char *restrict file, + char *restrict buf, size_t bufsize)); # endif _GL_CXXALIASWARN (readlink); #elif defined GNULIB_POSIXCHECK @@ -1399,18 +1403,22 @@ _GL_WARN_ON_USE (readlink, "readlink is unportable - " # define readlinkat rpl_readlinkat # endif _GL_FUNCDECL_RPL (readlinkat, ssize_t, - (int fd, char const *file, char *buf, size_t len) + (int fd, char const *restrict file, + char *restrict buf, size_t len) _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (readlinkat, ssize_t, - (int fd, char const *file, char *buf, size_t len)); + (int fd, char const *restrict file, + char *restrict buf, size_t len)); # else # if !@HAVE_READLINKAT@ _GL_FUNCDECL_SYS (readlinkat, ssize_t, - (int fd, char const *file, char *buf, size_t len) + (int fd, char const *restrict file, + char *restrict buf, size_t len) _GL_ARG_NONNULL ((2, 3))); # endif _GL_CXXALIAS_SYS (readlinkat, ssize_t, - (int fd, char const *file, char *buf, size_t len)); + (int fd, char const *restrict file, + char *restrict buf, size_t len)); # endif _GL_CXXALIASWARN (readlinkat); #elif defined GNULIB_POSIXCHECK diff --git a/lib/wchar.in.h b/lib/wchar.in.h index 74cd670..040065a 100644 --- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -244,16 +244,20 @@ _GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - " # define mbrtowc rpl_mbrtowc # endif _GL_FUNCDECL_RPL (mbrtowc, size_t, - (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); + (wchar_t *restrict pwc, const char *restrict s, size_t n, + mbstate_t *restrict ps)); _GL_CXXALIAS_RPL (mbrtowc, size_t, - (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); + (wchar_t *restrict pwc, const char *restrict s, size_t n, + mbstate_t *restrict ps)); # else # if !@HAVE_MBRTOWC@ _GL_FUNCDECL_SYS (mbrtowc, size_t, - (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); + (wchar_t *restrict pwc, const char *restrict s, size_t n, + mbstate_t *restrict ps)); # endif _GL_CXXALIAS_SYS (mbrtowc, size_t, - (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)); + (wchar_t *restrict pwc, const char *restrict s, size_t n, + mbstate_t *restrict ps)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (mbrtowc); @@ -274,13 +278,17 @@ _GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - " # undef mbrlen # define mbrlen rpl_mbrlen # endif -_GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); -_GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); +_GL_FUNCDECL_RPL (mbrlen, size_t, + (const char *restrict s, size_t n, mbstate_t *restrict ps)); +_GL_CXXALIAS_RPL (mbrlen, size_t, + (const char *restrict s, size_t n, mbstate_t *restrict ps)); # else # if !@HAVE_MBRLEN@ -_GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); +_GL_FUNCDECL_SYS (mbrlen, size_t, + (const char *restrict s, size_t n, mbstate_t *restrict ps)); # endif -_GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps)); +_GL_CXXALIAS_SYS (mbrlen, size_t, + (const char *restrict s, size_t n, mbstate_t *restrict ps)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (mbrlen); @@ -302,20 +310,26 @@ _GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - " # define mbsrtowcs rpl_mbsrtowcs # endif _GL_FUNCDECL_RPL (mbsrtowcs, size_t, - (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) + (wchar_t *restrict dest, + const char **restrict srcp, size_t len, + mbstate_t *restrict ps) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (mbsrtowcs, size_t, - (wchar_t *dest, const char **srcp, size_t len, - mbstate_t *ps)); + (wchar_t *restrict dest, + const char **restrict srcp, size_t len, + mbstate_t *restrict ps)); # else # if !@HAVE_MBSRTOWCS@ _GL_FUNCDECL_SYS (mbsrtowcs, size_t, - (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) + (wchar_t *restrict dest, + const char **restrict srcp, size_t len, + mbstate_t *restrict ps) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (mbsrtowcs, size_t, - (wchar_t *dest, const char **srcp, size_t len, - mbstate_t *ps)); + (wchar_t *restrict dest, + const char **restrict srcp, size_t len, + mbstate_t *restrict ps)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (mbsrtowcs); @@ -337,22 +351,26 @@ _GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - " # define mbsnrtowcs rpl_mbsnrtowcs # endif _GL_FUNCDECL_RPL (mbsnrtowcs, size_t, - (wchar_t *dest, const char **srcp, size_t srclen, size_t len, - mbstate_t *ps) + (wchar_t *restrict dest, + const char **restrict srcp, size_t srclen, size_t len, + mbstate_t *restrict ps) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (mbsnrtowcs, size_t, - (wchar_t *dest, const char **srcp, size_t srclen, size_t len, - mbstate_t *ps)); + (wchar_t *restrict dest, + const char **restrict srcp, size_t srclen, size_t len, + mbstate_t *restrict ps)); # else # if !@HAVE_MBSNRTOWCS@ _GL_FUNCDECL_SYS (mbsnrtowcs, size_t, - (wchar_t *dest, const char **srcp, size_t srclen, size_t len, - mbstate_t *ps) + (wchar_t *restrict dest, + const char **restrict srcp, size_t srclen, size_t len, + mbstate_t *restrict ps) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (mbsnrtowcs, size_t, - (wchar_t *dest, const char **srcp, size_t srclen, size_t len, - mbstate_t *ps)); + (wchar_t *restrict dest, + const char **restrict srcp, size_t srclen, size_t len, + mbstate_t *restrict ps)); # endif _GL_CXXALIASWARN (mbsnrtowcs); #elif defined GNULIB_POSIXCHECK @@ -371,13 +389,17 @@ _GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - " # undef wcrtomb # define wcrtomb rpl_wcrtomb # endif -_GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); -_GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); +_GL_FUNCDECL_RPL (wcrtomb, size_t, + (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); +_GL_CXXALIAS_RPL (wcrtomb, size_t, + (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); # else # if !@HAVE_WCRTOMB@ -_GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); +_GL_FUNCDECL_SYS (wcrtomb, size_t, + (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); # endif -_GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps)); +_GL_CXXALIAS_SYS (wcrtomb, size_t, + (char *restrict s, wchar_t wc, mbstate_t *restrict ps)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcrtomb); @@ -399,20 +421,26 @@ _GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - " # define wcsrtombs rpl_wcsrtombs # endif _GL_FUNCDECL_RPL (wcsrtombs, size_t, - (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps) + (char *restrict dest, const wchar_t **restrict srcp, + size_t len, + mbstate_t *restrict ps) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (wcsrtombs, size_t, - (char *dest, const wchar_t **srcp, size_t len, - mbstate_t *ps)); + (char *restrict dest, const wchar_t **restrict srcp, + size_t len, + mbstate_t *restrict ps)); # else # if !@HAVE_WCSRTOMBS@ _GL_FUNCDECL_SYS (wcsrtombs, size_t, - (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps) + (char *restrict dest, const wchar_t **restrict srcp, + size_t len, + mbstate_t *restrict ps) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (wcsrtombs, size_t, - (char *dest, const wchar_t **srcp, size_t len, - mbstate_t *ps)); + (char *restrict dest, const wchar_t **restrict srcp, + size_t len, + mbstate_t *restrict ps)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsrtombs); @@ -434,22 +462,30 @@ _GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - " # define wcsnrtombs rpl_wcsnrtombs # endif _GL_FUNCDECL_RPL (wcsnrtombs, size_t, - (char *dest, const wchar_t **srcp, size_t srclen, size_t len, - mbstate_t *ps) + (char *restrict dest, + const wchar_t **restrict srcp, size_t srclen, + size_t len, + mbstate_t *restrict ps) _GL_ARG_NONNULL ((2))); _GL_CXXALIAS_RPL (wcsnrtombs, size_t, - (char *dest, const wchar_t **srcp, size_t srclen, size_t len, - mbstate_t *ps)); + (char *restrict dest, + const wchar_t **restrict srcp, size_t srclen, + size_t len, + mbstate_t *restrict ps)); # else # if !@HAVE_WCSNRTOMBS@ || (defined __cplusplus && defined __sun) _GL_FUNCDECL_SYS (wcsnrtombs, size_t, - (char *dest, const wchar_t **srcp, size_t srclen, size_t len, - mbstate_t *ps) + (char *restrict dest, + const wchar_t **restrict srcp, size_t srclen, + size_t len, + mbstate_t *restrict ps) _GL_ARG_NONNULL ((2))); # endif _GL_CXXALIAS_SYS (wcsnrtombs, size_t, - (char *dest, const wchar_t **srcp, size_t srclen, size_t len, - mbstate_t *ps)); + (char *restrict dest, + const wchar_t **restrict srcp, size_t srclen, + size_t len, + mbstate_t *restrict ps)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsnrtombs); @@ -547,10 +583,12 @@ _GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - " #if @GNULIB_WMEMCPY@ # if !@HAVE_WMEMCPY@ _GL_FUNCDECL_SYS (wmemcpy, wchar_t *, - (wchar_t *dest, const wchar_t *src, size_t n)); + (wchar_t *restrict dest, + const wchar_t *restrict src, size_t n)); # endif _GL_CXXALIAS_SYS (wmemcpy, wchar_t *, - (wchar_t *dest, const wchar_t *src, size_t n)); + (wchar_t *restrict dest, + const wchar_t *restrict src, size_t n)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wmemcpy); # endif @@ -640,9 +678,11 @@ _GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - " /* Copy SRC to DEST. */ #if @GNULIB_WCSCPY@ # if !@HAVE_WCSCPY@ -_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 *restrict src)); # endif -_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 *restrict src)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcscpy); # endif @@ -658,9 +698,11 @@ _GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - " /* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */ #if @GNULIB_WCPCPY@ # if !@HAVE_WCPCPY@ -_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 *restrict src)); # endif -_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 *restrict src)); _GL_CXXALIASWARN (wcpcpy); #elif defined GNULIB_POSIXCHECK # undef wcpcpy @@ -675,10 +717,12 @@ _GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - " #if @GNULIB_WCSNCPY@ # if !@HAVE_WCSNCPY@ _GL_FUNCDECL_SYS (wcsncpy, wchar_t *, - (wchar_t *dest, const wchar_t *src, size_t n)); + (wchar_t *restrict dest, + const wchar_t *restrict src, size_t n)); # endif _GL_CXXALIAS_SYS (wcsncpy, wchar_t *, - (wchar_t *dest, const wchar_t *src, size_t n)); + (wchar_t *restrict dest, + const wchar_t *restrict src, size_t n)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsncpy); # endif @@ -696,10 +740,12 @@ _GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - " #if @GNULIB_WCPNCPY@ # if !@HAVE_WCPNCPY@ _GL_FUNCDECL_SYS (wcpncpy, wchar_t *, - (wchar_t *dest, const wchar_t *src, size_t n)); + (wchar_t *restrict dest, + const wchar_t *restrict src, size_t n)); # endif _GL_CXXALIAS_SYS (wcpncpy, wchar_t *, - (wchar_t *dest, const wchar_t *src, size_t n)); + (wchar_t *restrict dest, + const wchar_t *restrict src, size_t n)); _GL_CXXALIASWARN (wcpncpy); #elif defined GNULIB_POSIXCHECK # undef wcpncpy @@ -713,9 +759,11 @@ _GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - " /* Append SRC onto DEST. */ #if @GNULIB_WCSCAT@ # if !@HAVE_WCSCAT@ -_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 *restrict src)); # endif -_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 *restrict src)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcscat); # endif @@ -732,10 +780,12 @@ _GL_WARN_ON_USE (wcscat, "wcscat is unportable - " #if @GNULIB_WCSNCAT@ # if !@HAVE_WCSNCAT@ _GL_FUNCDECL_SYS (wcsncat, wchar_t *, - (wchar_t *dest, const wchar_t *src, size_t n)); + (wchar_t *restrict dest, const wchar_t *restrict src, + size_t n)); # endif _GL_CXXALIAS_SYS (wcsncat, wchar_t *, - (wchar_t *dest, const wchar_t *src, size_t n)); + (wchar_t *restrict dest, const wchar_t *restrict src, + size_t n)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsncat); # endif @@ -848,9 +898,11 @@ _GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - " original strings. */ #if @GNULIB_WCSXFRM@ # if !@HAVE_WCSXFRM@ -_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 *restrict s2, size_t n)); # endif -_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 *restrict s2, size_t n)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsxfrm); # endif @@ -1016,7 +1068,8 @@ _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - " #if @GNULIB_WCSSTR@ # if !@HAVE_WCSSTR@ _GL_FUNCDECL_SYS (wcsstr, wchar_t *, - (const wchar_t *haystack, const wchar_t *needle) + (const wchar_t *restrict haystack, + const wchar_t *restrict needle) _GL_ATTRIBUTE_PURE); # endif /* On some systems, this function is defined as an overloaded function: @@ -1025,14 +1078,18 @@ _GL_FUNCDECL_SYS (wcsstr, wchar_t *, wchar_t * std::wcsstr (wchar_t *, const wchar_t *); } */ _GL_CXXALIAS_SYS_CAST2 (wcsstr, - wchar_t *, (const wchar_t *, const wchar_t *), - const wchar_t *, (const wchar_t *, const wchar_t *)); + wchar_t *, + (const wchar_t *restrict, const wchar_t *restrict), + const wchar_t *, + (const wchar_t *restrict, const wchar_t *restrict)); # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) _GL_CXXALIASWARN1 (wcsstr, wchar_t *, - (wchar_t *haystack, const wchar_t *needle)); + (wchar_t *restrict haystack, + const wchar_t *restrict needle)); _GL_CXXALIASWARN1 (wcsstr, const wchar_t *, - (const wchar_t *haystack, const wchar_t *needle)); + (const wchar_t *restrict haystack, + const wchar_t *restrict needle)); # elif __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsstr); # endif @@ -1053,16 +1110,20 @@ _GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - " # define wcstok rpl_wcstok # endif _GL_FUNCDECL_RPL (wcstok, wchar_t *, - (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); + (wchar_t *restrict wcs, const wchar_t *restrict delim, + wchar_t **restrict ptr)); _GL_CXXALIAS_RPL (wcstok, wchar_t *, - (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); + (wchar_t *restrict wcs, const wchar_t *restrict delim, + wchar_t **restrict ptr)); # else # if !@HAVE_WCSTOK@ _GL_FUNCDECL_SYS (wcstok, wchar_t *, - (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); + (wchar_t *restrict wcs, const wchar_t *restrict delim, + wchar_t **restrict ptr)); # endif _GL_CXXALIAS_SYS (wcstok, wchar_t *, - (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr)); + (wchar_t *restrict wcs, const wchar_t *restrict delim, + wchar_t **restrict ptr)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcstok); @@ -1114,19 +1175,27 @@ _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - " # undef wcsftime # define wcsftime rpl_wcsftime # endif -_GL_FUNCDECL_RPL (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, - const wchar_t *__fmt, const struct tm *__tp) - _GL_ARG_NONNULL ((1, 3, 4))); -_GL_CXXALIAS_RPL (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, - const wchar_t *__fmt, const struct tm *__tp)); +_GL_FUNCDECL_RPL (wcsftime, size_t, + (wchar_t *restrict __buf, size_t __bufsize, + const wchar_t *restrict __fmt, + const struct tm *restrict __tp) + _GL_ARG_NONNULL ((1, 3, 4))); +_GL_CXXALIAS_RPL (wcsftime, size_t, + (wchar_t *restrict __buf, size_t __bufsize, + const wchar_t *restrict __fmt, + const struct tm *restrict __tp)); # else # if !@HAVE_WCSFTIME@ -_GL_FUNCDECL_SYS (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, - const wchar_t *__fmt, const struct tm *__tp) - _GL_ARG_NONNULL ((1, 3, 4))); +_GL_FUNCDECL_SYS (wcsftime, size_t, + (wchar_t *restrict __buf, size_t __bufsize, + const wchar_t *restrict __fmt, + const struct tm *restrict __tp) + _GL_ARG_NONNULL ((1, 3, 4))); # endif -_GL_CXXALIAS_SYS (wcsftime, size_t, (wchar_t *__buf, size_t __bufsize, - const wchar_t *__fmt, const struct tm *__tp)); +_GL_CXXALIAS_SYS (wcsftime, size_t, + (wchar_t *restrict __buf, size_t __bufsize, + const wchar_t *restrict __fmt, + const struct tm *restrict __tp)); # endif # if __GLIBC__ >= 2 _GL_CXXALIASWARN (wcsftime); diff --git a/m4/iconv_h.m4 b/m4/iconv_h.m4 index 0c0164c..23d41c9 100644 --- a/m4/iconv_h.m4 +++ b/m4/iconv_h.m4 @@ -1,4 +1,4 @@ -# iconv_h.m4 serial 11 +# iconv_h.m4 serial 12 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -17,6 +17,8 @@ AC_DEFUN([gl_ICONV_H], dnl guaranteed by C89. gl_WARN_ON_USE_PREPARE([[#include ]], [iconv iconv_open]) + + AC_REQUIRE([AC_C_RESTRICT]) ]) dnl Unconditionally enables the replacement of . diff --git a/m4/inttypes.m4 b/m4/inttypes.m4 index d0487d6..224d0cd 100644 --- a/m4/inttypes.m4 +++ b/m4/inttypes.m4 @@ -1,4 +1,4 @@ -# inttypes.m4 serial 28 +# inttypes.m4 serial 29 dnl Copyright (C) 2006-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -28,6 +28,8 @@ AC_DEFUN_ONCE([gl_INTTYPES_INCOMPLETE], dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include ]], [imaxabs imaxdiv strtoimax strtoumax]) + + AC_REQUIRE([AC_C_RESTRICT]) ]) # Ensure that the PRI* and SCN* macros are defined appropriately. diff --git a/m4/monetary_h.m4 b/m4/monetary_h.m4 index 0b3c7c7..556a265 100644 --- a/m4/monetary_h.m4 +++ b/m4/monetary_h.m4 @@ -1,4 +1,4 @@ -# monetary_h.m4 serial 4 +# monetary_h.m4 serial 5 dnl Copyright (C) 2017-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -38,6 +38,8 @@ AC_DEFUN_ONCE([gl_MONETARY_H], gl_WARN_ON_USE_PREPARE([[ #include ]], [strfmon_l]) + + AC_REQUIRE([AC_C_RESTRICT]) else MONETARY_H='' fi diff --git a/m4/search_h.m4 b/m4/search_h.m4 index 10d608f..f21e7cc 100644 --- a/m4/search_h.m4 +++ b/m4/search_h.m4 @@ -1,4 +1,4 @@ -# search_h.m4 serial 10 +# search_h.m4 serial 11 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -40,6 +40,8 @@ AC_DEFUN([gl_SEARCH_H], dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include ]], [tdelete tfind tsearch twalk]) + + AC_REQUIRE([AC_C_RESTRICT]) ]) AC_DEFUN([gl_SEARCH_MODULE_INDICATOR], diff --git a/m4/signal_h.m4 b/m4/signal_h.m4 index 0868438..b262980 100644 --- a/m4/signal_h.m4 +++ b/m4/signal_h.m4 @@ -1,4 +1,4 @@ -# signal_h.m4 serial 18 +# signal_h.m4 serial 19 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -34,6 +34,8 @@ AC_DEFUN([gl_SIGNAL_H], ]], [pthread_sigmask sigaction sigaddset sigdelset sigemptyset sigfillset sigismember sigpending sigprocmask]) + + AC_REQUIRE([AC_C_RESTRICT]) ]) AC_DEFUN([gl_CHECK_TYPE_SIGSET_T], diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4 index c603b51..5f968bc 100644 --- a/m4/stdio_h.m4 +++ b/m4/stdio_h.m4 @@ -1,4 +1,4 @@ -# stdio_h.m4 serial 49 +# stdio_h.m4 serial 50 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -107,6 +107,8 @@ AC_DEFUN([gl_STDIO_H], gl_WARN_ON_USE_PREPARE([[#include ]], [dprintf fpurge fseeko ftello getdelim getline gets pclose popen renameat snprintf tmpfile vdprintf vsnprintf]) + + AC_REQUIRE([AC_C_RESTRICT]) ]) AC_DEFUN([gl_STDIO_MODULE_INDICATOR], diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4 index 61a3e31..743066a 100644 --- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 @@ -1,4 +1,4 @@ -# stdlib_h.m4 serial 48 +# stdlib_h.m4 serial 49 dnl Copyright (C) 2007-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -27,6 +27,8 @@ AC_DEFUN([gl_STDLIB_H], posix_openpt ptsname ptsname_r qsort_r random random_r reallocarray realpath rpmatch secure_getenv setenv setstate setstate_r srandom srandom_r strtod strtold strtoll strtoull unlockpt unsetenv]) + + AC_REQUIRE([AC_C_RESTRICT]) ]) AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], diff --git a/m4/string_h.m4 b/m4/string_h.m4 index 4c1f685..cc51337 100644 --- a/m4/string_h.m4 +++ b/m4/string_h.m4 @@ -5,7 +5,7 @@ # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 22 +# serial 23 # Written by Paul Eggert. @@ -18,7 +18,6 @@ AC_DEFUN([gl_HEADER_STRING_H], AC_DEFUN([gl_HEADER_STRING_H_BODY], [ - AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) gl_NEXT_HEADERS([string.h]) @@ -30,6 +29,8 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY], [ffsl ffsll memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r strerror_r strsignal strverscmp]) + + AC_REQUIRE([AC_C_RESTRICT]) ]) AC_DEFUN([gl_STRING_MODULE_INDICATOR], diff --git a/m4/sys_socket_h.m4 b/m4/sys_socket_h.m4 index 1471aea..bf902f0 100644 --- a/m4/sys_socket_h.m4 +++ b/m4/sys_socket_h.m4 @@ -1,4 +1,4 @@ -# sys_socket_h.m4 serial 24 +# sys_socket_h.m4 serial 25 dnl Copyright (C) 2005-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -95,6 +95,8 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], #include ]], [socket connect accept bind getpeername getsockname getsockopt listen recv send recvfrom sendto setsockopt shutdown accept4]) + + AC_REQUIRE([AC_C_RESTRICT]) ]) AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], diff --git a/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4 index a5f35d4..30d60d9 100644 --- a/m4/sys_stat_h.m4 +++ b/m4/sys_stat_h.m4 @@ -1,4 +1,4 @@ -# sys_stat_h.m4 serial 32 -*- Autoconf -*- +# sys_stat_h.m4 serial 33 -*- Autoconf -*- dnl Copyright (C) 2006-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -48,7 +48,9 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H], gl_WARN_ON_USE_PREPARE([[#include ]], [fchmodat fstat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat mknod mknodat stat utimensat]) -]) # gl_HEADER_SYS_STAT_H + + AC_REQUIRE([AC_C_RESTRICT]) +]) AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR], [ diff --git a/m4/time_h.m4 b/m4/time_h.m4 index aae0ae2..d0f8932 100644 --- a/m4/time_h.m4 +++ b/m4/time_h.m4 @@ -2,7 +2,7 @@ # Copyright (C) 2000-2001, 2003-2007, 2009-2020 Free Software Foundation, Inc. -# serial 11 +# serial 12 # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -19,10 +19,12 @@ AC_DEFUN([gl_HEADER_TIME_H], AC_DEFUN([gl_HEADER_TIME_H_BODY], [ - AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) + gl_NEXT_HEADERS([time.h]) AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) + + AC_REQUIRE([AC_C_RESTRICT]) ]) dnl Check whether 'struct timespec' is declared diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index ea2bb01..e776f3b 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 77 +# unistd_h.m4 serial 78 dnl Copyright (C) 2006-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -48,6 +48,8 @@ AC_DEFUN([gl_UNISTD_H], group_member isatty lchown link linkat lseek pipe pipe2 pread pwrite readlink readlinkat rmdir sethostname sleep symlink symlinkat truncate ttyname_r unlink unlinkat usleep]) + + AC_REQUIRE([AC_C_RESTRICT]) ]) AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], diff --git a/m4/wchar_h.m4 b/m4/wchar_h.m4 index d1b7228..be09020 100644 --- a/m4/wchar_h.m4 +++ b/m4/wchar_h.m4 @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl Written by Eric Blake. -# wchar_h.m4 serial 44 +# wchar_h.m4 serial 45 AC_DEFUN([gl_WCHAR_H], [ @@ -57,6 +57,8 @@ AC_DEFUN([gl_WCHAR_H], wcsncmp wcscasecmp wcsncasecmp wcscoll wcsxfrm wcsdup wcschr wcsrchr wcscspn wcsspn wcspbrk wcsstr wcstok wcswidth wcsftime ]) + + AC_REQUIRE([AC_C_RESTRICT]) ]) dnl Check whether is usable at all.