From f5bb1134c9e0974a05ed7533c82efa3861cff27c Mon Sep 17 00:00:00 2001 From: Thomas Quinot <quinot@adacore.com> Date: Wed, 16 Sep 2009 12:21:10 +0000 Subject: [PATCH] s-oscons-tmplt.c (Target_OS, [...]): New constants. 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. From-SVN: r151747 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/g-expect.adb | 12 ++++++------ gcc/ada/s-oscons-tmplt.c | 22 ++++++++++++++++++++++ 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index cb38dab12f08..6c975b45034f 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 02bc6cf8a79c..a67696a649d5 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 c4218c2ab78b..a2ae16e35c30 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) ";") /* ------------------- -- GitLab