diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index cb38dab12f0856fc1bfa000a5a22918eed7f3fe5..6c975b45034f3a561e5a319edd2b96c454b57c8e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2009-09-16 Thomas Quinot <quinot@adacore.com> + + * s-oscons-tmplt.c (Target_OS, Target_Name): New constants. + * g-expect.adb (Set_Up_Child_Communications): Use + System.OS_Constants.Target_OS to determine whether running on Windows. + 2009-09-14 Richard Henderson <rth@redhat.com> * gcc-interface/trans.c (Pragma_to_gnu): Use build5 for ASM_EXPR. diff --git a/gcc/ada/g-expect.adb b/gcc/ada/g-expect.adb index 02bc6cf8a79c2abc5dc4fffcea5179d4043e450f..a67696a649d5d73ad27a53e6982b72bd5c6fc2a8 100644 --- a/gcc/ada/g-expect.adb +++ b/gcc/ada/g-expect.adb @@ -31,8 +31,9 @@ -- -- ------------------------------------------------------------------------------ -with System; use System; -with Ada.Calendar; use Ada.Calendar; +with System; use System; +with System.OS_Constants; use System.OS_Constants; +with Ada.Calendar; use Ada.Calendar; with GNAT.IO; with GNAT.OS_Lib; use GNAT.OS_Lib; @@ -1195,15 +1196,14 @@ package body GNAT.Expect is pragma Warnings (Off, Pipe2); pragma Warnings (Off, Pipe3); - On_Windows : constant Boolean := Directory_Separator = '\'; - -- This is ugly, we need a better way of doing this test ??? - Input : File_Descriptor; Output : File_Descriptor; Error : File_Descriptor; + No_Fork_On_Target : constant Boolean := Target_OS = Windows; + begin - if On_Windows then + if No_Fork_On_Target then -- Since Windows does not have a separate fork/exec, we need to -- perform the following actions: diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c index c4218c2ab78b4c2dee473f724be3ed4818a6a50b..a2ae16e35c3082112ee56fd670da116be8a81782 100644 --- a/gcc/ada/s-oscons-tmplt.c +++ b/gcc/ada/s-oscons-tmplt.c @@ -175,6 +175,9 @@ int counter = 0; #endif +#define STR(x) STR1(x) +#define STR1(x) #x + #ifdef __MINGW32__ unsigned int _CRT_fmode = _O_BINARY; #endif @@ -216,6 +219,25 @@ package System.OS_Constants is ** General constants (all platforms) **/ +/* + + ----------------------------- + -- Platform identification -- + ----------------------------- + +*/ +TXT(" Target_Name : constant String := " STR(TARGET) ";") +/* + type Target_OS_Type is (Windows, VMS, Other_OS); +*/ +#if defined (__MINGW32__) +# define TARGET_OS Windows +#elif defined (__VMS) +# define TARGET_OS VMS +#else +# define TARGET_OS Other_OS +#endif +TXT(" Target_OS : constant Target_OS_Type := " STR(TARGET_OS) ";") /* -------------------