public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITED] ada: Deconstruct build support for ancient MinGW
@ 2022-09-26  9:13 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2022-09-26  9:13 UTC (permalink / raw)
  To: gcc-patches; +Cc: Piotr Trojanek

From: Piotr Trojanek <trojanek@adacore.com>

Remove conditional C code for building GNAT with MinGW earlier than 2.0,
which was released in 2007.

gcc/ada/

	* adaint.c: Remove conditional #include directives for old MinGW.
	* cal.c: Always include winsock.h, since it is part of modern
	MinGW.
	* cstreams.c: Remove workaround for old MinGW.
	* expect.c: Remove conditional #include directive for old MinGW.
	* mingw32.h: Remove STD_MINGW and OLD_MINGW declarations.
	* sysdep.c: Remove conditional #include directive for old MinGW.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/adaint.c   | 13 ++-----------
 gcc/ada/cal.c      |  2 --
 gcc/ada/cstreams.c |  8 --------
 gcc/ada/expect.c   |  8 ++------
 gcc/ada/mingw32.h  | 17 -----------------
 gcc/ada/sysdep.c   |  6 +-----
 6 files changed, 5 insertions(+), 49 deletions(-)

diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 2ae4dedeb2b..199dbe0e405 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -200,11 +200,7 @@ UINT __gnat_current_ccs_encoding;
 #endif
 
 /* wait.h processing */
-#ifdef __MINGW32__
-# if OLD_MINGW
-#  include <sys/wait.h>
-# endif
-#elif defined (__vxworks) && defined (__RTP__)
+#if defined (__vxworks) && defined (__RTP__)
 # include <wait.h>
 #elif defined (__Lynx__)
 /* ??? We really need wait.h and it includes resource.h on Lynx.  GCC
@@ -214,7 +210,7 @@ UINT __gnat_current_ccs_encoding;
    preventing the inclusion of the GCC header from doing anything.  */
 # define GCC_RESOURCE_H
 # include <sys/wait.h>
-#elif defined (__PikeOS__)
+#elif defined (__PikeOS__) || defined (__MINGW32__)
 /* No wait() or waitpid() calls available.  */
 #else
 /* Default case.  */
@@ -335,11 +331,6 @@ const char *__gnat_library_template = GNAT_LIBRARY_TEMPLATE;
 
 #if defined (__MINGW32__)
 #include "mingw32.h"
-
-#if OLD_MINGW
-#include <sys/param.h>
-#endif
-
 #else
 #include <sys/param.h>
 #endif
diff --git a/gcc/ada/cal.c b/gcc/ada/cal.c
index e1ab6922b89..09bcc15c4b3 100644
--- a/gcc/ada/cal.c
+++ b/gcc/ada/cal.c
@@ -53,10 +53,8 @@
 
 #ifdef __MINGW32__
 #include "mingw32.h"
-#if STD_MINGW
 #include <winsock.h>
 #endif
-#endif
 
 void
 __gnat_timeval_to_duration (struct timeval *t, long long *sec, long *usec)
diff --git a/gcc/ada/cstreams.c b/gcc/ada/cstreams.c
index 10cc3a6faf8..fc583e17004 100644
--- a/gcc/ada/cstreams.c
+++ b/gcc/ada/cstreams.c
@@ -97,14 +97,6 @@ extern "C" {
 #undef fileno
 #endif
 
-/* The _IONBF value in MINGW32 stdio.h is wrong.  */
-#if defined (WINNT) || defined (_WINNT)
-#if OLD_MINGW
-#undef _IONBF
-#define _IONBF 0004
-#endif
-#endif
-
 int
 __gnat_feof (FILE *stream)
 {
diff --git a/gcc/ada/expect.c b/gcc/ada/expect.c
index b1889feff37..48fb1076e91 100644
--- a/gcc/ada/expect.c
+++ b/gcc/ada/expect.c
@@ -42,17 +42,13 @@
 #include "adaint.h"
 #include <sys/types.h>
 
-#ifdef __MINGW32__
-# if OLD_MINGW
-#  include <sys/wait.h>
-# endif
-#elif defined (__vxworks) && defined (__RTP__)
+#if defined (__vxworks) && defined (__RTP__)
 # include <wait.h>
 #elif defined (__Lynx__)
   /* ??? See comment in adaint.c.  */
 # define GCC_RESOURCE_H
 # include <sys/wait.h>
-#elif defined (__PikeOS__)
+#elif defined (__PikeOS__) || defined (__MINGW32__)
   /* No wait.h available */
 #else
 #include <sys/wait.h>
diff --git a/gcc/ada/mingw32.h b/gcc/ada/mingw32.h
index 1157fc68018..bf8577bb1d4 100644
--- a/gcc/ada/mingw32.h
+++ b/gcc/ada/mingw32.h
@@ -101,23 +101,6 @@ extern UINT __gnat_current_ccs_encoding;
 
 #include <stdlib.h>
 
-/* STD_MINGW: standard if MINGW32 version > 1.3, we have switched to this
-   version instead of the previous enhanced version to ease building GNAT on
-   Windows platforms. By using STD_MINGW or OLD_MINGW it is possible to build
-   GNAT using both MingW include files (Old MingW + ACT changes and standard
-   MingW starting with version 1.3.
-   For w64 Mingw the define STD_MINGW is always set to value 1, because
-   there is no old header set present.  */
-#ifdef _WIN64
-#define STD_MINGW 1
-#else
-#define STD_MINGW ((__MINGW32_MAJOR_VERSION == 1 \
-		   && __MINGW32_MINOR_VERSION >= 3) \
-     || (__MINGW32_MAJOR_VERSION >= 2))
-#endif
-
-#define OLD_MINGW (!(STD_MINGW))
-
 #ifndef MAXPATHLEN
 #define MAXPATHLEN MAX_PATH
 #endif
diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c
index 5e9cf709082..7bdfcbc047c 100644
--- a/gcc/ada/sysdep.c
+++ b/gcc/ada/sysdep.c
@@ -323,11 +323,7 @@ __gnat_ttyname (int filedes ATTRIBUTE_UNUSED)
   || defined (__QNX__)
 
 # ifdef __MINGW32__
-#  if OLD_MINGW
-#   include <termios.h>
-#  else
-#   include <conio.h>  /* for getch(), kbhit() */
-#  endif
+#  include <conio.h>  /* for getch(), kbhit() */
 # else
 #  include <termios.h>
 # endif
-- 
2.25.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-26  9:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-26  9:13 [COMMITED] ada: Deconstruct build support for ancient MinGW Marc Poulhiès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).