This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 4/4][Ada,DJGPP] Ada support for DJGPP
- From: Andris Pavenis <andris dot pavenis at iki dot fi>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: DJ Delorie <dj at delorie dot com>
- Date: Sat, 30 Jul 2016 08:47:17 +0300
- Subject: [PATCH 4/4][Ada,DJGPP] Ada support for DJGPP
- Authentication-results: sourceware.org; auth=none
This last patch (4/4) contains DJGPP related changes to adaint.c (except one which belongs to patch
1/4).
ChangeLog entry:
2016-07-30 Andris Pavenis <andris.pavenis@iki.fi>
* ada/adaint.c: Include process.h, signal.h, dir.h and utime.h for DJGPP.
(DIR_SEPARATOR) define to '\\' for DJGPP.
(__gnat_get_maximum_file_name_length): decide return value depending on
availability of LFN for DJGPP
(__gnat_get_file_names_case_sensitive): return 0 for DJGPP unless
overriden in environment
(__gnat_get_default_identifier_character_set): return '1' for DJGPP
(__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.
Andris
>From 3f96c997eb087c5ee4b90d706919074e36ee9927 Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pavenis@iki.fi>
Date: Mon, 25 Jul 2016 20:08:26 +0300
Subject: [PATCH 4/4] [DJGPP, Ada] DJGPP support
* ada/adaint.c: Include process.h, signal.h, dir.h and utime.h for DJGPP.
(DIR_SEPARATOR) define to '\\' for DJGPP.
(__gnat_get_maximum_file_name_length): decide return value depending on
availability of LFN for DJGPP
(__gnat_get_file_names_case_sensitive): return 0 for DJGPP unless
overriden in environment
(__gnat_get_default_identifier_character_set): return '1' for DJGPP
(__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.
Signed-off-by: Andris Pavenis <andris.pavenis@iki.fi>
---
gcc/ada/adaint.c | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index f317865..1658acf 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -165,11 +165,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>
@@ -538,7 +543,11 @@ __gnat_try_lock (char *dir, char *file)
int
__gnat_get_maximum_file_name_length (void)
{
+#if defined (__DJGPP__)
+ return (_use_lfn(".")) ? -1 : 8;
+#else
return -1;
+#endif
}
/* Return nonzero if file names are case sensitive. */
@@ -560,7 +569,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
@@ -576,7 +585,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;
@@ -586,7 +595,11 @@ __gnat_get_env_vars_case_sensitive (void)
char
__gnat_get_default_identifier_character_set (void)
{
+#if defined (__DJGPP__)
+ return 'p';
+#else
return '1';
+#endif
}
/* Return the current working directory. */
@@ -1646,7 +1659,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
);
@@ -2234,7 +2247,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);
@@ -2606,6 +2619,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;
@@ -2649,6 +2668,7 @@ __gnat_portable_wait (int *process_status)
pid = win32_wait (&status);
+#elif defined (__DJGPP__)
#else
pid = waitpid (-1, &status, 0);
--
2.7.4