+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
-- --
-- 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- --
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;
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
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})
-- 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)
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
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));
elsif not Subtype_Conformant (Designator, E) then
goto Next_Entity;
+
+ elsif Different_Generic_Profile (E) then
+ goto Next_Entity;
end if;
end if;
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
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
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