From 59f3dd0a14fa4d4ce7ee142068cf9c5e376efc27 Mon Sep 17 00:00:00 2001
From: Arnaud Charlet <charlet@gcc.gnu.org>
Date: Thu, 9 Apr 2009 14:57:47 +0200
Subject: [PATCH] [multiple changes]

2009-04-09  Robert Dewar  <dewar@adacore.com>

	* sem_ch5.adb: Minor reformatting

2009-04-09  Vincent Celier  <celier@adacore.com>

	* vms_data.ads:
	Change GNAT CHECK qualifier /DIAGNOSIS_LIMIT to /DIAGNOSTIC_LIMIT
	New qualifier /LEXPAND_SOURCE=nnn for -gnatGnnn
	New qualifier /LXDEBUG=nnn for -gnatDnnn
	For H820-010

	* gnat_ugn.texi:
	Update documentation for VMS qualifiers equivalent to -gnatGnn and
	-gnatDnn

2009-04-09  Nicolas Setton  <setton@adacore.com>

	* s-osinte-darwin.ads: (Pad_Type): Make this an array of unsigned_long,
	to match layout of siginfo_t in sys/signal.h.

	* gcc-interface/Makefile.in: Add section for x86_64 darwin.

2009-04-09  Thomas Quinot  <quinot@adacore.com>

	* g-socket.ads: (Fd_Set): Use Interfaces.C.long alignment.

2009-04-09  Nicolas Setton  <setton@adacore.com>

	* s-oscons-tmplt.c: Allow long lines in the generated spec.
	Add generation of Darwin-specific constants needed when binding to the
	pthread library.

From-SVN: r145837
---
 gcc/ada/ChangeLog                 | 47 +++++++++++++++++++++++++++++++
 gcc/ada/g-socket.ads              |  2 +-
 gcc/ada/gcc-interface/Makefile.in | 20 ++++++++++++-
 gcc/ada/gnat_ugn.texi             | 14 +++++++--
 gcc/ada/s-oscons-tmplt.c          | 47 +++++++++++++++++++++++++++++++
 gcc/ada/s-osinte-darwin.ads       | 15 +++++-----
 gcc/ada/sem_ch5.adb               |  4 +--
 gcc/ada/vms_data.ads              | 47 +++++++++++++++++++++++--------
 8 files changed, 171 insertions(+), 25 deletions(-)

diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 0d2b8a06d28f..191ef1a55467 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,50 @@
+2009-04-09  Robert Dewar  <dewar@adacore.com>
+
+	* sem_ch5.adb: Minor reformatting
+
+2009-04-09  Vincent Celier  <celier@adacore.com>
+
+	* vms_data.ads:
+	Change GNAT CHECK qualifier /DIAGNOSIS_LIMIT to /DIAGNOSTIC_LIMIT
+	New qualifier /LEXPAND_SOURCE=nnn for -gnatGnnn
+	New qualifier /LXDEBUG=nnn for -gnatDnnn
+	For H820-010
+
+	* gnat_ugn.texi:
+	Update documentation for VMS qualifiers equivalent to -gnatGnn and
+	-gnatDnn
+
+2009-04-09  Nicolas Setton  <setton@adacore.com>
+
+	* s-osinte-darwin.ads: (Pad_Type): Make this an array of unsigned_long,
+	to match layout of siginfo_t in sys/signal.h.
+
+	* gcc-interface/Makefile.in: Add section for x86_64 darwin.
+
+2009-04-09  Thomas Quinot  <quinot@adacore.com>
+
+	* g-socket.ads: (Fd_Set): Use Interfaces.C.long alignment.
+
+2009-04-09  Nicolas Setton  <setton@adacore.com>
+
+	* s-oscons-tmplt.c: Allow long lines in the generated spec.
+	Add generation of Darwin-specific constants needed when binding to the
+	pthread library.
+
+2009-04-09  Robert Dewar  <dewar@adacore.com>
+
+        * checks.adb:
+        (Insert_Valid_Check): Avoid unnecessary generation of junk declaration
+        when no invalid values exist, Avoid duplicate read of atomic variable.
+
+        * cstand.adb (Build_Signed_Integer_Type): Set Is_Known_Valid
+        (Standard_Unsigned): Set Is_Known_Valid
+
+        * sem_ch3.adb (Analyze_Subtype_Declaration): Copy Is_Known_Valid on
+	subtype declaration if no constraint.
+        (Set_Modular_Size): Set Is_Known_Valid if appropriate
+        (Build_Derived_Numeric_Type): Copy Is_Known_Valid if no constraint
+
 2009-04-09  Robert Dewar  <dewar@adacore.com>
 
 	* switch-c.adb, gnat_ugn.texi, vms_data.ads, switch.adb,
