OSDN Git Service

2012-06-12 Gary Dismukes <dismukes@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 12 Jun 2012 10:03:26 +0000 (10:03 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 12 Jun 2012 10:03:26 +0000 (10:03 +0000)
* projects.texi: Remove comments.

2012-06-12  Thomas Quinot  <quinot@adacore.com>

* back_end.adb (Scan_Back_End_Switches): Treat -fdump-scos as
synonym of -gnateS.
(gnat_post_options): Disable gimple-based SCO generator.
* gnat_ugn.texi: Document that -gnateS is an obsolete synonym
of -fdump-scos.

2012-06-12  Ed Schonberg  <schonberg@adacore.com>

* sem_ch6.adb (Different_Generic_Profile): new predicate for
Find_Corresponding_Spec, to handle a rare case of accidental
overloading in an instance, when the profile of a subprogram body
that depends on a formal type becomes compatible with that of
a homonym whose profile in the generic mentions the actual type.

2012-06-12  Thomas Quinot  <quinot@adacore.com>

* gnat1drv.adb: Minor reformatting.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188435 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/back_end.adb
gcc/ada/gnat1drv.adb
gcc/ada/gnat_ugn.texi
gcc/ada/projects.texi
gcc/ada/sem_ch6.adb

index 2c9d024..a5a2548 100644 (file)
@@ -1,3 +1,27 @@
+2012-06-12  Gary Dismukes  <dismukes@adacore.com>
+
+       * projects.texi: Remove comments.
+
+2012-06-12  Thomas Quinot  <quinot@adacore.com>
+
+       * back_end.adb (Scan_Back_End_Switches): Treat -fdump-scos as
+       synonym of -gnateS.
+       (gnat_post_options): Disable gimple-based SCO generator.
+       * gnat_ugn.texi: Document that -gnateS is an obsolete synonym
+       of -fdump-scos.
+
+2012-06-12  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch6.adb (Different_Generic_Profile): new predicate for
+       Find_Corresponding_Spec, to handle a rare case of accidental
+       overloading in an instance, when the profile of a subprogram body
+       that depends on a formal type becomes compatible with that of
+       a homonym whose profile in the generic mentions the actual type.
+
+2012-06-12  Thomas Quinot  <quinot@adacore.com>
+
+       * gnat1drv.adb: Minor reformatting.
+
 2012-06-12  Ed Schonberg  <schonberg@adacore.com>
 
        * sem_util.adb (Build_Explicit_Dereference): If the expression
index b6ad263..6c4b63f 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2011, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2012, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -219,23 +219,30 @@ package body Back_End is
          elsif Switch_Chars (First .. Last) = "quiet" then
             null;
 
-         --  Store any other GCC switches
+         --  Store any other GCC switches. Also do special processing for some
+         --  specific switches that the Ada front-end knows about.
 
          else
             Store_Compilation_Switch (Switch_Chars);
 
-            --  Special check, the back end switch -fno-inline also sets the
+            --  Back end switch -fno-inline also sets the Suppress_All_Inlining
             --  front end flag to entirely inhibit all inlining.
 
             if Switch_Chars (First .. Last) = "fno-inline" then
                Opt.Suppress_All_Inlining := True;
 
-            --  Another special check, the switch -fpreserve-control-flow
-            --  which is also a back end switch sets the front end flag
-            --  that inhibits improper control flow transformations.
+            --  Back end switch -fpreserve-control-flow also sets the front end
+            --  flag that inhibits improper control flow transformations.
 
             elsif Switch_Chars (First .. Last) = "fpreserve-control-flow" then
                Opt.Suppress_Control_Flow_Optimizations := True;
+
+            --  Back end switcg -fdump-scos, which exists primarily for C, is
+            --  also accepted for Ada as a synonym of -gnateS.
+
+            elsif Switch_Chars (First .. Last) = "fdump-scos" then
+               Opt.Generate_SCO := True;
+
             end if;
          end if;
       end Scan_Back_End_Switches;
index 93c16f2..a3ed807 100644 (file)
@@ -118,9 +118,7 @@ procedure Gnat1drv is
       --  Debug flag -gnatd.I is a synonym for Generate_SCIL and requires code
       --  generation.
 
-      if Debug_Flag_Dot_II
-        and then Operating_Mode = Generate_Code
-      then
+      if Debug_Flag_Dot_II and then Operating_Mode = Generate_Code then
          Generate_SCIL := True;
       end if;
 
index ca7a188..8380530 100644 (file)
@@ -4045,6 +4045,13 @@ Makes the compiler output callgraph information for the program, on a
 per-file basis.  The information is generated in the VCG format.  It can
 be decorated with stack-usage per-node information.
 
+@item -fdump-scos
+@cindex @option{-fdump-scos} (@command{gcc})
+Generate SCO (Source Coverage Obligation) information in the ALI file.
+This information is used by advanced coverage tools. See unit @file{SCOs}
+in the compiler sources for details in files @file{scos.ads} and
+@file{scos.adb}.
+
 @item ^-g^/DEBUG^
 @cindex @option{^-g^/DEBUG^} (@command{gcc})
 Generate debugging information. This information is stored in the object
@@ -4201,12 +4208,10 @@ example a Pure unit cannot WITH a Preelaborate unit. If this switch is used,
 these errors become warnings (which can be ignored, or suppressed in the usual
 manner). This can be useful in some specialized circumstances such as the
 temporary use of special test software.
+
 @item -gnateS
 @cindex @option{-gnateS} (@command{gcc})
-Generate SCO (Source Coverage Obligation) information in the ALI
-file. This information is used by advanced coverage tools. See
-unit @file{SCOs} in the compiler sources for details in files
-@file{scos.ads} and @file{scos.adb}.
+Synonym of @option{-fdump-scos}, kept for backards compatibility.
 
 @item -gnatE
 @cindex @option{-gnatE} (@command{gcc})
index b1df9ab..a1cdb69 100644 (file)
@@ -2265,19 +2265,11 @@ them independently. An aggregate project does not have these
 limitations and can aggregate two project trees that have common
 sources.
 
-@smallexample
-Aggregate projects can group projects with duplicate file names
-@end smallexample
-
-This scenario is particularly useful in environment like VxWorks 653
+This scenario is particularly useful in environments like VxWorks 653
 where the applications running in the multiple partitions can be built
 in parallel through a single gprbuild command. This also works nicely
 with Annex E.
 
-@smallexample
-   Aggregate projects can be used to build multiple partitions
-@end smallexample
-
 @c ---------------------------------------------
 @node Define a build environment
 @subsection Define a build environment
index a2868a9..80e07fd 100644 (file)
@@ -7416,6 +7416,8 @@ package body Sem_Ch6 is
             --  The following is too permissive. A more precise test should
             --  check that the generic actual is an ancestor subtype of the
             --  other ???.
+            --  See code in Find_Corresponding_Spec that applies an additional
+            --  filter to handle accidental amiguities in instances.
 
             return not Is_Generic_Actual_Type (T1)
               or else not Is_Generic_Actual_Type (T2)
@@ -8148,6 +8150,46 @@ package body Sem_Ch6 is
 
       E : Entity_Id;
 
+      function Different_Generic_Profile (E : Entity_Id) return Boolean;
+      --  Even if fully conformant, a body may depend on a generic actual when
+      --  the spec does not, or vice versa, in which case they were distinct
+      --  entities in the generic.
+
+      -------------------------------
+      -- Different_Generic_Profile --
+      -------------------------------
+
+      function Different_Generic_Profile (E : Entity_Id) return Boolean is
+         F1, F2 : Entity_Id;
+
+      begin
+         if Ekind (E) = E_Function
+           and then Is_Generic_Actual_Type (Etype (E))
+           /= Is_Generic_Actual_Type (Etype (Designator))
+         then
+            return True;
+         end if;
+
+         F1 := First_Formal (Designator);
+         F2 := First_Formal (E);
+
+         while Present (F1) loop
+            if
+              Is_Generic_Actual_Type (Etype (F1))
+              /= Is_Generic_Actual_Type (Etype (F2))
+            then
+               return True;
+            end if;
+
+            Next_Formal (F1);
+            Next_Formal (F2);
+         end loop;
+
+         return False;
+      end Different_Generic_Profile;
+
+   --  Start of processing for Find_Corresponding_Spec
+
    begin
       E := Current_Entity (Designator);
       while Present (E) loop
@@ -8163,13 +8205,12 @@ package body Sem_Ch6 is
                          and then Type_Conformant (E, Designator))
             then
                --  Within an instantiation, we know that spec and body are
