From 5fa3ea21352a956a05859c65a2107f019c16013c Mon Sep 17 00:00:00 2001 From: Dave Korn Date: Tue, 6 Dec 2011 20:31:31 +0000 Subject: [PATCH] Makefile.in (LIBGNAT_TARGET_PAIRS [windows targets]): Correctly detect cygwin... * gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS [windows targets]): Correctly detect cygwin, which no longer has the '32' suffix, and use appropriate implementations of the sockets and memory packages. * sysdep.c (WIN_SETMODE): New define to choose the correct spelling of setmode/_setmode for MinGW and Cygwin, respectively. (__gnat_set_binary_mode [windows targets]): Use the above, and enable the windows version for Cygwin as well as MinGW. (__gnat_set_text_mode [windows targets]): Likewise. (__gnat_ttyname [windows targets]): Provide a Cygwin implementation in addition to the MinGW version. (__gnat_is_windows_xp): Make available to Cygwin as well as MinGW. (__gnat_get_stack_bounds): Likewise. From-SVN: r182065 --- gcc/ada/ChangeLog | 15 +++++++++ gcc/ada/gcc-interface/Makefile.in | 24 +++++++++++--- gcc/ada/sysdep.c | 53 ++++++++++++++++++++++--------- 3 files changed, 72 insertions(+), 20 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index f9977b6a37a4..94875aba18a9 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,18 @@ +2011-12-06 Dave Korn + + * gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS [windows targets]): + Correctly detect cygwin, which no longer has the '32' suffix, and use + appropriate implementations of the sockets and memory packages. + * sysdep.c (WIN_SETMODE): New define to choose the correct spelling of + setmode/_setmode for MinGW and Cygwin, respectively. + (__gnat_set_binary_mode [windows targets]): Use the above, and enable + the windows version for Cygwin as well as MinGW. + (__gnat_set_text_mode [windows targets]): Likewise. + (__gnat_ttyname [windows targets]): Provide a Cygwin implementation + in addition to the MinGW version. + (__gnat_is_windows_xp): Make available to Cygwin as well as MinGW. + (__gnat_get_stack_bounds): Likewise. + 2011-12-05 Bob Duff * sem_ch4.adb: Minor comment fix. diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in index 32d8e428178a..f6aac1c38e7e 100644 --- a/gcc/ada/gcc-interface/Makefile.in +++ b/gcc/ada/gcc-interface/Makefile.in @@ -1580,18 +1580,32 @@ ifeq ($(strip $(filter-out avr none powerpc% eabispe leon% erc32% unknown elf,$( indepsw.adb +#else +#define WIN_SETMODE _setmode +#endif + void __gnat_set_binary_mode (int handle) { - _setmode (handle, O_BINARY); + WIN_SETMODE (handle, O_BINARY); } void __gnat_set_text_mode (int handle) { - _setmode (handle, O_TEXT); + WIN_SETMODE (handle, O_TEXT); } -#ifdef __MINGW32__ -#include - -/* Return the name of the tty. Under windows there is no name for - the tty, so this function, if connected to a tty, returns the generic name - "console". */ +#ifdef __CYGWIN__ char * __gnat_ttyname (int filedes) { - if (isatty (filedes)) - return "console"; - else - return NULL; + extern char *ttyname (int); + + return ttyname (filedes); } +#endif /* __CYGWIN__ */ + +#if defined (__CYGWIN__) || defined (__MINGW32__) +#include + #ifndef RTX int __gnat_is_windows_xp (void); @@ -178,7 +184,7 @@ __gnat_is_windows_xp (void) return is_win_xp; } -#endif +#endif /* !RTX */ /* Get the bounds of the stack. The stack pointer is supposed to be initialized to BASE when a thread is created and the stack can be extended @@ -198,7 +204,24 @@ __gnat_get_stack_bounds (void **base, void **limit) *limit = tib->StackLimit; } -#endif /* !__MINGW32__ */ +#endif /* __CYGWIN__ || __MINGW32__ */ + +#ifdef __MINGW32__ + +/* Return the name of the tty. Under windows there is no name for + the tty, so this function, if connected to a tty, returns the generic name + "console". */ + +char * +__gnat_ttyname (int filedes) +{ + if (isatty (filedes)) + return "console"; + else + return NULL; +} + +#endif /* __MINGW32__ */ #else -- 2.39.2