diff --git a/gcc/ada/g-socket.ads b/gcc/ada/g-socket.ads
index 39107783eb14..eab3c301c9ec 100644
--- a/gcc/ada/g-socket.ads
+++ b/gcc/ada/g-socket.ads
@@ -1095,7 +1095,7 @@ private
 
    type Fd_Set is
      new System.Storage_Elements.Storage_Array (1 .. SOSC.SIZEOF_fd_set);
-   for Fd_Set'Alignment use Interfaces.C.int'Alignment;
+   for Fd_Set'Alignment use Interfaces.C.long'Alignment;
 
    type Fd_Set_Access is access all Fd_Set;
    pragma Convention (C, Fd_Set_Access);
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index c431118608e0..8d0d92c57070 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -1729,7 +1729,25 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),)
       LIBGNAT_TARGET_PAIRS += \
       system.ads<system-darwin-x86.ads
     endif
-  else
+  endif
+
+  ifeq ($(strip $(filter-out %x86_64,$(arch))),)
+    LIBGNAT_TARGET_PAIRS = \
+    a-intnam.ads<a-intnam-darwin.ads \
+    s-inmaop.adb<s-inmaop-posix.adb \
+    s-intman.adb<s-intman-posix.adb \
+    s-osinte.adb<s-osinte-darwin.adb \
+    s-osinte.ads<s-osinte-darwin.ads \
+    s-osprim.adb<s-osprim-posix.adb \
+    s-taprop.adb<s-taprop-posix.adb \
+    s-taspri.ads<s-taspri-posix.ads \
+    s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+    a-numaux.ads<a-numaux-x86.ads \
+    a-numaux.adb<a-numaux-x86.adb \
+    system.ads<system-darwin-x86_64.ads
+  endif
+
+  ifeq ($(strip $(filter-out powerpc%,$(arch))),)
     LIBGNAT_TARGET_PAIRS = \
     a-intnam.ads<a-intnam-darwin.ads \
     s-inmaop.adb<s-inmaop-posix.adb \
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index 9275c22506c2..f21095365dbd 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -3882,8 +3882,13 @@ debug options. Certain debug options are relevant to applications
 programmers, and these are documented at appropriate points in this
 users guide.
 
+@ifclear vms
 @item -gnatD
 @cindex @option{-gnatD[nn]} (@command{gcc})
+@end ifclear
+@ifset vms
+@item /XDEBUG /LXDEBUG=nnn
+@end ifset
 Create expanded source files for source level debugging. This switch
 also suppress generation of cross-reference information
 (see @option{-gnatx}).
@@ -3949,8 +3954,13 @@ Note that @option{^-gnatg^/GNAT_INTERNAL^} implies
 so that all standard warnings and all standard style options are turned on.
 All warnings and style error messages are treated as errors.
 
+@ifclear vms
 @item -gnatG=nn
 @cindex @option{-gnatG[nn]} (@command{gcc})
+@end ifclear
+@ifset vms
+@item /EXPAND_SOURCE, /LEXPAND_SOURCE=nnn
+@end ifset
 List generated expanded code in source form.
 
 @item ^-gnath^/HELP^