-               --  subtype conformant, because they were subtype conformant
-               --  in the generic. We choose the subtype-conformant entity
-               --  here as well, to resolve spurious ambiguities in the
-               --  instance that were not present in the generic (i.e. when
-               --  two different types are given the same actual). If we are
-               --  looking for a spec to match a body, full conformance is
-               --  expected.
+               --  subtype conformant, because they were subtype conformant in
+               --  the generic. We choose the subtype-conformant entity here as
+               --  well, to resolve spurious ambiguities in the instance that
+               --  were not present in the generic (i.e. when two different
+               --  types are given the same actual). If we are looking for a
+               --  spec to match a body, full conformance is expected.
 
                if In_Instance then
                   Set_Convention (Designator, Convention (E));
@@ -8188,6 +8229,9 @@ package body Sem_Ch6 is
 
                   elsif not Subtype_Conformant (Designator, E) then
                      goto Next_Entity;
+
+                  elsif Different_Generic_Profile (E) then
+                     goto Next_Entity;
                   end if;
                end if;
 
@@ -8218,12 +8262,12 @@ package body Sem_Ch6 is
 
                   return E;
 
-               --  If E is an internal function with a controlling result
-               --  that was created for an operation inherited by a null
-               --  extension, it may be overridden by a body without a previous
-               --  spec (one more reason why these should be shunned). In that
-               --  case remove the generated body if present, because the
-               --  current one is the explicit overriding.
+               --  If E is an internal function with a controlling result that
+               --  was created for an operation inherited by a null extension,
+               --  it may be overridden by a body without a previous spec (one
+               --  more reason why these should be shunned). In that case
+               --  remove the generated body if present, because the current
+               --  one is the explicit overriding.
 
                elsif Ekind (E) = E_Function
                  and then Ada_Version >= Ada_2005
@@ -8329,9 +8373,9 @@ package body Sem_Ch6 is
         renames Fully_Conformant_Expressions;
 
       function FCL (L1, L2 : List_Id) return Boolean;
-      --  Compare elements of two lists for conformance. Elements have to
-      --  be conformant, and actuals inserted as default parameters do not
-      --  match explicit actuals with the same value.
+      --  Compare elements of two lists for conformance. Elements have to be
+      --  conformant, and actuals inserted as default parameters do not match
+      --  explicit actuals with the same value.
 
       function FCO (Op_Node, Call_Node : Node_Id) return Boolean;
       --  Compare an operator node with a function call
@@ -8356,8 +8400,8 @@ package body Sem_Ch6 is
             N2 := First (L2);
          end if;
 
-         --  Compare two lists, skipping rewrite insertions (we want to
-         --  compare the original trees, not the expanded versions!)
+         --  Compare two lists, skipping rewrite insertions (we want to compare
+         --  the original trees, not the expanded versions!)
 
          loop
             if Is_Rewrite_Insertion (N1) then