OSDN Git Service

* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Factor out
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-oscons-tmplt.c
index e6e1849..48938d9 100644 (file)
@@ -58,7 +58,7 @@ pragma Style_Checks ("M32766");
  **  s-oscons-tmpl.s.
  **
  **  The default one assumes that the template can be compiled by the newly-
- **  build cross compiler. It uses markup produced in the (pseudo-)assembly
+ **  built cross compiler. It uses markup produced in the (pseudo-)assembly
  **  listing:
  **
  **     xgcc -DTARGET=\"$target\" -C -E s-oscons-tmplt.c > s-oscons-tmplt.i
@@ -76,11 +76,19 @@ pragma Style_Checks ("M32766");
  **  $ DEFINE/USER SYS$OUTPUT s-oscons-tmplt.s
  **  $ RUN s-oscons-tmplt
  **  $ RUN xoscons
- **
  **/
 
-#ifndef TARGET
-# error Please define TARGET
+#if defined (__linux__) && !defined (_XOPEN_SOURCE)
+/** For Linux _XOPEN_SOURCE must be defined, otherwise IOV_MAX is not defined
+ **/
+#define _XOPEN_SOURCE 500
+
+#elif defined (__mips) && defined (__sgi)
+/** For IRIX _XOPEN5 must be defined and _XOPEN_IOV_MAX must be used as IOV_MAX,
+ ** otherwise IOV_MAX is not defined.
+ **/
+#define _XOPEN5
+#define IOV_MAX _XOPEN_IOV_MAX
 #endif
 
 #include <stdlib.h>
@@ -93,8 +101,38 @@ pragma Style_Checks ("M32766");
 # define HAVE_TERMIOS
 #endif
 
+#if defined (__vxworks)
+
+/**
+ ** For VxWorks, always include vxWorks.h (gsocket.h provides it only for
+ ** the case of runtime libraries that support sockets).
+ **/
+
+# include <vxWorks.h>
+#endif
+
 #include "gsocket.h"
 
+#ifdef DUMMY
+
+# if defined (TARGET)
+#   error TARGET may not be defined when generating the dummy version
+# else
+#   define TARGET "batch runtime compilation (dummy values)"
+# endif
+
+# if !(defined (HAVE_SOCKETS) && defined (HAVE_TERMIOS))
+#   error Features missing on platform
+# endif
+
+# define NATIVE
+
+#endif
+
+#ifndef TARGET
+# error Please define TARGET
+#endif
+
 #ifndef HAVE_SOCKETS
 # include <errno.h>
 #endif
@@ -109,8 +147,16 @@ pragma Style_Checks ("M32766");
 
 #ifdef NATIVE
 #include <stdio.h>
+
+#ifdef DUMMY
+int counter = 0;
+# define _VAL(x) counter++
+#else
+# define _VAL(x) x
+#endif
+
 #define CND(name,comment) \
-  printf ("\n->CND:$%d:" #name ":$%d:" comment, __LINE__, ((int) name));
+  printf ("\n->CND:$%d:" #name ":$%d:" comment, __LINE__, ((int) _VAL (name)));
 
 #define CNS(name,comment) \
   printf ("\n->CNS:$%d:" #name ":" name ":" comment, __LINE__);
@@ -137,6 +183,9 @@ pragma Style_Checks ("M32766");
 
 #endif
 
+#define STR(x) STR1(x)
+#define STR1(x) #x
+
 #ifdef __MINGW32__
 unsigned int _CRT_fmode = _O_BINARY;
 #endif
@@ -180,6 +229,25 @@ package System.OS_Constants is
 
 /*
 
+   -----------------------------
+   -- 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 := " TARGET_OS ";")
+/*
+
    -------------------
    -- System limits --
    -------------------
@@ -471,6 +539,11 @@ CND(EPROTONOSUPPORT, "Unknown protocol")
 #endif
 CND(EPROTOTYPE, "Unknown protocol type")
 
+#ifndef ERANGE
+# define ERANGE -1
+#endif
+CND(ERANGE, "Result too large")
+
 #ifndef ESHUTDOWN
 # define ESHUTDOWN -1
 #endif
@@ -1152,6 +1225,19 @@ TXT("   subtype H_Length_T   is Interfaces.C." h_length_t ";")
 
 /*
 
+   --  Fields of struct msghdr
+*/
+
+#if defined (__sun__) || defined (__hpux__)
+# define msg_iovlen_t "int"
+#else
+# define msg_iovlen_t "size_t"
+#endif
+
+TXT("   subtype Msg_Iovlen_T is Interfaces.C." msg_iovlen_t ";")
+
+/*
+
    ----------------------------------------
    -- Properties of supported interfaces --
    ----------------------------------------
@@ -1168,15 +1254,25 @@ CND(Has_Sockaddr_Len,  "Sockaddr has sa_len field")
 TXT("   Thread_Blocking_IO  : constant Boolean := True;")
 /*
    --  Set False for contexts where socket i/o are process blocking
+
 */
 
+#ifdef HAVE_INET_PTON
+# define Inet_Pton_Linkname "inet_pton"
+#else
+# define Inet_Pton_Linkname "__gnat_inet_pton"
+#endif
+TXT("   Inet_Pton_Linkname  : constant String := \"" Inet_Pton_Linkname "\";")
+
 #endif /* HAVE_SOCKETS */
 
 /**
  **  System-specific constants follow
+ **  Each section should be activated if compiling for the corresponding
+ **  platform *or* generating the dummy version for runtime test compilation.
  **/
 
-#ifdef __vxworks
+#if defined (__vxworks) || defined (DUMMY)
 
 /*
 
@@ -1193,7 +1289,7 @@ CND(ERROR, "VxWorks generic error")
 
 #endif
 
-#ifdef __MINGW32__
+#if defined (__MINGW32__) || defined (DUMMY)
 /*
 
    ------------------------------
@@ -1215,7 +1311,7 @@ CND(WSAEDISCON,         "Disconnected")
    putchar ('\n');
 #endif
 
-#ifdef __APPLE__
+#if defined (__APPLE__) || defined (DUMMY)
 /*
 
    -------------------------------