On Fri, Feb 5, 2021 at 9:35 AM Arnaud Charlet <char...@adacore.com> wrote: > > > This fixes the bootstrap failure with Ada on Cygwin since the switch > > to C++11. The configure checks detect that fileno_unlocked () is > > present, but when Ada's cstreams.c is compiled in C++11 mode, > > <stdio.h> does not declare it, causing a hard error. > > > > Fixed by defining _GNU_SOURCE before including <stdio.h>. > > > > Ok for the master branch? > > > > gcc/ada/ > > > > 2021-02-03 Mikael Pettersson <mikpeli...@gmail.com> > > > > PR bootstrap/98590 > > * cstreams.c: Ensure fileno_unlocked() is visible on Cygwin. > > We'd rather not have PR references in the source files, so please remove it > (it will be there as part of the commit log and git annotate). > > OK with the comment updated.
Thanks, here's the revised patch. gcc/ada/ 2021-02-05 Mikael Pettersson <mikpeli...@gmail.com> PR bootstrap/98590 * cstreams.c: Ensure fileno_unlocked() is visible on Cygwin. diff --git a/gcc/ada/cstreams.c b/gcc/ada/cstreams.c index 4e00dedbbd6..7d64277110b 100644 --- a/gcc/ada/cstreams.c +++ b/gcc/ada/cstreams.c @@ -37,6 +37,11 @@ #define _FILE_OFFSET_BITS 64 /* the define above will make off_t a 64bit type on GNU/Linux */ +/* tell Cygwin's <stdio.h> to expose fileno_unlocked() */ +#if defined(__CYGWIN__) && !defined(__CYGWIN32__) && !defined(_GNU_SOURCE) +#define _GNU_SOURCE +#endif + #include <stdio.h> #include <sys/types.h> #include <sys/stat.h>
From f9b9b44f5341b0d8df7b1bb00de6f7231258891b Mon Sep 17 00:00:00 2001 From: Mikael Pettersson <mikpeli...@gmail.com> Date: Fri, 5 Feb 2021 14:43:52 +0100 Subject: [PATCH] Ensure fileno_unlocked() is visible on Cygwin. --- gcc/ada/cstreams.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/ada/cstreams.c b/gcc/ada/cstreams.c index 4e00dedbbd6..7d64277110b 100644 --- a/gcc/ada/cstreams.c +++ b/gcc/ada/cstreams.c @@ -37,6 +37,11 @@ #define _FILE_OFFSET_BITS 64 /* the define above will make off_t a 64bit type on GNU/Linux */ +/* tell Cygwin's <stdio.h> to expose fileno_unlocked() */ +#if defined(__CYGWIN__) && !defined(__CYGWIN32__) && !defined(_GNU_SOURCE) +#define _GNU_SOURCE +#endif + #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> -- 2.26.2