[PATCH v2] Cygwin: syscalls.cc: Include ../stdio/local.h

Sebastian Huber sebastian.huber@embedded-brains.de
Thu May 12 07:08:14 GMT 2022


Include Newlib internal ../stdio/local.h for the _fwalk_reent() declaration.
Add C++ support to local.h
---
 newlib/libc/stdio/local.h | 5 +++++
 winsup/cygwin/syscalls.cc | 5 ++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h
index 30c534dcd..abe5c380a 100644
--- a/newlib/libc/stdio/local.h
+++ b/newlib/libc/stdio/local.h
@@ -23,6 +23,7 @@
  */
 
 #include <_ansi.h>
+#include <sys/cdefs.h>
 #include <reent.h>
 #include <stdarg.h>
 #include <stdlib.h>
@@ -140,6 +141,8 @@
 
 #endif /* __SINGLE_THREAD__ || __IMPL_UNLOCKED__ */
 
+__BEGIN_DECLS
+
 extern wint_t __fgetwc (struct _reent *, FILE *);
 extern wint_t __fputwc (struct _reent *, wchar_t, FILE *);
 extern u_char *__sccl (char *, u_char *fmt);
@@ -338,3 +341,5 @@ typedef enum __packed {
 extern const __CH_CLASS __chclass[256];
 extern const __STATE __state_table[MAX_STATE][MAX_CH_CLASS];
 extern const __ACTION __action_table[MAX_STATE][MAX_CH_CLASS];
+
+__END_DECLS
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 1cecaa017..885498a1a 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -64,6 +64,8 @@ details. */
 #include "child_info.h"
 #include <cygwin/fs.h>  /* needed for RENAME_NOREPLACE */
 
+#include "../../newlib/libc/stdio/local.h" /* needed for _fwalk_reent() */
+
 #undef _close
 #undef _lseek
 #undef _open
@@ -3057,9 +3059,6 @@ _cygwin_istext_for_stdio (int fd)
   return 1;
 }
 
-/* internal newlib function */
-extern "C" int _fwalk_reent (struct _reent *ptr, int (*function) (struct _reent *, FILE *));
-
 static int
 setmode_helper (struct _reent *ptr __unused, FILE *f)
 {
-- 
2.35.3



More information about the Newlib mailing list