summarylogtreecommitdiffstats
path: root/gcc-7.3.0-djgpp.diff
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-7.3.0-djgpp.diff')
-rw-r--r--gcc-7.3.0-djgpp.diff356
1 files changed, 356 insertions, 0 deletions
diff --git a/gcc-7.3.0-djgpp.diff b/gcc-7.3.0-djgpp.diff
new file mode 100644
index 000000000000..463d634b6d6e
--- /dev/null
+++ b/gcc-7.3.0-djgpp.diff
@@ -0,0 +1,356 @@
+diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
+index bff875a6822..fc06ee7b663 100644
+--- a/gcc/ada/adaint.c
++++ b/gcc/ada/adaint.c
+@@ -549,7 +549,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. */
+@@ -623,6 +627,17 @@ __gnat_get_current_dir (char *dir, int *length)
+ dir [*length] = DIR_SEPARATOR;
+ ++(*length);
+ }
++#ifdef __DJGPP__
++ do {
++ char *w;
++ for (w = dir; *w; ++w)
++ {
++ if (*w == '/') {
++ *w = '\\';
++ }
++ }
++ } while (0);
++#endif /* __DJGPP__ */
+ dir[*length] = '\0';
+ }
+
+diff --git a/gcc/ada/s-os_lib.adb b/gcc/ada/s-os_lib.adb
+index 36064e97bd3..18bfb484074 100644
+--- a/gcc/ada/s-os_lib.adb
++++ b/gcc/ada/s-os_lib.adb
+@@ -71,7 +71,7 @@ package body System.OS_Lib is
+
+ -- The following are used by Create_Temp_File
+
+- First_Temp_File_Name : constant String := "GNAT-TEMP-000000.TMP";
++ First_Temp_File_Name : constant String := "GA000000.TMP";
+ -- Used to initialize Current_Temp_File_Name and Temp_File_Name_Last_Digit
+
+ Current_Temp_File_Name : String := First_Temp_File_Name;
+diff --git a/gcc/ginclude/float.h b/gcc/ginclude/float.h
+index 658017fd63a..e6504b94d07 100644
+--- a/gcc/ginclude/float.h
++++ b/gcc/ginclude/float.h
+@@ -25,6 +25,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ * ISO C Standard: 5.2.4.2.2 Characteristics of floating types <float.h>
+ */
+
++#ifdef __DJGPP__
++#include_next <float.h>
++#endif
++
+ #ifndef _FLOAT_H___
+ #define _FLOAT_H___
+
+diff --git a/include/libiberty.h b/include/libiberty.h
+index 7a796124bf5..0eb73f6650b 100644
+--- a/include/libiberty.h
++++ b/include/libiberty.h
+@@ -108,6 +108,7 @@ extern int countargv (char * const *);
+ #if defined (__GNU_LIBRARY__ ) || defined (__linux__) \
+ || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) \
+ || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) \
++ || defined (__DJGPP__) \
+ || defined (__DragonFly__) || defined (HAVE_DECL_BASENAME)
+ extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1);
+ #else
+diff --git a/libcpp/files.c b/libcpp/files.c
+index 969a531033f..3c07d60a62c 100644
+--- a/libcpp/files.c
++++ b/libcpp/files.c
+@@ -740,6 +740,10 @@ read_file_guts (cpp_reader *pfile, _cpp_file *file, source_location loc)
+ cpp_error_at (pfile, CPP_DL_WARNING, loc,
+ "%s is shorter than expected", file->path);
+
++/* For DOS we should handle DOS EOF character (0x1A, ^Z). It is
++ only done if it is really the last character of the file */
++ if (total>0 && buf[total-1]==0x1A) total--;
++
+ file->buffer = _cpp_convert_input (pfile,
+ CPP_OPTION (pfile, input_charset),
+ buf, size + 16, total,
+diff --git a/libgfortran/intrinsics/chmod.c b/libgfortran/intrinsics/chmod.c
+index d08418d773f..109e15ff3ab 100644
+--- a/libgfortran/intrinsics/chmod.c
++++ b/libgfortran/intrinsics/chmod.c
+@@ -443,7 +443,7 @@ clause_done:
+ if ((ugo[2] || honor_umask) && !rwxXstugo[8])
+ file_mode = (file_mode & ~(S_IROTH | S_IWOTH | S_IXOTH))
+ | (new_mode & (S_IROTH | S_IWOTH | S_IXOTH));
+-#ifndef __VXWORKS__
++#if !defined(__VXWORKS__) && !defined(__DJGPP__)
+ if (is_dir && rwxXstugo[5])
+ file_mode |= S_ISVTX;
+ else if (!is_dir)
+@@ -455,7 +455,7 @@ clause_done:
+ {
+ /* Clear '-'. */
+ file_mode &= ~new_mode;
+-#if !defined( __MINGW32__) && !defined (__VXWORKS__)
++#if !defined( __MINGW32__) && !defined (__VXWORKS__) && !defined(__DJGPP__)
+ if (rwxXstugo[5] || !is_dir)
+ file_mode &= ~S_ISVTX;
+ #endif
+@@ -463,7 +463,7 @@ clause_done:
+ else if (set_mode == 3)
+ {
+ file_mode |= new_mode;
+-#if !defined (__MINGW32__) && !defined (__VXWORKS__)
++#if !defined (__MINGW32__) && !defined (__VXWORKS__) && !defined(__DJGPP__)
+ if (rwxXstugo[5] && is_dir)
+ file_mode |= S_ISVTX;
+ else if (!is_dir)
+diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
+index bb9bc9a5c12..79d25e1ebe0 100644
+--- a/libgfortran/io/unix.c
++++ b/libgfortran/io/unix.c
+@@ -210,6 +210,9 @@ typedef struct
+ }
+ unix_stream;
+
++#ifdef __DJGPP__
++#include <io.h>
++#endif
+
+ /* fix_fd()-- Given a file descriptor, make sure it is not one of the
+ standard descriptors, returning a non-standard descriptor. If the
+@@ -1187,8 +1190,13 @@ tempfile_open (const char *tempdir, char **fname)
+ char *template = xmalloc (tempdirlen + 23);
+
+ #ifdef HAVE_MKSTEMP
++#ifdef __DJGPP__
++ /* Default filename is too long for DOS */
++ snprintf (template, tempdirlen + 23, "%s/gfXXXXXX", tempdir);
++#else
+ snprintf (template, tempdirlen + 23, "%s%sgfortrantmpXXXXXX",
+ tempdir, slash);
++#endif
+
+ #ifdef HAVE_UMASK
+ /* Temporarily set the umask such that the file has 0600 permissions. */
+@@ -1554,6 +1562,13 @@ open_external (st_parameter_open *opp, unit_flags *flags)
+ return NULL;
+ fd = fix_fd (fd);
+
++#ifdef __DJGPP__
++ if (flags->form == FORM_UNFORMATTED)
++ {
++ setmode (fd, O_BINARY);
++ }
++#endif
++
+ if (open_share (opp, fd, flags) < 0)
+ return NULL;
+
+diff --git a/libiberty/make-relative-prefix.c b/libiberty/make-relative-prefix.c
+index f74bbdc9038..4b2020e55b6 100644
+--- a/libiberty/make-relative-prefix.c
++++ b/libiberty/make-relative-prefix.c
+@@ -65,6 +65,7 @@ relative prefix can be found, return @code{NULL}.
+
+ #include "ansidecl.h"
+ #include "libiberty.h"
++#include "filenames.h"
+
+ #ifndef R_OK
+ #define R_OK 4
+@@ -337,7 +338,7 @@ make_relative_prefix_1 (const char *progname, const char *bin_prefix,
+ {
+ for (i = 0; i < bin_num; i++)
+ {
+- if (strcmp (prog_dirs[i], bin_dirs[i]) != 0)
++ if (FILENAME_CMP (prog_dirs[i], bin_dirs[i]) != 0)
+ break;
+ }
+
+@@ -353,7 +354,7 @@ make_relative_prefix_1 (const char *progname, const char *bin_prefix,
+ n = (prefix_num < bin_num) ? prefix_num : bin_num;
+ for (common = 0; common < n; common++)
+ {
+- if (strcmp (bin_dirs[common], prefix_dirs[common]) != 0)
++ if (FILENAME_CMP (bin_dirs[common], prefix_dirs[common]) != 0)
+ break;
+ }
+
+diff --git a/libiberty/make-temp-file.c b/libiberty/make-temp-file.c
+index 98e215d15e7..1c2defad7b1 100644
+--- a/libiberty/make-temp-file.c
++++ b/libiberty/make-temp-file.c
+@@ -47,6 +47,7 @@ Boston, MA 02110-1301, USA. */
+ #endif
+
+ #include "libiberty.h"
++#include "filenames.h"
+ extern int mkstemps (char *, int);
+
+ /* '/' works just fine on MS-DOS based systems. */
+@@ -142,7 +143,8 @@ choose_tmpdir (void)
+ len = strlen (base);
+ tmpdir = XNEWVEC (char, len + 2);
+ strcpy (tmpdir, base);
+- tmpdir[len] = DIR_SEPARATOR;
++ if (len>0 && !IS_DIR_SEPARATOR(tmpdir[len-1]))
++ tmpdir[len] = DIR_SEPARATOR;
+ tmpdir[len+1] = '\0';
+ memoized_tmpdir = tmpdir;
+ #else /* defined(_WIN32) && !defined(__CYGWIN__) */
+diff --git a/libquadmath/printf/quadmath-printf.h b/libquadmath/printf/quadmath-printf.h
+index 32ebcec928c..96498b7c408 100644
+--- a/libquadmath/printf/quadmath-printf.h
++++ b/libquadmath/printf/quadmath-printf.h
+@@ -29,7 +29,8 @@ Boston, MA 02110-1301, USA. */
+ #ifdef HAVE_CTYPE_H
+ #include <ctype.h>
+ #endif
+-#ifdef HAVE_WCHAR_H
++#if defined(HAVE_WCHAR_H) && !defined(__DJGPP__)
++/* DJGPP wchar.h is not good enough */
+ #include <wchar.h>
+ #endif
+ #ifdef HAVE_WCTYPE_H
+@@ -44,7 +45,7 @@ Boston, MA 02110-1301, USA. */
+ #include "quadmath-imp.h"
+ #include "gmp-impl.h"
+
+-#ifdef HAVE_WCHAR_H
++#if defined(HAVE_WCHAR_H) && !defined(__DJGPP__)
+ #define L_(x) L##x
+ #else
+ #define L_(x) x
+diff --git a/libstdc++-v3/config/os/djgpp/error_constants.h b/libstdc++-v3/config/os/djgpp/error_constants.h
+index 4ce342c9626..b89b07cb4be 100644
+--- a/libstdc++-v3/config/os/djgpp/error_constants.h
++++ b/libstdc++-v3/config/os/djgpp/error_constants.h
+@@ -33,6 +33,15 @@
+ #include <bits/c++config.h>
+ #include <cerrno>
+
++#ifndef EOPNOTSUPP
++// Use same value as in wat3222br6.zip file net/watt/sys/djgpp.err
++#define EOPNOTSUPP 52
++#endif
++
++#ifndef ENOTSUP
++#define ENOTSUP 101
++#endif
++
+ namespace std _GLIBCXX_VISIBILITY(default)
+ {
+ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+@@ -118,9 +127,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ // not_connected = ENOTCONN,
+ not_enough_memory = ENOMEM,
+
+-#ifdef _GLIBCXX_HAVE_ENOTSUP
+ not_supported = ENOTSUP,
+-#endif
+
+ #ifdef _GLIBCXX_HAVE_ECANCELED
+ operation_canceled = ECANCELED,
+@@ -128,7 +135,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // operation_in_progress = EINPROGRESS,
+ operation_not_permitted = EPERM,
+-// operation_not_supported = EOPNOTSUPP,
++ operation_not_supported = EOPNOTSUPP,
+ // operation_would_block = EWOULDBLOCK,
+
+ #ifdef _GLIBCXX_HAVE_EOWNERDEAD
+diff --git a/libstdc++-v3/include/experimental/bits/fs_path.h b/libstdc++-v3/include/experimental/bits/fs_path.h
+index 512167f6f2d..de56387511e 100644
+--- a/libstdc++-v3/include/experimental/bits/fs_path.h
++++ b/libstdc++-v3/include/experimental/bits/fs_path.h
+@@ -53,6 +53,11 @@
+ # include <algorithm>
+ #endif
+
++#if defined(__DJGPP__)
++# define _GLIBCXX_FILESYSTEM_IS_DJGPP 1
++# include <algorithm>
++#endif
++
+ namespace std _GLIBCXX_VISIBILITY(default)
+ {
+ namespace experimental
+@@ -460,6 +465,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
+ {
+ #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
+ return __ch == L'/' || __ch == preferred_separator;
++#elif defined(_GLIBCXX_FILESYSTEM_IS_DJGPP)
++ return __ch == '/' || __ch == '\\';
+ #else
+ return __ch == '/';
+ #endif
+@@ -826,6 +833,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
+ #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
+ std::replace(_M_pathname.begin(), _M_pathname.end(), L'/',
+ preferred_separator);
++#elif defined(_GLIBCXX_FILESYSTEM_IS_DJGPP)
++ std::replace(_M_pathname.begin(), _M_pathname.end(), '\\',
++ preferred_separator);
+ #endif
+ return *this;
+ }
+@@ -997,7 +1007,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
+ inline bool
+ path::is_absolute() const
+ {
+-#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
++#if defined(_GLIBCXX_FILESYSTEM_IS_WINDOWS) \
++ || defined(_GLIBCXX_FILESYSTEM_IS_DJGPP)
+ return has_root_name();
+ #else
+ return has_root_directory();
+diff --git a/libstdc++-v3/src/filesystem/ops.cc b/libstdc++-v3/src/filesystem/ops.cc
+index 8de3511346e..9da49f9b233 100644
+--- a/libstdc++-v3/src/filesystem/ops.cc
++++ b/libstdc++-v3/src/filesystem/ops.cc
+@@ -269,8 +269,10 @@ namespace
+ return file_type::fifo;
+ else if (S_ISLNK(st.st_mode))
+ return file_type::symlink;
++#ifdef S_ISSOCK
+ else if (S_ISSOCK(st.st_mode))
+ return file_type::socket;
++#endif // s_ISSOCK
+ #endif
+ return file_type::unknown;
+
+diff --git a/libstdc++-v3/src/filesystem/path.cc b/libstdc++-v3/src/filesystem/path.cc
+index c66d52bf4b0..a4e5f348a24 100644
+--- a/libstdc++-v3/src/filesystem/path.cc
++++ b/libstdc++-v3/src/filesystem/path.cc
+@@ -370,8 +370,13 @@ path::_M_split_cmpts()
+ _M_add_root_dir(0);
+ ++pos;
+ }
+-#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
++#if defined(_GLIBCXX_FILESYSTEM_IS_WINDOWS) \
++ || defined(_GLIBCXX_FILESYSTEM_IS_DJGPP)
++#ifdef __DJGPP__
++ else if (len > 1 && _M_pathname[1] == ':')
++#else
+ else if (len > 1 && _M_pathname[1] == L':')
++#endif
+ {
+ // got disk designator
+ _M_add_root_name(2);
+