From 3984e89a1850369bff1cce7b0ce53ef658e84649 Mon Sep 17 00:00:00 2001
From: Arnaud Charlet <charlet@gcc.gnu.org>
Date: Tue, 6 Apr 2004 16:21:20 +0200
Subject: [PATCH] [multiple changes]

2004-04-06  Pascal Obry  <obry@gnat.com>

	* adaint.c (DIR_SEPARATOR): Properly set DIR_SEPARATOR on Win32.

	* osint.adb (Program_Name): Do not look past a directory separator.

2004-04-06  Thomas Quinot  <quinot@act-europe.fr>

	* atree.adb: Update comment (Rewrite_Substitute_Node no longer exists).

	* exp_ch6.adb (Rewrite_Function_Call): Clarify documentation of
	requirement for preserving a copy of the original assignment node.

	* sinfo.ads: Update comment (Original_Tree -> Original_Node).

2004-04-06  Olivier Hainque  <hainque@act-europe.fr>

	(__gnat_initialize [Vxworks]): Enable references to the crtstuff bits
	when supported.

2004-04-06  Ed Schonberg  <schonberg@gnat.com>

	* sem_ch4.adb (Remove_Abstract_Operations): Extend previous changes to
	operator calls in functional notation, and apply
	Universal_Interpretation to operands, not to their type.

2004-04-06  Robert Dewar  <dewar@gnat.com>

	* 5wdirval.adb: Minor reformatting

2004-04-06  Ed Falis  <falis@gnat.com>

	* gnat_rm.texi: Improve a reference to the GCC manual

From-SVN: r80453
---
 gcc/ada/5wdirval.adb | 14 ++++++++-----
 gcc/ada/ChangeLog    | 34 +++++++++++++++++++++++++++++++
 gcc/ada/adaint.c     |  3 ++-
 gcc/ada/atree.adb    |  3 +--
 gcc/ada/exp_ch6.adb  |  3 +++
 gcc/ada/gnat_rm.texi | 18 +++++++++--------
 gcc/ada/init.c       | 15 ++++++++------
 gcc/ada/osint.adb    | 10 +++++++++
 gcc/ada/sem_ch4.adb  | 48 +++++++++++++++++++++++++++++++++++---------
 gcc/ada/sinfo.ads    |  2 +-
 10 files changed, 118 insertions(+), 32 deletions(-)

diff --git a/gcc/ada/5wdirval.adb b/gcc/ada/5wdirval.adb
index 4607fb177913..a20ff1779737 100644
--- a/gcc/ada/5wdirval.adb
+++ b/gcc/ada/5wdirval.adb
@@ -52,6 +52,7 @@ package body Ada.Directories.Validity is
    function Is_Valid_Path_Name (Name : String) return Boolean is
       Start : Positive := Name'First;
       Last  : Natural;
+
    begin
       --  A path name cannot be empty, cannot contain more than 256 characters,
       --  cannot contain invalid characters and each directory/file name need
@@ -114,7 +115,8 @@ package body Ada.Directories.Validity is
    --------------------------
 
    function Is_Valid_Simple_Name (Name : String) return Boolean is
-      Only_Spaces : Boolean := True;
+      Only_Spaces : Boolean;
+
    begin
       --  A file name cannot be empty, cannot contain more than 256 characters,
       --  and cannot contain invalid characters, including '\'
@@ -122,20 +124,22 @@ package body Ada.Directories.Validity is
       if Name'Length = 0 or else Name'Length > 256 then
          return False;
 
+      --  Name length is OK
+
       else
+         Only_Spaces := True;
          for J in Name'Range loop
             if Invalid_Character (Name (J)) or else Name (J) = '\' then
                return False;
-
             elsif Name (J) /= ' ' then
                Only_Spaces := False;
             end if;
          end loop;
-      end if;
 
-      --  If Name follows the rules, it is valid
+         --  If no invalid chars, and not all spaces, file name is valid.
 
