Text mode translation should not be done for Cygwin, especially since it does 
not
support unicode setmode calls. This also fixes ada builds for Cygwin.

OK for trunk?

gcc/ada/ChangeLog:
        * sysdep.c (__gnat_set_binary_mode, __gnat_set_text_mode,
        __gnat_set_mode): Disable text mode translation, Cygwin should
        follow *Nix behavior. This also fixes build failures on Cywgin.

diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c
index 465007e..aeaed6d 100644
--- a/gcc/ada/sysdep.c
+++ b/gcc/ada/sysdep.c
@@ -128,15 +128,15 @@ extern struct tm *localtime_r(const time_t *, struct tm 
*);

 #if defined (WINNT) || defined (__CYGWIN__)

+#if defined (__CYGWIN__)
+const char __gnat_text_translation_required = 0;
+void __gnat_set_binary_mode (int handle) {}
+void __gnat_set_text_mode (int handle) {}
+void __gnat_set_mode(int handle, int mode) {}
+#else
 const char __gnat_text_translation_required = 1;

-#ifdef __CYGWIN__
-#define WIN_SETMODE setmode
-#include <io.h>
-#else
 #define WIN_SETMODE _setmode
-#endif
-
 void
 __gnat_set_binary_mode (int handle)
 {
@@ -172,6 +172,8 @@ __gnat_set_mode (int handle, int mode)
  }
 }

+#endif __CYGWIN__
+
 #ifdef __CYGWIN__

 char *

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to