Age | Commit message (Collapse) | Author | Files | Lines |
|
A "return;" at the end of a procedure is unnecessary and
misleading. This patch removes them.
gcc/ada/ChangeLog:
* checks.adb: Remove unnecessary "return;" statements.
* eval_fat.adb: Likewise.
* exp_aggr.adb: Likewise.
* exp_attr.adb: Likewise.
* exp_ch3.adb: Likewise.
* exp_ch4.adb: Likewise.
* exp_ch5.adb: Likewise.
* exp_ch6.adb: Likewise.
* exp_unst.adb: Likewise.
* krunch.adb: Likewise.
* layout.adb: Likewise.
* libgnat/s-excdeb.adb: Likewise.
* libgnat/s-trasym__dwarf.adb: Likewise.
* par-endh.adb: Likewise.
* par-tchk.adb: Likewise.
* sem.adb: Likewise.
* sem_attr.adb: Likewise.
* sem_ch6.adb: Likewise.
* sem_elim.adb: Likewise.
* sem_eval.adb: Likewise.
* sfn_scan.adb: Likewise.
|
|
This patch fixes a crash on some subprograms with anonymous
access-to-subprogram parameters by removing delayed freezing of
subprograms in some cases where it wasn't necessary. The -gnatD output
for itypes is also improved.
gcc/ada/ChangeLog:
* sem_ch6.adb (Check_Delayed_Subprogram, Possible_Freeze): Restrict
cases where freezing is delayed.
* sem_ch6.ads (Check_Delayed_Subprogram): Improve documentation
comment.
* sprint.adb (Write_Itype): Improve output.
|
|
Check_Discriminant_Conformance is really only about concepts defined in
chapter 3 of the Ada reference manual, so it fits better in Sem_Ch3 than
in Sem_Ch6.
gcc/ada/ChangeLog:
* sem_ch6.adb, sem_ch6.ads (Check_Discriminant_Conformance): Move to …
* sem_ch3.adb (Check_Discriminant_Conformance): … here.
|
|
This patch migrates the handling of "premature usage" type of error to
the Is_Self_Hidden mechanism.
gcc/ada/ChangeLog:
* sem_ch6.adb (Set_Formal_Mode): Extend profile. Move parts of the
body…
(Process_Formals): … here. Move call to Set_Formal_Mode earlier. Call
Set_Is_Not_Self_Hidden in second traversal.
|
|
A new aspect Program_Exit is added for SPARK to specify that a subprogram
can exit the entire program, e.g. GNAT.System.OS_Exit. The implementation
is based on the existing machinery for similar aspects, in particular, for
aspects Subprogram_Variant and Always_Terminates.
gcc/ada/ChangeLog:
* aspects.ads (Aspect_Id): Add new aspect identifier.
(Aspect_Argument): Specify argument for the new aspect.
(Is_Representation_Aspect): New aspect is not a representation aspect.
(Aspect_Names): Map new aspect to name.
(Aspect_Delay): New aspect is always delayed.
* contracts.adb (Expand_Subprogram_Contract)
(Add_Pre_Post_Condition, Add_Contract_Item)
(Analyze_Entry_Or_Subprogram_Contract)
(Analyze_Entry_Or_Subprogram_Body_Contract)
(Analyze_Subprogram_Body_Stub_Contract): Support new aspect.
* contracts.ads (Add_Contract_Item,
Analyze_Entry_Or_Subprogram_Contract,
Analyze_Entry_Or_Subprogram_Body_Contract,
Analyze_Subprogram_Body_Stub_Contract): Mention new contract in
comment.
* doc/gnat_rm/implementation_defined_aspects.rst
(Aspect Program_Exit): Document new aspect.
* doc/gnat_rm/implementation_defined_pragmas.rst
(Pragma Program_Exit): Document new pragma.
* einfo-utils.adb (Get_Pragma): Support new pragma.
* einfo-utils.ads (Get_Pragma): Mention new pragma in comment.
* exp_prag.adb (Expand_Pragma_Program_Exit): Expand new pragma;
body.
* exp_prag.ads (Expand_Pragma_Program_Exit): Expand new pragma;
spec.
* inline.adb (Remove_Aspects_And_Pragmas): Support new pragma.
* par-prag.adb (Prag): Support new pragma.
* sem_attr.adb (Analyze_Attribute_Old_Result): Accept attribute
Old in new pragma.
* sem_ch12.adb (Implementation of Generic Contracts): Mention new
aspect in comment.
* sem_ch13.adb (Insert_Pragma, Analyze_Aspect_Specifications):
Convert new new aspect to pragma.
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Renumber
subsequent rule in comment.
* sem_prag.adb (Check_Postcondition_Use_In_Inlined_Subprogram)
(Contract_Freeze_Error): Mention new pragma in comment.
(Analyze_Pragma): Support new pragma; renumber subsequent rule in
comment.
(Analyze_Program_Exit_In_Decl_Part): Analyze new pragma; body.
(Sig_Flags): References in new pragma are significant when
detecting unreferenced objects.
* sem_prag.ads (Aspect_Specifying_Pragma)
(Assertion_Expression_Pragma, Pragma_Significant_To_Subprograms):
Support new aspect and pragma.
(Analyze_Program_Exit_In_Decl_Part): Analyze new pragma; spec.
(Find_Related_Package_Or_Body): Mention new pragma in comment.
* sem_util.adb (Is_Subprogram_Contract_Annotation): Support new
pragma.
* sem_util.ads (Is_Subprogram_Contract_Annotation): Mention new
pragma in comment.
* sinfo.ads (Is_Generic_Contract_Pragma): Mention new pragma in
comment.
* snames.ads-tmpl (Preset Names, Pragma_Id): Add name and pragma
identifiers.
* gnat_rm.texi: Regenerate.
|
|
The Incomplete_View property of a type was attached to its full type
declaration as a semantic field, but retrieving it from there required
low-level tree navigation and caused code duplication. In one case we
relied on internal class-wide type being attached to the corresponding
full type declaration, which is an undocumented assumption.
It seems better to attach this field to entities, just like we do with
Full_View and many other type properties. Ideally, this field should be
present just in type entities, but currently we set it before setting
the proper entity kind.
Behavior is unaffected. This is rather a code cleanup, originating from the
need to use Incomplete_View in GNATprove.
gcc/ada/ChangeLog:
* einfo.ads (Incomplete_View): Move from Sinfo; adapt wording.
* exp_ch3.adb (Build_Record_Init_Proc): Adapt retrieval of
Incomplete_View.
* gen_il-fields.ads (Opt_Field_Enum): Move Incomplete_View from node
to entity field.
* gen_il-gen-gen_entities.adb (Gen_Entities): Add field.
* gen_il-gen-gen_nodes.adb (Gen_Nodes): Remove field.
* sem_ch3.adb (Analyze_Full_Type_Declaration,
Check_Anonymous_Access_Component): Adapt setting of Incomplete_View.
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Adapt retrieval of
Incomplete_View for class-wide types; no longer rely on class-wide
type being attached to non-classwide type declaration.
* sem_util.adb (Collect_Primitive_Operations): Adapt retrieval of
Incomplete_View.
* sinfo.ads (Incomplete_View): Move to Einfo.
|
|
The patch implements the experimental constructors RFC. Currently a WIP.
gcc/ada/ChangeLog:
* aspects.ads: Add support for constructors.
* exp_aggr.adb: Likewise.
* exp_attr.adb: Likewise.
* exp_ch3.adb: Likewise.
* exp_ch4.adb: Likewise.
* exp_util.adb: Likewise.
* gen_il-fields.ads: Likewise.
* gen_il-gen-gen_entities.adb: Likewise.
* gen_il-gen-gen_nodes.adb: Likewise.
* par-ch4.adb: Likewise.
* sem_aggr.adb: Likewise.
* sem_attr.adb, sem_attr.ads: Likewise.
* sem_ch13.adb: Likewise.
* sem_ch3.adb: Likewise.
* sem_ch5.adb: Likewise.
* sem_ch6.adb: Likewise.
* sem_res.adb: Likewise.
* sem_util.adb, sem_util.ads: Likewise.
* snames.ads-tmpl: Likewise.
|
|
In general, functions in SPARK cannot have parameters of mode IN OUT
unless they are annotated with the Side_Effects aspect. Borrowing
traversal functions are special functions which can return a part
of their first parameter as an access-to-variable type. This might not
be allowed in Ada if the parameter is a constant. Allow the first
parameter of borrowing traversal functions to have mode IN OUT.
gcc/ada/ChangeLog:
* sem_ch6.adb (Analyze_SPARK_Subprogram_Specification):
Allow the first parameter of functions whose return type is
an anonymous access-to-variable type to have mode IN OUT.
|
|
When the type of the expression of an expression function is
an incomplete type, the frontend does not report the expected
error.
gcc/ada/ChangeLog:
* sem_ch6.adb (Analyze_Expression_Function): Add missing check
on premature use of incomplete type.
|
|
Rename Preanalyze_Spec_Expression as Preanalyze_And_Resolve_Spec_Expression,
Preanalyze_Assert_Expression as Preanalyze_And_Resolve_Assert_Expression,
and Preanalyze_Default_Expression as Preanalyze_And_Resolve_Default_Expression;
cleanup the version of Preanalyze_Assert_Expression without context type.
gcc/ada/ChangeLog:
* sem.ads: Update reference to renamed subprogram in documentation.
* sem_ch3.ads (Preanalyze_Assert_Expression): Renamed.
(Preanalyze_Spec_Expression): Renamed.
* sem_ch3.adb (Preanalyze_Assert_Expression): Renamed and code cleanup.
(Preanalyze_Spec_Expression): Renamed.
(Preanalyze_Default_Expression): Renamed.
* contracts.adb: Update calls to renamed subprograms.
* exp_pakd.adb: Ditto.
* exp_util.adb: Ditto.
* freeze.adb: Ditto.
* sem_ch12.adb: Ditto.
* sem_ch13.adb: Ditto.
* sem_ch6.adb: Ditto.
* sem_prag.adb: Ditto.
* sem_res.adb (Preanalyze_And_Resolve): Add to the version without
context type the special handling for GNATprove mode provided by
the version with context type; required to cleanup the body of
Preanalyze_Assert_Expression.
|
|
GNAT already emits a style warning when redundant parentheses appear inside
logical and short-circuit operators. A similar warning will be soon emitted for
unary operators as well. This patch removes the redundant parentheses to avoid
future build errors.
gcc/ada/ChangeLog:
* checks.adb, exp_dist.adb, exp_imgv.adb, exp_util.adb,
libgnarl/a-reatim.adb, libgnat/a-coinve.adb, libgnat/a-nbnbre.adb,
libgnat/a-ngcoty.adb, libgnat/a-ngelfu.adb, libgnat/a-ngrear.adb,
libgnat/a-strbou.ads, libgnat/a-strfix.ads, libgnat/a-strsea.adb,
libgnat/a-strsea.ads, libgnat/a-strsup.ads,
libgnat/a-strunb__shared.ads, libgnat/g-alleve.adb,
libgnat/g-spitbo.adb, libgnat/s-aridou.adb, libgnat/s-arit32.adb,
libgnat/s-dourea.ads, libgnat/s-genbig.adb, libgnat/s-imager.adb,
libgnat/s-statxd.adb, libgnat/s-widthi.adb, sem_attr.adb, sem_ch10.adb,
sem_ch3.adb, sem_ch6.adb, sem_ch7.adb, sem_dim.adb, sem_prag.adb,
sem_res.adb, uintp.adb: Remove redundant parentheses inside NOT and ABS
operators.
|
|
Boolean
In Ada 2012, the compiler fails to check that a primitive equality operator
for an untagged record type must appear before the type is frozen, when the
operator returns a subtype of Boolean. This plugs the legality loophole but
adds the debug switch -gnatd_q to go back to the previous state.
gcc/ada/ChangeLog:
PR ada/18765
* debug.adb (d_q): Document new usage.
* sem_ch6.adb (New_Overloaded_Entity): Apply the special processing
to all equality operators whose base result type is Boolean, but do
not enforce the new Ada 2012 freezing rule if the result type is a
proper subtype of it and the -gnatd_q switch is specified.
|
|
|
|
According to RM 13.14(8/4), a static expression in an aspect specification
does not cause freezing; however, the frontend performs many calls to
Preanalyze_Spec_Expression made during the analysis of aspects. This
patch, suggested by Eric Botcazou, takes care of this additional code
cleanup which requires also replacing many occurrences of the global
variable In_Spec_Expression by calls to Preanalysis_Active.
gcc/ada/ChangeLog:
* exp_util.adb (Insert_Actions): Document behavior under strict
preanalysis.
* sem.ads (In_Strict_Preanalysis): New subprogram.
(Preanalysis_Active): Replace 'and' operator by 'and then'.
* sem.adb (In_Strict_Preanalysis): Ditto.
* sem_attr.adb (Check_Dereference): Replace In_Spec_Expression
occurrence by call to Preanalysis_Active, and document it.
(Resolve_Attribute [Atribute_Access]): Ditto.
(Eval_Attribute): No evaluation under strict preanalysis.
(Validate_Static_Object_Name): No action under strict preanalysis.
* sem_ch13.adb (Check_Aspect_At_End_Of_Declarations): Replace
calls to Preanalyze_Spec_Expression by calls to Preanalyze_And_Resolve.
(Check_Aspect_At_Freeze_Point): Ditto.
(Resolve_Aspect_Expressions [Dynamic/Static/Predicate aspects]): Code
cleanup adjusting the code to emulate Preanalyze_And_Resolve, instead
of Preanalyze_Spec_Expression.
(Resolve_Aspect_Expressions [CPU/Interrupt_Priority/Priority/
Storage_Size aspects]): Replace calls to Preanalyze_Spec_Expression
by call to Preanalyze_And _Resolve.
* sem_ch3.adb (Analyze_Object_Declaration): Replace In_Spec_Expression
occurrence by call to Preanalysis_Active.
(Find_Type_Of_Object): Add documentation.
* sem_ch4.adb (Analyze_Case_Expression): Replace In_Spec_Expression
occurrence by call to Preanalysis_Active.
* sem_ch6.adb (Analyze_Expression_Function): Minor code reorganization
moving the code preanalyzing the expression after the new body has
been inserted in the tree to ensure that its Parent attribute is
available for preanalysis.
* sem_cat.adb (Validate_Static_Object_Name): No action under strict
preanalysis.
* sem_elab.adb (Check_For_Eliminated_Subprogram): Replace In_Spec_Expression
occurrence by call to Preanalysis_Active.
* sem_eval.adb (Eval_Intrinsic_Call [Name_Enclosing_Entity]): Ditto.
* sem_elim.adb (Check_For_Eliminated_Subprogram): Ditto.
* sem_res.adb (Resolve_Entity_Name): Ditto.
|
|
This patch adds a new reserved word, "finally", and accompanying new
syntax that's similar to the Java equivalent.
gcc/ada/ChangeLog:
* atree.adb (Parent_Or_List_Containing): New function.
* atree.ads (Parent_Or_List_Containing): Likewise.
* gen_il-fields.ads: Add new field.
* gen_il-gen-gen_nodes.adb (Gen_Nodes): Extend handled sequence of
statements node.
* par-ch11.adb (P_Handled_Sequence_Of_Statements, P_Exception_Handler):
Add new syntactic construct.
* par-ch5.adb (P_Sequence_Of_Statements): Likewise.
* par.adb: Likewise.
* par-util.adb (Check_Future_Keyword): Warn that "finally" becomes a
reserved word with extensions.
* scans.adb (Initialize_Ada_Keywords): Add new reserved word.
* snames.adb-tmpl: Likewise.
* snames.ads-tmpl: Likewise.
* scans.ads: Likewise.
* sem_ch11.adb (Analyze_Handled_Statements): Adapt to new node field.
* sem_ch5.adb (Analyze_Exit_Statement): Add legality check.
(Analyze_Goto_Statement): Likewise.
* sem_ch6.adb (Analyze_Return_Statement): Likewise.
* sinfo-utils.adb (Lowest_Common_Ancestor, Destroy_Element): New
subprograms.
* sinfo-utils.ads (Lowest_Common_Ancestor): New function.
* sinfo.ads: Add documentation for new field.
* xsnamest.adb: Fix typo in comment.
* doc/gnat_rm/gnat_language_extensions.rst: Document new extension.
* warnsw.adb: Add new option.
* warnsw.ads: Likewise.
* exp_ch11.adb (Expand_N_Handled_Sequence_Of_Statements): Add abort
deferral to finally part.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.
* gcc-interface/trans.cc (Handled_Sequence_Of_Statements_to_gnu):
Handle finally statements.
|
|
This patch gives a syntax error if a null procedure is used as
a compilation unit. The error was already given during semantic
analysis; now it is given in the parser, which is more convenient
for other tools like gprbuild, because the -gnats switch now
gives the error.
Note that the old message "null procedure cannot be declared at library
level" was wrong; "library level" is not the same thing as "is a library
unit".
gcc/ada/ChangeLog:
* par-ch10.adb (P_Compilation_Unit): Give an error for "is null".
* sem_ch10.adb (Analyze_Subunit): Remove check for "is null"
as a subunit.
* sem_ch6.adb (Analyze_Subprogram_Declaration):
Remove check for "is null" as a library unit.
|
|
Complete previous patch; required to avoid regressions in GNATProve.
gcc/ada/ChangeLog:
* sem_ch6.adb (Analyze_Expression_Function): Set the parent of
the new node to be the parent of the original to get the proper
context, which is needed for complete error reporting and for
semantic analysis. Patch suggested by Eric Botcazou.
|
|
In Ada 2005 even if the formal is using a tagged limited type
then the type should not be considered incomplete.
gcc/ada/ChangeLog:
* sem_ch6.adb (Analyze_Subprogram_Body_Helper):
Exchange_Limited_Views also in Ada 2005.
|
|
If an 'out' or 'in out' parameter is not modified in a function body,
we warn. However, the warning was missing when we have an expression
function instead of a proper body. This patch enables the warning
on expression functions.
gcc/ada/ChangeLog:
* sem_ch6.adb (Analyze_Expression_Function): Mark the implicit
spec for an expression function as Comes_From_Source.
(Analyze_Null_Procedure): Minor cleanup.
* sem_warn.adb (Source_E1): New function to compute whether
to give warnings. In particular, return True for [in] out
parameters of expression functions.
|
|
During preanalysis, the frontend does not generate freeze nodes.
The exception to this rule occurs during the preanalysis of default
and per-object expressions, where static expressions are frozen.
A patch merged six years ago to address an issue in this area introduced
additional complexity and confusion regarding the frontend's behavior in
such cases. The purpose of this patch is to revert that change, simplifying
the support for the preanalysis of static expressions to make it cleaner
and easier to understand.
gcc/ada/ChangeLog:
* sem.ads (Inside_Preanalysis_Without_Freezing): Removed.
* sem.adb (Semantics): Remove Inside_Preanalysis_Without_Freezing.
* sem_ch6.adb (Preanalyze_Formal_Expression): Removed.
* sem_ch3.ads (Preanalyze_Assert_Expression): Add documentation.
(Preanalyze_Spec_Expression): Add documentation.
* sem_ch3.adb (Preanalyze_Assert_Expression) Code cleanup.
(Preanalyze_Default_Expression): Code cleanup.
* sem_res.ads (Preanalyze_With_Freezing_And_Resolve): Removed.
* sem_res.adb (Preanalyze_With_Freezing_And_Resolve): Removed.
(Preanalyze_And_Resolve): Code cleanup.
* freeze.adb (Freeze_Entity): No freeze under strict preanalysis.
(Freeze_Expression): Code cleanup.
(Freeze_Expr_Types): Replace call to Preanalyze_Spec_Expression by
strict preanalysis during preanalysis of a duplicate of the
expression performed to have available the minimum decoration
to locate referenced unfrozen types.
* sem_aggr.adb (Resolve_Array_Aggregate): Minor code cleanup.
* sem_attr.adb (Resolve_Attribute): Add documentation.
* sem_ch13.adb (Resolve_Aspect_Expressions[Aspect_Default_Value]):
Replace call to Preanalyze_Spec_Expression by Preanalyze_And_Resolve.
(Resolve_Aspect_Expressions[Aspect_Default_Component_Value]): Ditto.
* sem_ch8.adb (Set_Entity_Or_Discriminal): Code cleaup.
* sem_prag.adb (Analyze_Initial_Condition_In_Decl_Part): Replace
call to Preanalyze_Assert_Expression by call to Preanalyze_And_Resolve.
(Analyze_Pre_Post_Condition): Replace call to Preanayze_Spec_Expression
by call to Preanalyze_Assert_Expression.
* sem_util.ads (In_Pragma_Expression): Adding a formal to extend the
functionality of this subprogram.
(Within_Static_Expression): New subprogram.
* sem_util.adb (In_Pragma_Expression): Ditto.
(Within_Static_Expression): Ditto.
* checks.adb (Install_Null_Excluding_Check): No check during preanalysis.
(Install_Primitive_Elaboration_Check): Ditto.
|
|
Access parameters are not allowed in specifications of task entries.
Before this patch, the compiler failed to detect that case in accept
statements that were not directly in their task body's scopes. This
patch fixes this issue.
gcc/ada/ChangeLog:
* sem_ch3.adb (Access_Definition): Remove test for task entry context.
* sem_ch6.adb (Process_Formals): Add improved test for task entry
context.
|
|
This implements elision of the copy operation for aggregate returns, i.e.
simple return statements whose expression is an aggregate, in the case of
nonlimited by-reference types (the copy operation is already elided for
limited types), which comprise controlled and tagged types. This is the
copy operation in the called function, that is to say the copy from the
anonymous object built for the aggregate to the anonymous return object.
The implementation simply extends that of limited types, which rewrites
the simple return statement as an extended return statement internally
and then leverages the built-in-place implementation of return objects
for these statements.
gcc/ada/ChangeLog:
* exp_aggr.adb (Is_Build_In_Place_Aggregate_Return): Also return
True for functions returning on the secondary stack or returning
a by-reference type if the back end exposes its return slot.
(Expand_Array_Aggregate): Call Is_Build_In_Place_Aggregate_Return
to spot aggregates to be built in place.
* exp_ch3.adb (Make_Allocator_For_Return): Add missing condition
in assertion pragma deduced from Expand_Subtype_From_Expr.
* exp_ch6.adb (Expand_Simple_Function_Return): Rewrite the statement
as an extended return statement if the expression is an aggregate
whose expansion is delayed. Properly relocate the expression in
this case.
* sem_ch6.adb: Add clauses for Exp_Aggr.
(Analyze_Function_Return): Do not apply the predicate check to an
aggregate whose expansion is delayed. Extended the processing of
case expressions to all conditional expressions.
|
|
When a derived tagged type implements interface types in addition
to deriving from its parent type, and a primitive inherited from
its parent type corresponds to an inherited primitive that has
class-wide preconditions, then the generated code fails to check
the class-wide preconditions inherited from the interface primitive.
gcc/ada/ChangeLog:
* einfo.ads (Is_Dispatch_Table_Wrapper): Complete documentation.
* exp_ch6.adb (Install_Class_Preconditions_Check): Dispatch table
wrappers do not require installing the check since it is performed
by the caller.
(Class_Preconditions_Subprogram): Use new predicate Is_LSP_Wrapper.
* freeze.adb (Check_Inherited_Conditions): Rename Postcond_Wrappers to
Condition_Wrappers to handle implicitly inherited subprograms that
implement pre-/postconditions inherited from interface primitives.
Use new predicate Is_LSP_Wrapper.
* sem_disp.adb (Check_Dispatching_Operation): Complete assertion to
handle functions returning class-wide types.
* exp_util.ads (Is_LSP_Wrapper): New subprogram.
* exp_util.adb (Is_LSP_Wrapper): New subprogram.
* contracts.adb (Process_Spec_Postconditions): Use Is_LSP_Wrapper.
(Process_Inherited_Conditions): Use Is_LSP_Wrapper.
* sem_ch6.adb (New_Overloaded_Entity): Use Is_LSP_Wrapper.
* sem_util.adb (Nearest_Class_Condition_Subprogram): Use Is_LSP_Wrapper.
|
|
Fix two bugs uncovered by a recent ACATS test C3A1005: a freezing problem
and a case where a user-defined equality function for an incomplete type
was incorrectly hidden from use-clause visibility by the "corresponding"
predefined op (which doesn't actually exist).
gcc/ada/ChangeLog:
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Don't freeze here
if Has_Delayed_Freeze returns True.
* sem_type.adb (Valid_Equality_Arg): Treat an incomplete type like
a limited type because neither has an implicitly-defined equality
primitive.
(Covers): If either argument is an incomplete type
whose full view is available, then look through to the full view.
* sem_res.adb (Resolve_Actuals): If the actual parameter type is
complete and the formal parameter type is not, then update the
formal parameter type to use the complete view.
|
|
If a limited private partial view of a type has an access discriminant with
a default expression, and if the type (perhaps tagged, perhaps not) is
completed by deriving from an immutably limited type, then the default
discriminant expression should not be rejected.
gcc/ada/ChangeLog:
* sem_ch6.adb (Check_Discriminant_Conformance): In testing whether
a default expression is permitted for an access discriminant, we
need to know whether the discriminated type is immutably limited.
Handle another part of this test that cannot easily be handled in
Sem_Aux.Is_Immutably_Limited. This involves declaring a new local
function, Is_Derived_From_Immutably_Limited_Type.
|
|
Refine previous fix to better handle tagged cases.
gcc/ada/
* sem_ch6.adb (Check_Discriminant_Conformance): Immediately after
calling Is_Immutably_Limited_Type, perform an additional test that
one might reasonably imagine would instead have been part of
Is_Immutably_Limited_Type. The new test is a call to a new
function Has_Tagged_Limited_Partial_View whose implementation
includes a call to Incomplete_Or_Partial_View, which cannot be
easily be called from Is_Immutably_Limited_Type (because sem_aux,
which is in the closure of the binder, cannot easily "with"
sem_util).
* sem_aux.adb (Is_Immutably_Limited): Include
N_Derived_Type_Definition case when testing Limited_Present flag.
|
|
The messages modified in this patch do not have a clear intended
parent. This causes a lot of issues when grouping continuation
messages together with their parent. This can be confusing as it
is not obvious what was the parent message that caused this
problem or in worst case scenarios the message not being printed
alltogether.
These modified messages do not seem to be related to any concrete
error message and thus should be treated as independent messages.
gcc/ada/
* sem_ch12.adb (Abandon_Instantiation): Remove continuation
characters from the error message.
* sem_ch13.adb (Check_False_Aspect_For_Derived_Type): Remove
continuation characters from the error message.
* sem_ch6.adb (Assert_False): Avoid creating a continuation
message without a parent. If no primary message is created then
the message is considered as primary.
gcc/testsuite/ChangeLog:
* gnat.dg/interface6.adb: Adjust test.
|
|
gcc/ada/
* sem_ch6.adb (Check_Private_Overriding): Improve code detecting
error on private function with controlling result. Fixes the
regression of ACATS bde0003.
|
|
Style cleanup; semantics is unaffected. Offending occurrences found with
grep "^ *:=" and fixed manually.
gcc/ada/
* checks.ads, cstand.adb, exp_aggr.adb, exp_ch4.adb, exp_ch5.adb,
exp_dbug.adb, exp_util.adb, gnatlink.adb, lib-util.adb,
libgnat/a-except.adb, libgnat/a-exexpr.adb, libgnat/a-ngcoar.adb,
libgnat/s-rannum.adb, libgnat/s-trasym__dwarf.adb, osint.adb,
rtsfind.adb, sem_case.adb, sem_ch12.adb, sem_ch13.adb,
sem_ch3.adb, sem_ch6.adb, sem_eval.adb, sem_prag.adb,
sem_util.adb: Fix style.
|
|
This patch adds support for a new GNAT aspect/pragma that modifies
the semantics of dispatching primitives. When a tagged type has
this aspect/pragma, only subprograms that have the first parameter
of this type will be considered dispatching primitives; this new
pragma/aspect is inherited by all descendant types.
gcc/ada/
* aspects.ads (Aspect_First_Controlling_Parameter): New aspect.
Defined as implementation defined aspect that has a static boolean
value and it is converted to pragma when the value is True.
* einfo.ads (Has_First_Controlling_Parameter): New attribute.
* exp_ch9.adb (Build_Corresponding_Record): Propagate the aspect
to the corresponding record type.
(Expand_N_Protected_Type_Declaration): Analyze the inherited
aspect to add the pragma.
(Expand_N_Task_Type_Declaration): ditto.
* freeze.adb (Warn_If_Implicitly_Inherited_Aspects): New
subprogram.
(Has_First_Ctrl_Param_Aspect): New subprogram.
(Freeze_Record_Type): Call Warn_If_Implicitly_Inherited_Aspects.
(Freeze_Subprogram): Check illegal subprograms of tagged types and
interface types that have this new aspect.
* gen_il-fields.ads (Has_First_Controlling_Parameter): New entity
field.
* gen_il-gen-gen_entities.adb (Has_First_Controlling_Parameter):
The new field is a semantic flag.
* gen_il-internals.adb (Image): Add
Has_First_Controlling_Parameter.
* par-prag.adb (Prag): No action for
Pragma_First_Controlling_Parameter since processing is handled
entirely in Sem_Prag.
* sem_ch12.adb (Validate_Private_Type_Instance): When the generic
formal has this new aspect, check that the actual type also has
this aspect.
* sem_ch13.adb (Analyze_One_Aspect): Check that the aspect is
applied to a tagged type or a concurrent type.
* sem_ch3.adb (Analyze_Full_Type_Declaration): Derived tagged
types inherit this new aspect, and also from their implemented
interface types.
(Process_Full_View): Propagate the aspect to the full view.
* sem_ch6.adb (Is_A_Primitive): New subprogram; used to factor
code and also clarify detection of primitives.
* sem_ch9.adb (Check_Interfaces): Propagate this new aspect to the
type implementing interface types.
* sem_disp.adb (Check_Controlling_Formals): Handle tagged type
that has the aspect and has subprograms overriding primitives of
tagged types that lack this aspect.
(Check_Dispatching_Operation): Warn on dispatching primitives
disallowed by this new aspect.
(Has_Predefined_Dispatching_Operation_Name): New subprogram.
(Find_Dispatching_Type): Handle dispatching functions of tagged
types that have the new aspect.
(Find_Primitive_Covering_Interface): For primitives of tagged
types that have the aspect and override a primitive of a parent
type that does not have the aspect, we must temporarily unset
attribute First_Controlling_ Parameter to properly check
conformance.
* sem_prag.ads (Aspect_Specifying_Pragma): Add new pragma.
* sem_prag.adb (Pragma_First_Controlling_Parameter): Handle new
pragma.
* snames.ads-tmpl (Name_First_Controlling_Parameter): New name.
* warnsw.ads (Warn_On_Non_Dispatching_Primitives): New warning.
* warnsw.adb (Warn_On_Non_Dispatching_Primitives): New warning;
not set by default when GNAT_Mode warnings are enabled, nor when
all warnings are enabled (-gnatwa).
|
|
An access discriminant is allowed to have a default value only if the
discriminated type is immutably limited. In the case of a discriminated
limited private type declaration, this rule needs to be checked when
the completion of the type is seen.
gcc/ada/
* sem_ch6.adb (Check_Discriminant_Conformance): Perform check for
illegal access discriminant default values when the completion of
a limited private type is analyzed.
* sem_aux.adb (Is_Immutably_Limited): If passed the
not-yet-analyzed entity for the full view of a record type, test
the Limited_Present flag
(which is set by the parser).
|
|
The value of SPARK_Mode associated with a renaming-as-body might
not be the correct one, when the private part of the package containing
the declaration has SPARK_Mode Off while the public part has SPARK_Mode
On. This may lead to analysis of code by GNATprove that should not be
analyzed.
gcc/ada/
* freeze.adb (Build_Renamed_Body): Propagate SPARK_Pragma to body
build from renaming, so that locally relevant value is taken into
account.
* sem_ch6.adb (Analyze_Expression_Function): Propagate
SPARK_Pragma to body built from expression function, so that
locally relevant value is taken into account.
|
|
...instead of defining it for all entities.
gcc/ada/
* einfo.ads (No_Return): Change description and adjust
accordingly.
* gen_il-gen-gen_entities.adb (Entity_Kind): Remove No_Return.
(Subprogram_Kind): Add No_Return.
(Generic_Subprogram_Kind): Likewise.
* sem_ch6.adb (Analyze_Return_Statement): Adjust No_Return test.
|
|
These semantics state that the compiler is permitted to enforce none of
the guarantees specified by the RM 7.6.1(14/1) and following subclauses,
and to instead just let the exception be propagated upward.
The guarantees impose a significant overhead in terms of complexity and
run-time performance compared to similar constructs in other languages,
and the goal is to reduce it significantly, if not eliminate it totally:
for example, untagged record types declared with the Finalizable aspect,
the relaxed finalization semantics and inline Initialize/Adjust/Finalize
primitives, and used with abort disabled:
pragma Restrictions (No_Abort_Statements);
pragma Restrictions (Max_Asynchronous_Select_Nesting => 0);
pragma Restrictions (No_Asynchronous_Control);
should behave like simple C++ classes.
The implementation morally boils down to undoing the changes made a few
months ago to the support of finalization for controlled objects, i.e.
to getting rid of the added linked list and the associated indirection
for controlled objects with relaxed finalization semantics.
But, in order to keep a unified processing for both kinds of controlled
objects and not to bring back the issues addressed by the aforementioned
changes, the work is split between the front-end and the code generator:
the front-end drops the linked list and the code generator is in charge
of eliminating the indirection with the help of the optimizer.
gcc/ada/
* doc/gnat_rm/gnat_language_extensions.rst (Generalized
Finalization): Update status.
* einfo.ads (Has_Relaxed_Finalization): Add more details.
* exp_ch4.adb (Process_Transients_In_Expression): Invoke
Make_Finalize_Call_For_Node instead of building the call.
* exp_ch5.adb (Expand_N_Assignment_Statement): Do not set up an
exception handler around the assignment for a controlled type with
relaxed finalization semantics. Streamline the code implementing
the protection against aborts and do not use an At_End handler for
a controlled type with relaxed finalization semantics.
* exp_ch7.ads (Make_Finalize_Call_For_Node): New function.
* exp_ch7.adb (Finalize_Address_For_Node): New function renaming.
(Set_Finalize_Address_For_Node): New procedure renaming.
(Attach_Object_To_Master_Node): Also attach the Finalize_Address
primitive to the Master_Node statically.
(Build_Finalizer): Add Has_Strict_Ctrl_Objs local variable. Insert
back the body of the finalizer at the end of the statement list in
the non-package case and restore the associated support code to
that effect. When all the controlled objects have the relaxed
finalization semantics, do not create a Finalization_Master and
finalize the objects directly instead.
(Processing_Actions): Add Strict parameter and use it to set the
Has_Strict_Ctrl_Objs variable.
(Process_Declarations): Make main loop more robust and adjust
calls to Processing_Actions.
(Make_Finalize_Address_Body): Mark the primitive as inlined if the
type has relaxed finalization semantics.
(Make_Finalize_Call_For_Node): New function.
* sem_ch6.adb (Check_Statement_Sequence): Skip subprogram bodies.
* libgnat/s-finpri.ads (Finalize_Object): Add Finalize_Address
parameter.
(Master_Node): Remove superfluous qualification.
* libgnat/s-finpri.adb (Attach_Object_To_Node): Likewise.
(Finalize_Master): Adjust calls to Finalize_Object.
(Finalize_Object): Add Finalize_Address parameter and assert that
it is equal to the component of the node. Use the Object_Address
component as guard.
(Suppress_Object_Finalize_At_End): Clear Object_Address component.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.
|
|
The support for generating C for Ada code is moved to GNAT LLVM.
Keep support for generating header files from Ada spec files which
is the remaining usage of -gnatceg.
gcc/ada/
* bindgen.adb, bindusg.adb, debug.adb, einfo.ads,
exp_aggr.adb, exp_attr.adb, exp_ch11.adb, exp_ch3.adb,
exp_ch4.adb, exp_ch6.adb, exp_ch7.adb, exp_ch8.adb, exp_dbug.adb,
exp_dbug.ads, exp_intr.adb, exp_unst.adb, exp_util.adb,
exp_util.ads, freeze.adb, gen_il-fields.ads,
gen_il-gen-gen_entities.adb, gnat1drv.adb, inline.adb, opt.ads,
osint-c.adb, osint-c.ads, sem_attr.adb, sem_ch12.adb, sem_ch3.adb,
sem_ch4.adb, sem_ch6.adb, sem_elab.adb, sem_res.adb, sinfo.ads,
snames.ads-tmpl, switch-b.adb, switch-c.adb: Major
clean up to remove C code generation for bodies.
|
|
wrappers
Implicit wrapper overridings generated for functions with
controlling result when deriving with null extension may
have field Overridden_Operation incorrectly set, when making
several such derivations in succession. This happens because
overridings were assumed to come from source, and entities
generated by Derive_Subprograms were also assumed to be
derived from source subprograms. Overridden_Operation could
be set to the entity generated by Derive_Subprograms for the
same type, resulting in a cycle between Overriden_Operation
and Alias fields, causing non-termination in GNATprove.
gcc/ada/
* sem_ch6.adb (Check_Overriding_Indicator) Remove Comes_From_Source filter.
(New_Overloaded_Entity) Move up special case of LSP_Subprogram,
and remove Comes_From_Source filter.
|
|
This patch implements mutably tagged types via the new Size'Class aspect.
gcc/ada/
* doc/gnat_rm/gnat_language_extensions.rst: Add documentation for
mutably tagged type feature.
* aspects.ads: Add registration for 'Size'Class.
* einfo.ads: Add documentation for new components
Class_Wide_Equivalent_Type and Is_Mutably_Tagged_Type.
* exp_aggr.adb (Gen_Assign): Assume associated mutably tagged type
when class-wide equivalent type is encountered.
(Contains_Mutably_Tagged_Type): New subprogram.
(Convert_To_Positional): Assume associated mutably tagged type
when class-wide equivalent type is encountered.
(Is_Static_Element): Assume associated mutably tagged type when
class-wide equivalent type is encountered.
(Expand_Array_Aggregate): Assume associated mutably tagged type
when class-wide equivalent type is encountered.
(Expand_Record_Aggregate): Force mutably tagged records to be
expanded into assignments.
* exp_ch3.adb (Build_Array_Init_Proc): Assume associated mutably
tagged type when class-wide equivalent type is encountered.
(Simple_Initialization_OK): Disallow simple initialization for
class-wide equivalent types.
(Build_Init_Statements): Assume associated mutably tagged type
when class-wide equivalent type is encountered.
(Expand_Freeze_Array_Type): Ignore building of record init procs
for mutably tagged types.
(Expand_N_Full_Type_Declaration): Replace mutably tagged type
declarations with their associated class-wide equivalent types.
(Default_Initialize_Object): Add special handling for mutably
tagged types.
* exp_ch4.adb (Expand_N_Allocator): Add initialization for mutably
tagged types.
(Expand_Record_Equality): Generate mutably tagged unchecked
conversions.
* exp_ch5.adb (Expand_N_Assignment_Statement): Generate a special
assignment case for class-wide equivalent types which does tag
assignments and ignores certain checks.
* exp_ch6.adb (Expand_Call_Helper): Propagate constrained extra
formal actuals for mutably tagged types.
* exp_ch7.adb (Make_Init_Call): Handle mutably tagged type
initialization.
* exp_util.adb (Make_CW_Equivalent_Type): Modify to handle mutably
tagged objects which contain no initialization expression.
(Make_Subtype_From_Expr): Modify call to Make_CW_Equivalent_Type.
* exp_util.ads (Make_CW_Equivalent_Type): Move declaration from
body to spec.
* freeze.adb (Size_Known): No longer return false automatically
when a class-wide type is encountered.
(Freeze_Entity): Ignore error messages about size not being known
for mutably tagged types.
* gen_il-fields.ads: Register new fields
Class_Wide_Equivalent_Type and Is_Mutably_Tagged_Type.
* gen_il-gen-gen_entities.adb: Register new fields
Class_Wide_Equivalent_Type and Is_Mutably_Tagged_Type for type
entities.
* mutably_tagged.adb, mutably_tagged.ads
(Corresponding_Mutably_Tagged_Type): New subprogram.
(Depends_On_Mutably_Tagged_Ext_Comp): New subprogram.
(Get_Corresponding_Mutably_Tagged_Type_If_Present): New
subprogram.
(Get_Corresponding_Tagged_Type_If_Present): New subprogram.
(Is_Mutably_Tagged_Conversion): New subprogram.
(Is_Mutably_Tagged_CW_Equivalent_Type): New subprogram.
(Make_Mutably_Tagged_Conversion): New subprogram.
(Make_CW_Size_Compile_Check): New subprogram.
(Make_Mutably_Tagged_CW_Check): New subprogram.
* sem_aggr.adb (Resolve_Array_Aggregate): Skip tag checks for
class-wide equivalent types.
(Resolve_Aggr_Expr): Assume associated mutably tagged type when
class-wide equivalent type is encountered.
* sem_attr.adb (Analyze_Attribute): Allow 'Tag on mutably tagged
types.
(Resolve_Attribute): Detect errors for dependence of mutably
tagged extension type component.
* sem_ch12.adb (Instantiate_Object): Detect errors for dependence
of mutably tagged extension type component.
* sem_ch13.adb (Analyze_One_Aspect): Propagate 'Size'Class to
class-wide type.
(Analyze_Attribute_Definition_Clause): Add handling of 'Size'Class
by generating class-wide equivalent types and checking for illegal
uses.
* sem_ch2.adb (Analyze_Identifier): Generate unchecked conversion
for class-wide equivalent types.
* sem_ch3.adb (Analyze_Component_Declaration): Avoid unconstrained
errors on mutably tagged types.
(Analyze_Object_Declaration): Rewrite declarations of mutably
tagged types to use class-wide equivalent types.
(Array_Type_Declaration): Modify arrays of mutably tagged types to
use their corresponding class-wide equivalent types.
(Derived_Type_Declaration): Add various checks for mutably tagged
derived types.
* sem_ch4.adb (Analyze_Allocator): Replace reference to mutably
tagged type with cooresponding tagged type.
(Process_Indexed_Component): Generate unchecked conversion for
class-wide equivalent type.
(Analyze_One_Call): Generate unchecked conversion for class-wide
equivalent types.
(Analyze_Selected_Component): Assume reference to class-wide
equivalent type is associated mutably tagged type.
(Analyze_Type_Conversion): Generate unchecked conversion for
class-wide equivalent type.
* sem_ch5.adb (Analyze_Assignment): Assume associated mutably
tagged type when class-wide equivalent type is encountered.
(Analyze_Iterator_Specification): Detect errors for dependence of
mutably tagged extension type component.
* sem_ch6.adb (Create_Extra_Formals): Add code to generate extra
formal for mutably tagged types to signal if they are constrained.
* sem_ch8.adb (Analyze_Object_Renaming): Detect error on renaming
of mutably tagged extension type component.
(Analyze_Renaming_Primitive_Operation): Detect error on renaming
of mutably tagged extension type component.
* sem_res.adb (Resolve_Actuals): Allow class-wide arguments on
class-wide equivalent types.
(Valid_Conversion): Assume associated mutably tagged type when
class-wide equivalent type is encountered.
* sem_util.adb (Is_Fully_Initialized_Type): Flag mutably tagged
types as fully initialized.
(Needs_Simple_Initalization): Flag class-wide equivalent types as
needing initialization.
* gnat_rm.texi: Regenerate.
* gcc-interface/Make-lang.in: Add entry for mutably_tagged.o.
|
|
Add entities of kind E_Subprogram_Body to the list of entities associated
to a given scope. This ensures that representation information is
correctly output for object and type declarations inside these subprogram
bodies. This is useful for outputing that information fron the compiler
with the switch -gnatR, as well as for getting precise representation
information inside GNATprove.
Remove ad-hoc code inside repinfo.adb that retrieved this information
in only some cases.
gcc/ada/
* exp_ch5.adb (Expand_Iterator_Loop_Over_Container): Skip entities
of kind E_Subprogram_Body.
* repinfo.adb (List_Entities): Remove special case for subprogram
bodies.
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): List subprogram
body entities in the enclosing scope.
|
|
At runtime the code generated by the compiler reports the
exception Storage_Error in an indirect call through an
access-to-subprogram variable that references a function
returning a limited tagged type object.
gcc/ada/
* sem_ch6.adb (Might_Need_BIP_Task_Actuals): Add support
for access-to-subprogram parameter types.
* exp_ch6.adb (Add_Task_Actuals_To_Build_In_Place_Call):
Add dummy BIP parameters to access-to-subprogram types
that may reference a function that has BIP parameters.
|
|
The compiler triggers warnings on generated protected procedures
if the procedure does not have an explicit spec. Instead check
if the body was created for a protected procedure if the spec
is not present.
gcc/ada/
* sem_ch6.adb (Analyze_Subprogram_Body_Helper):
If the spec is not present for a subprogram body then
check if the body definiton was created for a protected
procedure.
|
|
This occurs in the additional case of RM 3.9.3(10) in Ada 2012, that is to
say the access controlling result, because the implementation does not use
the same (correct) conditions as in the original case.
This factors out these conditions and uses them in both cases, as well as
adjusts the wording of the message in the first case.
gcc/ada/
* sem_ch6.adb (Check_Private_Overriding): Implement the second part
of RM 3.9.3(10) consistently in both cases.
|
|
Update checking of ghost code after a small change in SPARK RM
rules 6.9(15) and 6.9(20), so that the Ghost assertion policy
that matters when checking the validity of a reference to a ghost entity
in an assertion expression is the Ghost assertion policy at the point
of declaration of the entity.
Also fix references to SPARK RM rules in comments, which were off by two
in many cases after the insertion of rules 13 and 14 regarding generic
instantiations.
gcc/ada/
* contracts.adb: Fix references to SPARK RM rules.
* freeze.adb: Same.
* ghost.adb: Fix references to SPARK RM rules.
(Check_Ghost_Context): Update checking of references to
ghost entities in assertion expressions.
* sem_ch6.adb: Fix references to SPARK RM rules.
* sem_prag.adb: Same.
|
|
Remove flag Split_PPC and all its uses.
gcc/ada/
* contracts.adb (Append_Enabled_Item): Remove use of Split_PPC;
simplify.
* gen_il-fields.ads (Opt_Field_Enum): Remove flag definition.
* gen_il-gen-gen_nodes.adb (N_Aspect_Specification, N_Pragma):
Remove Split_PPC flags.
* gen_il-internals.adb (Image): Remove use of Split_PPC.
* par_sco.adb (Traverse_Aspects): Likewise.
* sem_ch13.adb (Make_Aitem_Pragma): Likewise.
* sem_ch6.adb (List_Inherited_Pre_Post_Aspects): Likewise.
* sem_prag.adb (Analyze_Pre_Post_Condition, Analyze_Pragma,
Find_Related_Declaration_Or_Body): Likewise.
* sem_util.adb (Applied_On_Conjunct): Likewise.
* sinfo.ads: Remove flag documentation.
* treepr.adb (Image): Remove use of Split_PPC.
|
|
This change replaces finalization masters with finalization collections in
most cases, that is to say, when they implement a list of objects created
by allocators of a given access type; indeed the moniker is overloaded in
the front-end, e.g. Sem_Util.Is_Master determines if a node "constitutes
a finalization master" but is not affected by the change.
This is mostly a renaming at this stage, toward something more in keeping
with the terminology used in the RM 7.6.1 clause and no functional changes:
although it gets rid of the rest of the System.Finalization_Masters unit,
the functionalities are reimplemented in the System.Finalization_Primitives
unit in terms of collections with only minor adjustments.
gcc/ada/
* Makefile.rtl (GNATRTL_NONTASKING_OBJS): Remove s-finmas$(objext).
* einfo.ads (Anonymous_Masters): Rename into Anonymous_Collections.
(Finalization_Master): Rename into Finalization_Collection.
* gen_il-fields.ads (Opt_Field_Enum): Replace Anonymous_Masters
with Anonymous_Collections; and Finalization_Master with
Finalization_Collection.
* gen_il-gen-gen_entities.adb (Access_Kind): Likewise.
(E_Function): Likewise.
(E_Procedure): Likewise.
(E_Package): Likewise.
(E_Subprogram_Body): Likewise.
* exp_ch3.adb (Build_Heap_Or_Pool_Allocator): Adjust to renamings.
(Freeze_Type): Likewise.
(Stream_Operation_OK): Remove obsolete test.
* exp_ch4.adb (Expand_Allocator_Expression): Adjust to renamings.
(Expand_N_Allocator): Likewise.
* exp_ch6.ads (BIP_Formal_Kind): Replace BIP_Finalization_Master
with BIP_Collection.
(Needs_BIP_Finalization_Master): Rename into...
(Needs_BIP_Collection): ...this.
* exp_ch6.adb (BIP_Finalization_Master_Suffix): Delete.
(BIP_Collection_Suffix): New constant string.
(Add_Finalization_Master_Actual_To_Build_In_Place_Call): Rename to
(Add_Collection_Actual_To_Build_In_Place_Call): ...this and adjust.
(BIP_Formal_Suffix): Replace BIP_Finalization_Master alternative
with BIP_Collection alternative.
(BIP_Suffix_Kind): Replace test on BIP_Finalization_Master_Suffix
with test on BIP_Collection_Suffix.
(Is_Build_In_Place_Entity): Likewise.
(Make_Build_In_Place_Call_In_Allocator): Call Needs_BIP_Collection
and Add_Collection_Actual_To_Build_In_Place_Call.
(Make_Build_In_Place_Call_In_Anonymous_Context): Likewise.
(Make_Build_In_Place_Call_In_Assignment): Likewise.
(Make_Build_In_Place_Call_In_Object_Declaration): Likewise.
(Needs_BIP_Finalization_Master): Rename into...
(Needs_BIP_Collection): ...this.
(Needs_BIP_Alloc_Form): Call Needs_BIP_Collection.
* exp_ch7.ads (Build_Anonymous_Master): Rename into...
(Build_Anonymous_Collection): ...this.
(Build_Finalization_Master): Rename into...
(Build_Finalization_Collection): ...this.
* exp_ch7.adb (Allows_Finalization_Master): Rename into...
(Allows_Finalization_Collection): ...this.
(Build_BIP_Cleanup_Stmts): Adjust to renamings.
(Build_Anonymous_Master): Rename into...
(Build_Anonymous_Collection): ...this. Adjust to renamings.
(Build_Finalization_Master): Rename into...
(Build_Finalization_Collection): ...this. Adjust to renamings.
(Build_Finalizer): Adjust comment to renamings.
* exp_ch13.adb (Expand_N_Free_Statement): Adjust to renamings.
* exp_util.adb (Build_Allocate_Deallocate_Proc): Likewise.
(Requires_Cleanup_Actions): Adjust comment to renamings.
* freeze.adb (Freeze_All): Likewise.
* rtsfind.ads (RTU_Id): Remove System_Finalization_Masters.
(RE_Id): Remove RE_Finalization_Master & RE_Finalization_Master_Ptr
add RE_Finalization_Collection & RE_Finalization_Collection_Ptr.
Adjust RE_Add_Offset_To_Address and RE_Finalization_Scope_Master.
(RE_Unit_Table): Remove entries for RE_Finalization_Master &
RE_Finalization_Master_Ptr, add ones for RE_Finalization_Collection
& RE_Finalization_Collection_Ptr. Also adjust those of
RE_Add_Offset_To_Address and RE_Finalization_Scope_Master.
* sem_ch3.adb (Access_Type_Declaration): Adjust to renamings.
* sem_ch6.adb (Create_Extra_Formals): Likewise.
* sem_util.adb (Designated_Subtype_Mark): Likewise.
* libgnat/s-finpri.ads: Add clauses for Ada.Finalization and
System.Storage_Elements.
(Finalization_Collection): New limited controlled type.
(Finalization_Collection_Ptr): Likewise.
(Initialize): New overriding procedure.
(Finalize): Likewise.
(Finalization_Started): Likewise.
(Collection_Node): New type.
(Collection_Node_Ptr): Likewise.
(Attach_Node_To_Collection): New procedure.
(Detach_Node_From_Collection): Likewise.
(Header_Size): New function.
(Add_Offset_To_Address): Likewise.
* libgnat/s-finpri.adb (Add_Offset_To_Address): New function.
(Attach_Node_To_Collection): New procedure.
(Detach_Node_From_Collection): Likewise.
(Finalization_Started): Likewise.
(Finalize): New overriding procedure.
(Header_Size): New function.
(Initialize): New overriding procedure.
* libgnat/s-spsufi.ads (Finalize_And_Deallocate): Adjust comment.
* libgnat/s-spsufi.adb: Remove clause for Finalization_Masters and
add clause for Finalization_Primitives.
(Finalize_And_Deallocate): Finalize the Collection component.
* libgnat/s-stposu.ads: Remove clause for Finalization_Masters and
add clause for Finalization_Primitives.
(Root_Subpool): Replace Master component with Collection.
(Allocate_Any_Controlled): Replace Context_Master parameter with
Context_Collection parameter.
* libgnat/s-stposu.adb: Remove clauses for Finalization_Masters and
add clauses for Finalization_Primitives.
(Address_To_FM_Node_Ptr): Delete.
(To_Collection_Node_Ptr): New instance of Ada.Unchecked_Conversion.
(Adjust_Controlled_Dereference): Adjust comment to renamings.
(Allocate_Any_Controlled): Replace Context_Master parameter with
Context_Collection parameter. Adjust to renamings.
(Deallocate_Any_Controlled): Adjust to renamings.
(Print_Subpool): Likewise.
* libgnat/s-finmas.ads: Delete.
* libgnat/s-finmas.adb: Likewise.
|
|
|
|
Add missing support for RM 9.5.4(5.6/4): the target of a requeue
statement may be a procedure when its name denotes a renaming of
an entry.
gcc/ada/
* sem_ch6.adb (Analyze_Subprogram_Specification): Do not replace
the type of the formals with its corresponding record in
init-procs.
* sem_ch9.adb (Analyze_Requeue): Add missing support to requeue to
a procedure that denotes a renaming of an entry.
|
|
Previously if a subprogram call could not be inlined in GNATprove mode,
then all subsequent calls to the same subprogram were not inlined
either (because a failed attempt to inline clears flag Is_Inlined_Always
and we tested this flag when attempting to inline subsequent calls).
Now a failure in inlining of a particular call does not prevent inlining
of subsequent calls to the same subprogram, except when inlining failed
because the subprogram was detected to be recursive (which clears the
Is_Inlined flag that we now examine).
This change allows more checks to be proved and reduces interactions
between inlining and SPARK legality checks.
gcc/ada/
* sem_ch6.adb (Analyze_Subprogram_Specification): Set Is_Inlined
flag by default in GNATprove mode.
* sem_res.adb (Resolve_Call): Only look at flag which is cleared
when inlined subprogram is detected to be recursive.
|
|
SPARK legality checks apply only to code with SPARK_Mode On, and are
performed again in GNATprove for detecting SPARK-compatible declarations
in code with SPARK_Mode Auto. Remove this duplication, to only perform
SPARK legality checking in GNATprove. After this patch, only a few
special SPARK legality checks are performed in the frontend, which could
be moved to GNATprove later.
gcc/ada/
* contracts.adb (Analyze_Entry_Or_Subprogram_Body_Contract):
Remove checking on volatility. Remove handling of SPARK_Mode, not
needed anymore.
(Analyze_Entry_Or_Subprogram_Contract): Remove checking on
volatility.
(Check_Type_Or_Object_External_Properties): Same.
(Analyze_Object_Contract): Same.
* freeze.adb (Freeze_Record_Type): Same. Also remove checking on
synchronized types and ghost types.
* sem_ch12.adb (Instantiate_Object): Remove checking on
volatility.
(Instantiate_Type): Same.
* sem_ch3.adb (Access_Type_Declaration): Same.
(Derived_Type_Declaration): Remove checking related to untagged
partial view.
(Process_Discriminants): Remove checking on volatility.
* sem_ch5.adb (Analyze_Loop_Parameter_Specification): Same.
* sem_ch6.adb (Analyze_Procedure_Call): Fix use of SPARK_Mode
where GNATprove_Mode was intended.
* sem_disp.adb (Inherited_Subprograms): Protect against Empty
node.
* sem_prag.adb (Analyze_Global_In_Decl_Part): Remove checking on
volatility.
(Analyze_Pragma): Same.
* sem_res.adb (Flag_Effectively_Volatile_Objects): Remove.
(Resolve_Actuals): Remove checking on volatility.
(Resolve_Entity_Name): Same.
* sem_util.adb (Check_Nonvolatile_Function_Profile): Remove.
(Check_Volatility_Compatibility): Remove.
* sem_util.ads: Same.
|
|
Correct spelling does not include an hyphen. Fix comments and one
error message.
Also fix other mispellings of "side-effect" or "side effect" depending
on the case (adjective should have hyphen), and "side-effect-free" with
double hyphen as an adjective.
gcc/ada/
* checks.adb, exp_aggr.adb, exp_ch4.ads, exp_ch5.adb,
exp_util.adb, exp_util.ads, inline.adb, sem_ch13.adb,
sem_ch6.adb, sem_ch8.adb, sem_prag.adb, sem_util.ads: Fix comments
and typos.
|
|
Function Sem_Aux.Is_Limited_View returns whether the type is
"inherently limited" in a slightly different way from the "immutably
limited" definition in Ada 2012. Rename for clarity.
gcc/ada/
* exp_aggr.adb: Apply the renaming.
* exp_ch3.adb: Same.
* exp_ch4.adb: Same.
* exp_ch6.adb: Same.
* exp_ch7.adb: Same.
* exp_util.adb: Same.
* freeze.adb: Same.
* sem_aggr.adb: Same.
* sem_attr.adb: Same.
* sem_aux.adb: Alphabetize Is_Limited_Type. Rename.
* sem_aux.ads: Same.
* sem_ch3.adb: Apply the renaming.
* sem_ch6.adb: Same.
* sem_ch8.adb: Same.
* sem_prag.adb: Same.
* sem_res.adb: Same.
* sem_util.adb: Same.
|