-      return not Only_Spaces;
+         return not Only_Spaces;
+      end if;
    end Is_Valid_Simple_Name;
 
 end Ada.Directories.Validity;
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 2cd3dd6126ff..5ca1aeb4b006 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,37 @@
+2004-04-06  Pascal Obry  <obry@gnat.com>
+
+	* adaint.c (DIR_SEPARATOR): Properly set DIR_SEPARATOR on Win32.
+
+	* osint.adb (Program_Name): Do not look past a directory separator.
+
+2004-04-06  Thomas Quinot  <quinot@act-europe.fr>
+
+	* atree.adb: Update comment (Rewrite_Substitute_Node no longer exists).
+
+	* exp_ch6.adb (Rewrite_Function_Call): Clarify documentation of
+	requirement for preserving a copy of the original assignment node.
+
+	* sinfo.ads: Update comment (Original_Tree -> Original_Node).
+
+2004-04-06  Olivier Hainque  <hainque@act-europe.fr>
+
+	(__gnat_initialize [Vxworks]): Enable references to the crtstuff bits
+	when supported.
+
+2004-04-06  Ed Schonberg  <schonberg@gnat.com>
+
+	* sem_ch4.adb (Remove_Abstract_Operations): Extend previous changes to
+	operator calls in functional notation, and apply
+	Universal_Interpretation to operands, not to their type.
+
+2004-04-06  Robert Dewar  <dewar@gnat.com>
+
+	* 5wdirval.adb: Minor reformatting
+
+2004-04-06  Ed Falis  <falis@gnat.com>
+
+	* gnat_rm.texi: Improve a reference to the GCC manual
+
 2004-04-05  Vincent Celier  <celier@gnat.com>
 
 	* adaint.h, adaint.c: Add function __gnat_named_file_length
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 4c1430dd235f..67a457c35d2c 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -147,6 +147,8 @@ struct vstring
 #if defined (_WIN32)
 #include <dir.h>
 #include <windows.h>
+#undef DIR_SEPARATOR
+#define DIR_SEPARATOR '\\'
 #endif
 
 #include "adaint.h"
@@ -2525,4 +2527,3 @@ get_gcc_version (void)
 {
   return 3;
 }
-
diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb
index d410a33c1088..49938b98ecea 100644
--- a/gcc/ada/atree.adb
+++ b/gcc/ada/atree.adb
@@ -2114,8 +2114,7 @@ package body Atree is
 
       --  Since we are doing a replace, we assume that the original node
       --  is intended to become the new replaced node. The call would be
-      --  to Rewrite_Substitute_Node if there were an intention to save
-      --  the original node.
+      --  to Rewrite if there were an intention to save the original node.
 
       Orig_Nodes.Table (Old_Node) := Old_Node;
 
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index a405d6bece59..1bfb5c1c86d9 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -2466,6 +2466,9 @@ package body Exp_Ch6 is
                --  complete assignment subtree consistent enough for
                --  Analyze_Assignment to proceed. We do not use the
                --  saved value, the point was just to do the relocation.
+               --  We cannot rely on Original_Node to go back from the
+               --  block node to the assignment node, because the
+               --  assignment might already be a rewrite substitution.
 
             begin
                Rewrite (Original_Assignment, Blk);
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index 9a89b325cb77..b3097a1b592e 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -62,7 +62,7 @@ GNAT Reference Manual
 
 @noindent
 GNAT, The GNU Ada 95 Compiler@*
-Version for GCC @value{version-GCC}@*
+GCC version @value{version-GCC}@*
 
 @noindent
 Ada Core Technologies, Inc.
@@ -12688,15 +12688,17 @@ including machine instructions in a subprogram.
 @end itemize
 
 @noindent
-The two features are similar, and both closely related to the mechanism
+The two features are similar, and both are closely related to the mechanism
 provided by the asm instruction in the GNU C compiler.  Full understanding
 and use of the facilities in this package requires understanding the asm
-instruction as described in
-@cite{Using and Porting the GNU Compiler Collection (GCC)} by Richard
-Stallman.  Calls to the function @code{Asm} and the procedure @code{Asm}
-have identical semantic restrictions and effects as described below.
-Both are provided so that the procedure call can be used as a statement,
-and the function call can be used to form a code_statement.
+instruction as described in @cite{Using the GNU Compiler Collection (GCC)} 
+by Richard Stallman. The relevant section is titled ``Extensions to the C
+Language Family'' -> ``Assembler Instructions with C Expression Operands''.
+
+Calls to the function @code{Asm} and the procedure @code{Asm} have identical
+semantic restrictions and effects as described below.  Both are provided so
+that the procedure call can be used as a statement, and the function call
+can be used to form a code_statement.
 
 The first example given in the GCC documentation is the C @code{asm}
 instruction:
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index 50e0feb085a3..e627a8bde2eb 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -1797,13 +1797,16 @@ __gnat_initialize (void)
      call the appropriate function here. We'll never unload that, so there is
      no de-registration to worry about.
 