@@ -20362,8 +20372,8 @@ a generic instantiation a full source location is a chain from the location
 of this construct in the generic unit to the place where this unit is
 instantiated.
 
-@cindex @option{^-m^/DIAGNOSIS_LIMIT^} (@command{gnatcheck})
-@item ^-m@i{nnn}^/DIAGNOSIS_LIMIT=@i{nnn}^
+@cindex @option{^-m^/DIAGNOSTIC_LIMIT^} (@command{gnatcheck})
+@item ^-m@i{nnn}^/DIAGNOSTIC_LIMIT=@i{nnn}^
 Maximum number of diagnoses to be sent to Stdout, @i{nnn} from o@dots{}1000,
 the default value is 500. Zero means that there is no limitation on
 the number of diagnostic messages to be printed into Stdout.
diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c
index 8298f7526def..625f1e01cec2 100644
--- a/gcc/ada/s-oscons-tmplt.c
+++ b/gcc/ada/s-oscons-tmplt.c
@@ -32,6 +32,9 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
+pragma Style_Checks ("M32766");
+--  Allow long lines
+
 */
 
 /**
@@ -102,6 +105,10 @@
 # include <termios.h>
 #endif
 
+#ifdef __APPLE__
+# include <_types.h>
+#endif
+
 #ifdef NATIVE
 #include <stdio.h>
 #define CND(name,comment) \
@@ -1205,6 +1212,46 @@ CND(WSAEDISCON,         "Disconnected")
    putchar ('\n');
 #endif
 
+#ifdef __APPLE__
+/*
+
+   -------------------------------
+   -- Darwin-specific constants --
+   -------------------------------
+
+   --  These constants may be used only within the Darwin version of the GNAT
+   --  runtime library.
+*/
+
+#define PTHREAD_SIZE __PTHREAD_SIZE__
+CND(PTHREAD_SIZE, "Pad in pthread_t")
+
+#define PTHREAD_ATTR_SIZE __PTHREAD_ATTR_SIZE__
+CND(PTHREAD_ATTR_SIZE, "Pad in pthread_attr_t")
+
+#define PTHREAD_MUTEXATTR_SIZE __PTHREAD_MUTEXATTR_SIZE__
+CND(PTHREAD_MUTEXATTR_SIZE, "Pad in pthread_mutexattr_t")
+
+#define PTHREAD_MUTEX_SIZE __PTHREAD_MUTEX_SIZE__
+CND(PTHREAD_MUTEX_SIZE, "Pad in pthread_mutex_t")
+
+#define PTHREAD_CONDATTR_SIZE __PTHREAD_CONDATTR_SIZE__
+CND(PTHREAD_CONDATTR_SIZE, "Pad in pthread_condattr_t")
+
+#define PTHREAD_COND_SIZE __PTHREAD_COND_SIZE__
+CND(PTHREAD_COND_SIZE, "Pad in pthread_cond_t")
+
+#define PTHREAD_RWLOCKATTR_SIZE __PTHREAD_RWLOCKATTR_SIZE__
+CND(PTHREAD_RWLOCKATTR_SIZE, "Pad in pthread_rwlockattr_t")
+
+#define PTHREAD_RWLOCK_SIZE __PTHREAD_RWLOCK_SIZE__
+CND(PTHREAD_RWLOCK_SIZE, "Pad in pthread_rwlock_t")
+
+#define PTHREAD_ONCE_SIZE __PTHREAD_ONCE_SIZE__
+CND(PTHREAD_ONCE_SIZE, "Pad in pthread_once_t")
+
+#endif
+
 /*
 
 end System.OS_Constants;
diff --git a/gcc/ada/s-osinte-darwin.ads b/gcc/ada/s-osinte-darwin.ads
index d53e2c43dcab..2a3b9282b52a 100644
--- a/gcc/ada/s-osinte-darwin.ads
+++ b/gcc/ada/s-osinte-darwin.ads
@@ -41,6 +41,7 @@
 --  Elaborate_Body. It is designed to be a bottom-level (leaf) package.
 
 with Interfaces.C;
+with System.OS_Constants;
 
 package System.OS_Interface is
    pragma Preelaborate;
@@ -532,7 +533,7 @@ private
    --
    --  Darwin specific signal implementation
    --
-   type Pad_Type is array (1 .. 7) of unsigned;
+   type Pad_Type is array (1 .. 7) of unsigned_long;
    type siginfo_t is record
       si_signo  : int;               --  signal number
       si_errno  : int;               --  errno association
@@ -568,37 +569,37 @@ private
 
    type pthread_attr_t is record
       sig    : long;
-      opaque : padding (1 .. 36);
+      opaque : padding (1 .. System.OS_Constants.PTHREAD_ATTR_SIZE);
    end record;
    pragma Convention (C, pthread_attr_t);
 
    type pthread_mutexattr_t is record
       sig    : long;
-      opaque : padding (1 .. 8);
+      opaque : padding (1 .. System.OS_Constants.PTHREAD_MUTEXATTR_SIZE);
    end record;
    pragma Convention (C, pthread_mutexattr_t);
 
    type pthread_mutex_t is record
       sig    : long;
-      opaque : padding (1 .. 40);
+      opaque : padding (1 .. System.OS_Constants.PTHREAD_MUTEX_SIZE);
    end record;
    pragma Convention (C, pthread_mutex_t);
 
    type pthread_condattr_t is record
       sig    : long;
-      opaque : padding (1 .. 4);
+      opaque : padding (1 .. System.OS_Constants.PTHREAD_CONDATTR_SIZE);
    end record;
    pragma Convention (C, pthread_condattr_t);
 
    type pthread_cond_t is record
       sig    : long;
-      opaque : padding (1 .. 24);
+      opaque : padding (1 .. System.OS_Constants.PTHREAD_COND_SIZE);
    end record;
    pragma Convention (C, pthread_cond_t);
 
    type pthread_once_t is record
       sig    : long;
-      opaque : padding (1 .. 4);
+      opaque : padding (1 .. System.OS_Constants.PTHREAD_ONCE_SIZE);
    end record;
    pragma Convention (C, pthread_once_t);
 
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index 6ae5d7f4645b..6a387d6fc31e 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -88,8 +88,8 @@ package body Sem_Ch5 is
       Decl : Node_Id;
 
       procedure Diagnose_Non_Variable_Lhs (N : Node_Id);
-      --  N is the node for the left hand side of an assignment, and it
-      --  is not a variable. This routine issues an appropriate diagnostic.
+      --  N is the node for the left hand side of an assignment, and it is not
+      --  a variable. This routine issues an appropriate diagnostic.
 
       procedure Kill_Lhs;
       --  This is called to kill current value settings of a simple variable
diff --git a/gcc/ada/vms_data.ads b/gcc/ada/vms_data.ads
index 290976591aad..ada55a30a0b5 100644
--- a/gcc/ada/vms_data.ads
+++ b/gcc/ada/vms_data.ads
@@ -774,16 +774,16 @@ package VMS_Data is
    --
    --   Use full source locations references in the report file.
 
-   S_Diagnosis   : aliased constant S := "/DIAGNOSIS_LIMIT=#"              &
+   S_Diagnosis   : aliased constant S := "/DIAGNOSTIC_LIMIT=#"             &
                                             "-m#";
-   --        /DIAGNOSIS_LIMIT=500 (D)
-   --        /ERROR_LIMIT=nnn
+   --        /DIAGNOSTIC_LIMIT=500 (D)
+   --        /DIAGNOSTIC_LIMIT=nnn
    --
    --   NNN is a decimal integer in the range of 1 to 1000 and limits the
    --   number of diagnostic messages to be generated into Stdout to that
    --   number.  Once that number has been reached, gnatcheck stops
    --   to print out diagnoses into Stderr. If NNN is equal to 0, this means
-   --  that there is no limit on the number of diagnoses in Stdout
+   --   that there is no limit on the number of diagnoses in Stdout.
 
    S_Check_Mess    : aliased constant S := "/MESSAGES_PROJECT_FILE="       &
                                              "DEFAULT "                    &
@@ -1484,15 +1484,23 @@ package VMS_Data is
                                             "-gnatm999999";
    --  NODOC (see /ERROR_LIMIT)
 
-   S_GCC_Expand  : aliased constant S := "/EXPAND_SOURCE=#"                 &
+   S_GCC_Expand  : aliased constant S := "/EXPAND_SOURCE "                 &
                                             "-gnatG";
-   --        /NOEXPAND_SOURCE[=nnn] (D)
+   --        /NOEXPAND_SOURCE (D)
    --        /EXPAND_SOURCE
    --
    --   Produces a listing of the expanded code in Ada source form. For
    --   example, all tasking constructs are reduced to appropriate run-time
+   --   library calls. The maximum line length for the listing 72.
+
+   S_GCC_Lexpand : aliased constant S := "/LEXPAND_SOURCE=#"               &
+                                            "-gnatG#";
+   --        /LEXPAND_SOURCE=nnn
+   --
+   --   Produces a listing of the expanded code in Ada source form. For
+   --   example, all tasking constructs are reduced to appropriate run-time
    --   library calls. The parameter is the maximum line length for the
-   --   listing (default is 72).
+   --   listing.
 
    S_GCC_Extend  : aliased constant S := "/EXTENSIONS_ALLOWED "            &
                                             "-gnatX";
@@ -3330,9 +3338,9 @@ package VMS_Data is
                                              "-gnatWn";
    --  NODOC (see /WIDE_CHARACTER_ENCODING)
 
-   S_GCC_Xdebug  : aliased constant S := "/XDEBUG=#"                        &
-                                             "-gnatD";
-   --        /NOXDEBUG[=nnn] (D)
+   S_GCC_Xdebug  : aliased constant S := "/XDEBUG "                        &
+                                            "-gnatD";
+   --        /NOXDEBUG (D)
    --        /XDEBUG
    --
    --   Output expanded source files for source level debugging.
@@ -3342,8 +3350,21 @@ package VMS_Data is
    --   refer to the generated file. This allows source level debugging using
    --   the generated code which is sometimes useful for complex code, for
    --   example to find out exactly which part of a complex construction
-   --   raised an exception. The parameter if present is the maximum line
-   --   length for the output (default 72).
+   --   raised an exception. The maximum line length for the output is 72.
+
+   S_GCC_Lxdebug : aliased constant S := "/LXDEBUG=#"                      &
+                                            "-gnatD=#";
+   --        /LXDEBUG=nnn
+   --
+   --   Output expanded source files for source level debugging.
+   --   The expanded source (see /EXPAND_SOURCE) is written to files
+   --   with names formed by appending "_DG" to the input file name,
+   --   The debugging information generated by the /DEBUG qualifier will then
+   --   refer to the generated file. This allows source level debugging using
+   --   the generated code which is sometimes useful for complex code, for
+   --   example to find out exactly which part of a complex construction
+   --   raised an exception. The parameter is the maximum line length for
+   --   the output.
 
    S_GCC_Xref    : aliased constant S := "/XREF="                          &
                                             "GENERATE "                    &
@@ -3383,6 +3404,7 @@ package VMS_Data is
                      S_GCC_Error   'Access,
                      S_GCC_ErrorX  'Access,
                      S_GCC_Expand  'Access,
+                     S_GCC_Lexpand 'Access,
                      S_GCC_Extend  'Access,
                      S_GCC_Ext     'Access,
                      S_GCC_File    'Access,
@@ -3446,6 +3468,7 @@ package VMS_Data is
                      S_GCC_No_Back 'Access,
                      S_GCC_All_Back'Access,
                      S_GCC_Xdebug  'Access,
+                     S_GCC_Lxdebug 'Access,
                      S_GCC_Xref    'Access);
 
    ----------------------------
-- 
GitLab