aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/adaint.c
diff options
context:
space:
mode:
authorAndris Pavenis <andris.pavenis@iki.fi>2016-10-11 21:24:45 +0300
committerAndris Pavenis <andris@gcc.gnu.org>2016-10-11 21:24:45 +0300
commit91f2eb13cbb83377acbb194f2eac594caf71d864 (patch)
treeb59af555c8794be83da22b346b05a8d6cfab718c /gcc/ada/adaint.c
parenta5297b0470db4d1875a651e578a9b538f5da6d3f (diff)
downloadgcc-91f2eb13cbb83377acbb194f2eac594caf71d864.zip
gcc-91f2eb13cbb83377acbb194f2eac594caf71d864.tar.gz
gcc-91f2eb13cbb83377acbb194f2eac594caf71d864.tar.bz2
adaint.c: Include process.h, signal.h, dir.h and utime.h for DJGPP.
2016-10-11 Andris Pavenis <andris.pavenis@iki.fi> * adaint.c: Include process.h, signal.h, dir.h and utime.h for DJGPP. ISALPHA: include <ctype.h> and define to isalpha for DJGPP when IN_RTS is defined. (DIR_SEPARATOR) define to '\\' for DJGPP. (__gnat_get_file_names_case_sensitive): return 0 for DJGPP unless overriden in environment (__gnat_is_absolute_path): Support MS-DOS style absolute paths for DJGPP. (__gnat_portable_spawn): Use spewnvp for DJGPP. (__gnat_portable_no_block_spawn): Use spawnvp for DJGPP. (__gnat_portable_wait): Return 0 for DJGPP. From-SVN: r240999
Diffstat (limited to 'gcc/ada/adaint.c')
-rw-r--r--gcc/ada/adaint.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index e011fef..3539147 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -112,7 +112,18 @@
extern "C" {
#endif
-#if defined (__MINGW32__) || defined (__CYGWIN__)
+#if defined (__DJGPP__)
+
+/* For isalpha-like tests in the compiler, we're expected to resort to
+ safe-ctype.h/ISALPHA. This isn't available for the runtime library
+ build, so we fallback on ctype.h/isalpha there. */
+
+#ifdef IN_RTS
+#include <ctype.h>
+#define ISALPHA isalpha
+#endif
+
+#elif defined (__MINGW32__) || defined (__CYGWIN__)
#include "mingw32.h"
@@ -165,11 +176,16 @@ UINT CurrentCCSEncoding;
#include <sys/wait.h>
#endif
-#if defined (_WIN32)
-
+#if defined (__DJGPP__)
#include <process.h>
#include <signal.h>
#include <dir.h>
+#include <utime.h>
+#undef DIR_SEPARATOR
+#define DIR_SEPARATOR '\\'
+
+#elif defined (_WIN32)
+
#include <windows.h>
#include <accctrl.h>
#include <aclapi.h>
@@ -554,7 +570,7 @@ __gnat_get_file_names_case_sensitive (void)
{
/* By default, we suppose filesystems aren't case sensitive on
Windows and Darwin (but they are on arm-darwin). */
-#if defined (WINNT) \
+#if defined (WINNT) || defined (__DJGPP__) \
|| (defined (__APPLE__) && !(defined (__arm__) || defined (__arm64__)))
file_names_case_sensitive_cache = 0;
#else
@@ -570,7 +586,7 @@ __gnat_get_file_names_case_sensitive (void)
int
__gnat_get_env_vars_case_sensitive (void)
{
-#if defined (WINNT)
+#if defined (WINNT) || defined (__DJGPP__)
return 0;
#else
return 1;
@@ -1640,7 +1656,7 @@ __gnat_is_absolute_path (char *name, int length)
#else
return (length != 0) &&
(*name == '/' || *name == DIR_SEPARATOR
-#if defined (WINNT)
+#if defined (WINNT) || defined(__DJGPP__)
|| (length > 1 && ISALPHA (name[0]) && name[1] == ':')
#endif
);
@@ -2228,7 +2244,7 @@ __gnat_portable_spawn (char *args[] ATTRIBUTE_UNUSED)
#if defined (__vxworks) || defined(__PikeOS__)
return -1;
-#elif defined (_WIN32)
+#elif defined (__DJGPP__) || defined (_WIN32)
/* args[0] must be quotes as it could contain a full pathname with spaces */
char *args_0 = args[0];
args[0] = (char *)xmalloc (strlen (args_0) + 3);
@@ -2600,6 +2616,12 @@ __gnat_portable_no_block_spawn (char *args[] ATTRIBUTE_UNUSED)
/* Not supported. */
return -1;
+#elif defined(__DJGPP__)
+ if (spawnvp (P_WAIT, args[0], args) != 0)
+ return -1;
+ else
+ return 0;
+
#elif defined (_WIN32)
HANDLE h = NULL;
@@ -2643,6 +2665,9 @@ __gnat_portable_wait (int *process_status)
pid = win32_wait (&status);
+#elif defined (__DJGPP__)
+ /* Child process has already ended in case of DJGPP.
+ No need to do anything. Just return success. */
#else
pid = waitpid (-1, &status, 0);