-     We can differentiate between the two cases by looking at the
-     __module_has_ctors value provided by each class of crt objects. As of
-     today, selecting the crt set intended for applications to be statically
-     linked with the kernel is triggered by adding "-static" to the gcc *link*
-     command line options.  */
+     We can differentiate by looking at the __module_has_ctors value provided
+     by each class of crt objects. As of today, selecting the crt set intended
+     for applications to be statically linked with the kernel is triggered by
+     adding "-static" to the gcc *link* command line options.
 
-#if 0
+     This is a first approach, tightly synchronized with a number of GCC
+     configuration and crtstuff changes. We need to ensure that those changes
+     are there to activate this circuitry.  */
+
+#if DWARF2_UNWIND_INFO && defined (_ARCH_PPC)
  {
    extern const int __module_has_ctors;
    extern void __do_global_ctors ();
diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb
index 07355ed9ba2e..e2e559fac7e3 100644
--- a/gcc/ada/osint.adb
+++ b/gcc/ada/osint.adb
@@ -1794,8 +1794,18 @@ package body Osint is
       --  "alpha-dec-vxworks-"
 
       while Name_Len > 0  loop
+
+         --  All done if we find the last hyphen
+
          if Name_Buffer (Name_Len) = '-' then
             exit;
+
+         --  If directory separator found, we don't want to look further
+         --  since in this case, no prefix has been found.
+
+         elsif Is_Directory_Separator (Name_Buffer (Name_Len)) then
+            Name_Len := 0;
+            exit;
          end if;
 
          Name_Len := Name_Len - 1;
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 1ac9b4491fd1..9388125aaf12 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -4359,20 +4359,18 @@ package body Sem_Ch4 is
          --  always added to the overload set, unless it is a universal
          --  operation.
 
-         if Nkind (N) in N_Op
-           and then Has_Abstract_Op
-         then
+         if not Has_Abstract_Op then
+            return;
+
+         elsif Nkind (N) in N_Op then
             if Nkind (N) in N_Unary_Op
-              and then
-                Present (Universal_Interpretation (Etype (Right_Opnd (N))))
+              and then Present (Universal_Interpretation (Right_Opnd (N)))
             then
                return;
 
             elsif Nkind (N) in N_Binary_Op
-              and then
-                Present (Universal_Interpretation (Etype (Right_Opnd (N))))
-              and then
-                Present (Universal_Interpretation (Etype (Left_Opnd (N))))
+              and then Present (Universal_Interpretation (Right_Opnd (N)))
+              and then Present (Universal_Interpretation (Left_Opnd  (N)))
             then
                return;
 
@@ -4386,6 +4384,38 @@ package body Sem_Ch4 is
                   Get_Next_Interp (I, It);
                end loop;
             end if;
+
+         elsif Nkind (N) = N_Function_Call
+           and then
+             (Nkind (Name (N)) = N_Operator_Symbol
+                or else
+                  (Nkind (Name (N)) = N_Expanded_Name
+                     and then
+                       Nkind (Selector_Name (Name (N))) = N_Operator_Symbol))
+         then
+            declare
+               Arg1 : constant Node_Id := First (Parameter_Associations (N));
+
+            begin
+               if Present (Universal_Interpretation (Arg1))
+                 or else
+                   (Present (Next (Arg1))
+                     and then
+                       Present (Universal_Interpretation (Next (Arg1))))
+               then
+                  return;
+
+               else
+                  Get_First_Interp (N, I, It);
+                  while Present (It.Nam) loop
+                     if Scope (It.Nam) = Standard_Standard then
+                        Remove_Interp (I);
+                     end if;
+
+                     Get_Next_Interp (I, It);
+                  end loop;
+               end if;
+            end;
          end if;
       end if;
    end Remove_Abstract_Operations;
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index 5ee8fb388279..c86ac9d83224 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -1519,7 +1519,7 @@ package Sinfo is
    --    stub. During the analysis procedure, stubs in some situations
    --    get rewritten by the corresponding bodies, and we set this flag
    --    to remember that this happened. Note that it is not good enough
-   --    to rely on the use of Original_Tree here because of the case of
+   --    to rely on the use of Original_Node here because of the case of
    --    nested instantiations where the substituted node can be copied.
 
    --  Zero_Cost_Handling (Flag5-Sem)
-- 
GitLab