[newlib-cygwin/main] Cygwin: fix build failure due to redefinition of __restrict in sys/cdefs.h

Corinna Vinschen corinna@sourceware.org
Mon Aug 7 14:09:55 GMT 2023


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=2e7332d6bd0219da491e899e0c3cee335ec8c9ab

commit 2e7332d6bd0219da491e899e0c3cee335ec8c9ab
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Mon Aug 7 16:04:32 2023 +0200
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Mon Aug 7 16:04:32 2023 +0200

    Cygwin: fix build failure due to redefinition of __restrict in sys/cdefs.h
    
    Commit 3c75fac130b5 fixed the __restrict definition in sys/cdefs.h,
    but uncovered a problem in the definition of lio_listio in Cygwin's
    aio.h.  It uses the C99 extension of using the restrict keyword
    to define non-overlapping arrays. However, this is not allowed in
    C++.
    
    Use the newly defined __restrict_arr from commit e66c63be6b80
    ("sys/cdefs.h: introduce __restrict_arr, as in glibc")
    
    Fixes: 3c75fac130b5 ("sys/cdefs.h: fix for use __restrict in C++"
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/aio.cc        | 2 +-
 winsup/cygwin/include/aio.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/aio.cc b/winsup/cygwin/aio.cc
index 1c17aa7f657f..c4b3389c46ae 100644
--- a/winsup/cygwin/aio.cc
+++ b/winsup/cygwin/aio.cc
@@ -905,7 +905,7 @@ aio_write (struct aiocb *aio)
 }
 
 int
-lio_listio (int mode, struct aiocb *__restrict const aiolist[__restrict],
+lio_listio (int mode, struct aiocb *__restrict const aiolist[__restrict_arr],
             int nent, struct sigevent *__restrict sig)
 {
   struct aiocb *aio;
diff --git a/winsup/cygwin/include/aio.h b/winsup/cygwin/include/aio.h
index 523a47870c6e..7ddd17e83859 100644
--- a/winsup/cygwin/include/aio.h
+++ b/winsup/cygwin/include/aio.h
@@ -73,7 +73,7 @@ ssize_t aio_return  (struct aiocb *);
 int     aio_suspend (const struct aiocb *const [], int,
                         const struct timespec *);
 int     aio_write   (struct aiocb *);
-int     lio_listio  (int, struct aiocb *__restrict const [__restrict], int,
+int     lio_listio  (int, struct aiocb *__restrict const [__restrict_arr], int,
                         struct sigevent *__restrict);
 
 #ifdef __cplusplus


More information about the Cygwin-cvs mailing list