Age | Commit message (Collapse) | Author | Files | Lines |
|
As explained in the comments, the CodePeer_Mode AST isn't well-formed
for a GCC back-end, but is fine for a CodePeer one. The checks ensuring
that the AST is well-formed thus need to be disabled.
gcc/ada/ChangeLog:
* exp_ch6.adb (Check_BIP_Actuals, Process_Node): Disable checks.
|
|
This patch adds support for a new GNAT aspect/pragma for integer
type definitions to explicitly enforce the use of an unsigned
base type.
gcc/ada/ChangeLog:
* aspects.ads (Aspect_Unsigned_Base_Range): New aspect.
* checks.adb (Determine_Range): Handle types with unsigned base range aspect.
(Enable_Overflow_Check): ditto
(Apply_Arithmetic_Overflow_Strict): ditto
* debug.adb (d_o): Document new usage.
* einfo.ads (Has_Unsigned_Base_Range_Aspect): New flag.
* exp_attr.adb (Expand_N_Attribute_Reference): No action since
it has been already handled at this stage.
* exp_ch4.adb (Expand_N_Op_Add): Generate aritmetic overflow check on
unsigned base range type operands.
(Expand_N_Op_Subtract): ditto
(Expand_N_Op_Multiply): ditto
(Expand_N_Op_Minus): ditto
* gen_il-fields.ads (Has_Unsigned_Base_Range_Aspect): New flag.
* gen_il-gen-gen_entities.adb (Has_Unsigned_Base_Range_Aspect): New flag.
* gen_il-internals.adb (Has_Unsigned_Base_Range_Aspect): New flag.
* gnat1drv.adb (Adjust_Global_Switches): Handle -gnatd_o
* par-prag.adb (Pragma_Unsigned_Base_Range): No action since it will
be entirely handled by the semantic analyzer.
* rtsfind.ads (RE_Id): Add RE_Uns_[Add|Subtract|Multiply]_With_ Ovflo_Check
* sem_attr.ads (Attribute_Unsigned_Base_Range): Added to the set of
implementation defined attributes.
* sem_attr.adb (Analyze_Attribute): Analyze attribute Unsigned_Base_Range.
(Eval_Attribute): Evaluate attribute Unsigned_Base_Range.
* sem_ch13.adb (Analyze_One_Aspect): Defer checks for this aspect to
the analysis of the corresponding pragma.
* sem_ch3.ads (Unsigned_Base_Range_Type_Declaration): New subprogram.
* sem_ch3.adb (Build_Derived_Numeric_Type): Inherit flag
Has_Unsigned_Base_Range_Aspect.
(Unsigned_Base_Range_Type_Declaration): New subprogram.
(Has_Pragma_Unsigned_Base_Range): New subprogram.
* sem_prag.adb (Analyze_Pragma): Handle Pragma_Unsigned_Base_Range.
* snames.adb-tmpl (Get_Pragma_Id): Handle Name_Unsigned_Base_Range.
(Is_Pragma_Name): ditto.
* snames.ads-tmpl (Name_Unsigned_Base_Range): New name.
(Attribute_Unsigned_Base_Range): New attribute.
(Pragma_Unsigned_Base_Range): New pragma.
* libgnat/s-aridou.ads (Add_With_Ovflo_Check): New routine for Double_Uns.
(Subtract_With_Ovflo_Check): ditto.
(Multiply_With_Ovflo_Check): ditto.
* libgnat/s-aridou.adb (Add_With_Ovflo_Check): ditto.
(Subtract_With_Ovflo_Check): ditto.
(Multiply_With_Ovflo_Check): ditto.
* libgnat/s-arit64.ads (Uns_Add_With_Ovflo_Check64): New subprogram.
(Uns_Subtract_With_Ovflo_Check64): ditto.
(Uns_Multiply_With_Ovflo_Check64): ditto.
* libgnat/s-arit64.adb (Uns_Add_With_Ovflo_Check64): New subprogram.
(Uns_Subtract_With_Ovflo_Check64): ditto.
(Uns_Multiply_With_Ovflo_Check64): ditto.
* libgnat/s-arit128.ads (Uns_Add_With_Ovflo_Check128): New subprogram.
(Uns_Subtract_With_Ovflo_Check128): ditto.
(Uns_Multiply_With_Ovflo_Check128): ditto.
* libgnat/s-arit128.adb (Uns_Add_With_Ovflo_Check128): New subprogram.
(Uns_Subtract_With_Ovflo_Check128): ditto.
(Uns_Multiply_With_Ovflo_Check128): ditto.
* doc/gnat_rm/gnat_language_extensions.rst: Document unsigned
base range.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.
|
|
Adds support for the new language feature that allows ghost enties and
assertion pragmas and aspects to be associated with a new entity called
assertion level.
Added support for a new pragma Assertion_Level that declares new
assertion levels. This pragma consists of the level name and assertion
levels it depends on.
pragma Assertion_Level (L1);
pragma Assertion_Level (L2);
pragma Assertion_Level (L3, Depends => [L1, L2]);
There are two special assertion levels that are considered to be
declared in the Standard package that have unique properties.
Assertion level Runtime is always considered to be Checked. Its
assertion policy cannot be changed and it is considered that all other
assertion levels depend on this level.
Assertion level Static is always considered to be Ignored. Its assertion
policy cannot be changed. All assertion levels that depend on this
level can also never be activated.
Aspect Ghost now supports the assertion level as a possible argument:
... with Ghost => Level;
All pragmas and aspects which were considered to be valid assertion
kinds for pragma Assertion_Policy now support assertion level
associations. The association consists of an assertion level and a set
of existing arguments. Note that you can have multiple assertion level
associations in a given pragma or aspect. e.g.
pragma Assert (Level1 => (Check => Expr1, Message => "Msg1",
Level2 => (Check => Expr2, Message => "Msg2"));
It is possible to set an explicit Assertion_Policy for those levels
which can control the policies for all entities associated with those
levels.
Setting the policy Check for a given level means also that policy Check
is set for all of the policies that it depends on. From the previous
example.
pragma Assertion_Policy (L3 => Check);
is equivalent to:
pragma Assertion_Policy (L1 => Check);
pragma Assertion_Policy (L2 => Check);
pragma Assertion_Policy (L3 => Check);
Setting the policy Ignore for a given level means that the policy Ignore
is also applied to all the levels that depend on it. e.g
pragma Assertion_Policy (L2 => Ignore);
is equivalent to:
pragma Assertion_Policy (L2 => Ignore);
pragma Assertion_Policy (L3 => Ignore);
Since now ghost regions can contain other ghost regions with a different
assertion policy then new rules needed to be added for those situations
to ensure valid compilation.
Additionally all rules where we checked for compatible assertion
policies have an additional check for a compatible assertion level dependencies.
Ghost entities A and B are considered assertion level dependent when
* A or B does not have an associated assertion level.
* Both A and B have an assertion level and either
* the level of A is or depends on the level of B.
* the level of B cannot be enabled (is or depends on Static)
gcc/ada/ChangeLog:
* atree.adb (Mark_New_Ghost_Node): Store the assertion level on the
entity.
* contracts.adb (Analyze_Package_Contract): Add support for multiple
pragma Initial_Condition orginating from multiple assertion levels.
* cstand.adb (Make_Assertion_Level_Definition): New function that
creates a new Assertion_Level and adds it to the Assertion_Levels
table.
(Create_Standard): Add definitions for assertion levels defined in
Standard.
(Print_Standard): Add assertion level pragmas do the output.
* exp_ch6.adb (Check_Subprogram_Variant): Add support for multiple
Subprogram_Variant pragmas created by assertion levels.
* einfo.ads: add info for the new nodes and attributes.
* exp_prag.adb (Consequence_Error): Fix error message string
corruption caused by another call to the internal strings during
the call to Make_Procedure_Call_Statement.
(Expand_Pragma_Initial_Condition): Ensure all ghost related
attributes are copied to the new pragma.
(Expand_Pragma_Loop_Variant): Likewise.
(Expand_Pragma_Subprogram_Variant). Likewise. Additionally
create a new Subprogram_Variant function for each pragma associated
with an assertion level.
* exp_util.adb (Add_DIC_Check): Ensure all ghost related attributes
are copied to the new pragma.
(Build_DIC_Procedure_Body): Add support for mutliple DIC pragmas
created from assertion levels.
* gen_il-fields.ads:
(Aspect_Ghost_Assertion_Level): New field.
(Original_Aspect): New field.
(Original_Pragma): New field.
(Pragma_Ghost_Assertion_Level): New field.
(Child_Levels): New field.
(Ghost_Assertion_Level): New field.
(Parent_Levels): New field.
* gen_il-gen-gen_entities.adb:
Add Ghost_Assertion_Level field for all entities
Add new E_Assertion_Level entity for storing assertion levels.
* gen_il-gen-gen_nodes.adb:
Add Aspect_Ghost_Assertion_Level for N_Aspect to store the
assertion level associated with the aspect.
Add Original_Aspect to store the original aspect where the aspect
that was transformed from an aspect with an assertion level
origninated from.
Add Pragma_Ghost_Assertion_Level and Original_Pragma to store
the same information for N_Prama nodes.
* gen_il-types.ads: Add new entity kind E_Assertion_Level
* ghost.adb (Assertion_Level_Error_Msg): Create constant for
error messages using the same main error message.
(Ghost_Policy_Error_Msg): Likewise.
(Assertion_Level_To_Name): New subprogram.
(Check_Valid_Ghost_Declaration): New subprogram.
(Get_Ghost_Aspect): New subprogram.
(Get_Ghost_Assertion_Level): New subprogram.
(Ghost_Policy_In_Effect): New subprogram.
(Install_Ghost_Region): New subprogram.
(Mark_And_Set_Ghost_Region): New subprogram.
(Mark_Ghost_Declaration_Or_Body): Add new argument for assertion
levels.
(Check_Ghost_Completion): Update ghost policy calculation with
assertion levels. Refactor error message.
(Is_OK_Statement): Add new checks for valid assertion policies and
assertion levels.
(Is_OK_Pragma): Refactor the calculation of valid ghost pragmas.
(Check_Ghost_Policy): Make the checks ghost region based.
(Check_Ghost_Context): Refactor the order of checks.
(Check_Ghost_Formal_Procedure_Or_Package): Relax the checks for
overriding procedures. Now only ignored subprograms cannot be
overridden by checked or non-ghost subprograms.
(Check_Ghost_Primitive): Relax conditions for primitve operations.
Now only checked primitive subprograms are considered invalid for
ignored tagged types. Add assertion level compatibility checks.
(Check_Ghost_Refinement): Relax conditions for ghost refinements.
Add assertion level compatibility checks for refinements.
(Install_Ghost_Region): Store the current region and the assertion
for that region in the ghost config.
(Enables_Ghostness): Refactor implementation to support assertion
levels.
(Is_Subject_To_Ghost): Simplify implementation.
(Mark_And_Set_Ghost_Assignment): Refactor implementation.
(Mark_And_Set_Ghost_Body): Add support for assertion levels.
(Mark_And_Set_Ghost_Completion): Likewise.
(Mark_And_Set_Ghost_Declaration): Likwise.
(Mark_And_Set_Ghost_Instantiation): Likwise.
(Mark_And_Set_Ghost_Procedure_Call): Refactor implementation.
(Mark_Ghost_Declaration_Or_Body): Add support for assertion levels.
(Set_Ghost_Mode): Likwise.
* ghost.ads (Assertion_Level_From_Arg): New subprogram.
(Install_Ghost_Region): Add argument Level for assertrion levels.
(Is_Assertion_Level_Dependent): New subprogram.
* lib-xref.ads: Add new mapping for E_Assertion_Level entities.
* opt.ads (Ghost_Config_Type): Add new members Ghost_Assertion_Mode
and Current_Region to the structure.
* par-prag.adb (Prag): Add new pragma name Assertion_Level.
* rtsfind.adb (Load_RTU): Update the arguments for the call to
Install_Ghost_Region.
* sem.adb (Do_Analyze): Likewise.
* sem_ch13.adb (Convert_Aspect_With_Assertion_Levels): New
subprogram.
(Make_Aitem_Pragma): Copy ghost mode attributes from the aspect to
the pragma.
(Analyze_Aspect_Specifications): Convert aspects that have an
assertion level association in the aspects without the association
and the original supported syntax and with the assertion level
stored on the aspect node.
Updated duplicate detection to avoid duplicates being called on
aspects with assertion levels that orginated from the same aspect.
* sem_prag.adb (Apply_Check_Policy): New subprogram.
(Get_Applicable_Policy): New subprogram.
(Mark_Is_Checked): New subprogram.
(Mark_Is_Disabled): New subprogram.
(Mark_Is_Ignored): New subprgram.
(Check_Arg_Is_One_Of): Remove versions that had a specific number
of arguments and replace them with a list one.
(Create_Pragma_Without_Assertion_Level): New subprogram.
(Assertion_Level_Pragma_Comes_From_Source): New subprogram.
(Analyze_Pragma): Replace aspects that have an assertion level
with aspects without them where the level is stored on the pragma
node.
(Abstract_State): Add support for assertion levels in ghost
Abstract_State pragmas.
(Assert): Update argument handling for Assert like pragmas.
(Assertion_Level): Add a new section to support the analysis of
pragma Assertion_Level.
(Assertion_Policy): Add support for setting the policy for assertion
levels.
(Check): Update argument handling. Update the assertion policy
application process.
(Check_Policy): Add support for assertion levels. Add check_policy
pragmas for assertion_level dependencis also to the stack of
known Check_Policy pragmas.
(Default_Initial_Condition): Reject the use of DIC with assertion
levels. Update duplication checks.
(Ghost): Add support for assertion levels. Fix issue where
assertion levels with Ghost => False were treated as ghost.
(Predicate): Update the policy handling of Ghost_Predicate.
(Analyze_Refined_State_In_Decl_Part): Create a new ghost region
for analyzing Refined_State.
(Check_Applicable_Policy): Refactor the implementation. Break it
down to Get_Applicable_Policy and Apply_Check_Policy.
(Check_Kind): Removed. Replaced by Get_Applicable_Policy and
Apply_Check_Policy.
(Initialize): Initialize the table storing all know assertion
levels.
* sem_prag.ads (Find_Assertion_Level): New subprogram.
(Insert_Assertion_Level): New subprogram.
(Check_Applicable_Policy): Add new argument Level.
(Check_Kind): Removed. Merged with Get_Applicable_Policy.
(Get_Assertion_Level): New subprogram.
(Is_Valid_Assertion_Level): New subprogram.
* sem_util.adb (Copy_Assertion_Policy_Attributes): New function
for copying the ghost related attributes from one pragma to
another.
(Copy_Subprogram_Spec): Additionally copy the level from the spec.
(Depends_On_Level): New function for checking if one level depends
on another level.
(From_Same_Aspect): New function for checking whether the aspects
orignate from the same original aspect.
(From_Same_Pragma): New function for checking whether the pragmas
originate from the same original aspect or pragma.
(Get_Subprogram_Entity): Avoid crash when being called when the
entity has not been set for the subprogram.
(Has_Assertion_Level_Argument): New function for checking whether
the aspect or a pragma has an argument that is using an assertion
level association.
(Policy_In_Effect): add an additional argument for the level that
should be checked along with the assertion name.
* sem_util.ads (Copy_Assertion_Policy_Attributes): New function.
(Depends_On_Level): Likewise.
(From_Same_Aspect): Likewise.
(From_Same_Pragma): Likewise.
(Has_Assertion_Level_Argument): Likewise.
(Is_Same_Or_Depends_On_Level): Likewise.
(Policy_In_Effect): Add new argument Level.
* sinfo.ads: Add documentation for all the new attributes that
were added to the nodes and entities.
* snames.ads-tmpl: Add new entries for Name_Assertion_Level,
Name_uDefault_Assertion_Level and Pragma_Assertion_Level.
* stand.ads: Add new entities for the predefined assertion levels.
(Standard_Level_Static): Definition for the predefined Static
level that is always ignored.
(Standard_Level_Runtime): Defintion for the predefined Runtime
level that is always checked.
(Standard_Level_Default): Definition for the implicit Default
level that is given for ghost entities that were not associated
with an assertion level (e.g. Ghost => True).
* tbuild.adb (Make_Assertion_Level): New function for constructin
an assertion level.
* tbuild.ads (Make_Assertion_Level): Likewise.
|
|
|
|
Previously in GNATProve_Mode the frontend would overwrite all of
the assertion policies to check in order to force the generation
of all of the assertions.
This however prevents GNATProve from performing policy related
checks in the tool. Since they are all artificially changed to
check.
This patch removes the modifications to the applicable assertion
policies and instead prevents code from ignored entities being
removed when in GNATProve_Mode.
gcc/ada/ChangeLog:
* contracts.adb: Use Is_Ignored_In_Codegen instead of just
using Is_Ignored.
* exp_ch6.adb: Likewise.
* exp_prag.adb: Likewise.
* exp_util.adb: Likewise.
* frontend.adb: Avoid removal of ignored nodes in GNATProve_Mode.
* gnat1drv.adb: Avoid forcing Assertions_Enabled in GNATProve_Mode.
* lib-writ.adb (Write_With_File_Names): Avoid early exit
with ignored entities in GNATProve_Mode.
* lib-xref.adb: Likewise.
* opt.adb: Remove check for Assertions_Enabled.
* sem_attr.adb: Use Is_Ignored_In_Codegen instead of Is_Ignored.
* sem_ch13.adb: Likewise. Additionally always add predicates in
GNATProve_Mode.
* sem_prag.adb: Likewise. Additionally remove modifications
to applied policies in GNATProve_Mode.
* sem_util.adb (Is_Ignored_In_Codegen): New function that overrides
Is_Ignored in GNATProve_Mode and Codepeer_Mode.
(Is_Ignored_Ghost_Pragma_In_Codegen): Likewise for
Is_Ignored_Ghost_Pragma.
(Is_Ignored_Ghost_Entity_In_Codegen): Likewise for
Is_Ignored_Ghost_Entity.
(Policy_In_List): Remove overriding of policies in GNATProve_Mode.
* sem_util.ads: Add specs for new functions.
* (Predicates_Enabled): Always generate predicates in
GNATProve_Mode.
|
|
Print_Node_Ref, which is called by pp, sometimes calls
Compile_Time_Known_Value, which blows up if Entity (N)
is empty. Rearrange the tests here, and test for
Present (Entity (N)) before calling Compile_Time_Known_Value.
Remove test "Nkind (N) in N_Subexpr", which is redundant with other
tests.
We don't want to make Compile_Time_Known_Value more
robust; you shouldn't call it on half-baked nodes.
But ideally pp should be able to print such nodes.
This change fixes one of many such cases.
gcc/ada/ChangeLog:
* treepr.adb (Print_Node_Ref): Protect against
Entity (N) being empty before calling
Compile_Time_Known_Value.
|
|
gcc/ada/ChangeLog:
* sem_prag.adb (Validate_Compile_Time_Warning_Errors):
Check if the original compile time pragma was replaced and
validate the original node instead.
|
|
Simplify the creation of the control characters in
Validate_Compile_Time_Warning_Or_Error.
gcc/ada/ChangeLog:
* sem_prag.adb (Validate_Compile_Time_Warning_Or_Error):
simplify the implementation.
|
|
If a function result type has an access discriminant, then we already
generate a run-time accessibility check for a return statement. But if
we know statically that the check (if executed) is going to fail, then
that should be rejected at compile-time as a violation of RM 6.5(5.9).
Add this additional compile-time check.
gcc/ada/ChangeLog:
* exp_ch6.adb (Apply_Access_Discrims_Accessibility_Check): If the
accessibility level being checked is known statically, then
statically check it against the level of the function being
returned from.
|
|
Simplify the storing process for ghost mode related variables and
make the process more extendable if new ghost mode related features
are added.
gcc/ada/ChangeLog:
* atree.adb: update references to Ghost_Mode.
* exp_ch3.adb: use a structure type to store all of the existing
ghost mode related state variables.
* exp_disp.adb: Likewise.
* exp_spark.adb: Likewise.
* exp_util.adb: Likewise.
* expander.adb: Likewise.
* freeze.adb: Likewise and replace references to existing ghost
mode variables.
* ghost.adb (Install_Ghost_Region): install the changes of
the region in to the new Ghost_Config structure.
(Restore_Ghost_Region): Use the new Ghost_Config instead.
In general replace all references to the existing ghost mode
variables with the new structure equivalent.
* ghost.ads (Restore_Ghost_Region): update the spec.
* opt.ads (Ghost_Config_Type): A new type that has two of the
previous ghost code related global variables as memembers -
Ghost_Mode and Ignored_Ghost_Region.
(Ghost_Config) New variable to store the previous Ghost_Mode and
Ignored_Ghost_Region info.
* rtsfind.adb: Replace references to existing ghost mode variables.
* sem.adb: Likewise.
* sem_ch12.adb: Likewise.
* sem_ch13.adb: Likewise.
* sem_ch3.adb: Likewise.
* sem_ch5.adb: Likewise.
* sem_ch6.adb: Likewise.
* sem_ch7.adb: Likewise.
* sem_prag.adb: Likewise.
* sem_util.adb: Likewise.
|
|
Do not generate a warning stating that the size of a formal parameter
is 8 bits unless the size of the formal parameter is 8 bits.
gcc/ada/ChangeLog:
* freeze.adb (Freeze_Profile): Do not emit a warning stating that
a formal parameter's size is 8 if the parameter's size is not 8.
|
|
gcc/ada/ChangeLog:
* table.adb (Max): Move variable to the body and initialize
it with the same value as in the Init function.
* table.ads (Max): Likewise.
|
|
...which might make it easier to deal with incorrectly shared
subtrees created during parsing.
There were several Idents arrays, with duplicated code and commentary.
And the related code had somewhat diverged -- different comments,
different index subtypes (Pos vs. Int), etc.
DRY: Move at least some of the code into Par.Util. Raise
Program_Error if the array overflows; there is really no
reason not to check, along with several comments saying
we don't check. In the unlikely event that the array
overflows, the compiler will now crash, which seems better
than erroneous execution (which could conceivably cause
bad code to be generated).
Move the block comments titled
"Handling Semicolon Used in Place of IS" and
"Handling IS Used in Place of Semicolon" so they
are together, which seems obviously desirable.
Rewrite the latter comment.
No need to denigrate other parsers.
gcc/ada/ChangeLog:
* par.adb: Move and rewrite some comments.
(Util): Shared code and comments for dealing with
defining_identifier_lists.
* par-util.adb (Append): Shared code for appending
one identifier onto Defining_Identifiers.
(P_Def_Ids): Shared code for parsing a defining_identifier_list.
Unfortunately, this is not used in all cases, because some of
them mix in sophisticated error recovery, which we do not
modify here.
* par-ch12.adb (P_Formal_Object_Declarations):
Use Defining_Identifiers and related code.
* par-ch3.adb (P_Identifier_Declarations): Likewise.
(P_Known_Discriminant_Part_Opt): Likewise.
(P_Component_Items): Likewise.
* par-ch6.adb (P_Formal_Part): Likewise.
|
|
|
|
This reverts commit 41974d6ed349507ca1532629851b7b5d74f44abc.
|
|
The throw and catch sides of the Ada exception machinery disagree about
the BIGGEST_ALIGNMENT setting.
gcc/ada/
PR ada/120440
* gcc-interface/Makefile.in (GNATLINK_OBJS): Add s-excmac.o.
(GNATMAKE_OBJS): Likewise.
|
|
The first unit provides the time_t, timeval and timespec types corresponding
to the C types defined by the OS, as well as various conversion functions.
The second unit is a mere renaming of the first under the GNAT hierarchy.
This removes C time types and conversions under System, and from bodies and
private parts under GNAT, while keeping visible types and conversions under
GNAT as Obsolescent.
[changelog]
PR ada/114065
* Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add g-c_time$(objext) and
s-c_time$(objext).
(Aarch64/Android): Do not use s-osinte__android.adb.
(SPARC/Solaris): Do not use s-osprim__solaris.adb.
(x86/Solaris): Likewise.
(LynxOS178): Do not use s-parame__posix2008.ads.
(RTEMS): Likewise.
(x32/Linux): Likewise, as well as s-linux__x32.ads. Replace
s-osprim__x32.adb with s-osprim__posix.adb.
(LIBGNAT_OBJS): Remove cal.o.
* cal.c: Delete.
* doc/gnat_rm/the_gnat_library.rst (GNAT.C_Time): New entry.
(GNAT.Calendar): Do not mention the obsolete conversion functions.
* impunit.adb (Non_Imp_File_Names_95): Add g-c_time.
* libgnarl/a-exetim__posix.adb: Add with clause for System.C_Time
(Clock): Use type and functions from System.C_Time.
* libgnarl/s-linux.ads: Remove with clause for System.Parameters.
Remove declarations of C time types.
* libgnarl/s-linux__alpha.ads: Likewise.
* libgnarl/s-linux__android-aarch64.ads: Likewise.
* libgnarl/s-linux__android-arm.ads: Likewise.
* libgnarl/s-linux__hppa.ads: Likewise.
* libgnarl/s-linux__loongarch.ads: Likewise.
* libgnarl/s-linux__mips.ads: Likewise.
* libgnarl/s-linux__riscv.ads: Likewise.
* libgnarl/s-linux__sparc.ads: Likewise.
* libgnarl/s-osinte__aix.ads: Likewise.
* libgnarl/s-osinte__android.ads: Likewise.
* libgnarl/s-osinte__cheribsd.ads: Likewise.
* libgnarl/s-osinte__darwin.ads: Likewise.
* libgnarl/s-osinte__dragonfly.ads: Likewise.
* libgnarl/s-osinte__freebsd.ads: Likewise.
* libgnarl/s-osinte__gnu.ads: Likewise.
* libgnarl/s-osinte__hpux.ads: Likewise.
* libgnarl/s-osinte__kfreebsd-gnu.ads: Likewise.
* libgnarl/s-osinte__linux.ads: Likewise.
* libgnarl/s-osinte__lynxos178e.ads: Likewise.
* libgnarl/s-osinte__qnx.ads: Likewise.
* libgnarl/s-osinte__rtems.ads: Likewise.
* libgnarl/s-osinte__solaris.ads: Likewise.
* libgnarl/s-osinte__vxworks.ads: Likewise.
* libgnarl/s-qnx.ads: Likewise.
* libgnarl/s-linux__x32.ads: Delete.
* libgnarl/s-osinte__darwin.adb (To_Duration): Remove.
(To_Timespec): Likewise.
* libgnarl/s-osinte__aix.adb: Likewise.
* libgnarl/s-osinte__dragonfly.adb: Likewise.
* libgnarl/s-osinte__freebsd.adb: Likewise.
* libgnarl/s-osinte__gnu.adb: Likewise.
* libgnarl/s-osinte__lynxos178.adb: Likewise.
* libgnarl/s-osinte__posix.adb: Likewise.
* libgnarl/s-osinte__qnx.adb: Likewise.
* libgnarl/s-osinte__rtems.adb: Likewise.
* libgnarl/s-osinte__solaris.adb: Likewise.
* libgnarl/s-osinte__vxworks.adb: Likewise.
* libgnarl/s-osinte__x32.adb: Likewise.
* libgnarl/s-taprop__solaris.adb: Add with clause for System.C_Time.
(Monotonic_Clock): Use type and functions from System.C_Time.
(RT_Resolution): Likewise.
(Timed_Sleep): Likewise.
(Timed_Delay): Likewise.
* libgnarl/s-taprop__vxworks.adb: Likewise.
* libgnarl/s-tpopmo.adb: Likewise.
* libgnarl/s-osinte__android.adb: Delete.
* libgnat/g-c_time.ads: New file.
* libgnat/g-calend.adb: Delegate to System.C_Time.
* libgnat/g-calend.ads: Likewise.
* libgnat/g-socket.adb: Likewise.
* libgnat/g-socthi.adb: Likewise.
* libgnat/g-socthi__vxworks.adb: Likewise.
* libgnat/g-sothco.ads: Likewise.
* libgnat/g-spogwa.adb: Likewise.
* libgnat/s-c_time.adb: New file.
* libgnat/s-c_time.ads: Likewise.
* libgnat/s-optide.adb: Import nanosleep here.
* libgnat/s-os_lib.ads (time_t): Remove.
(To_Ada): Adjust.
(To_C): Likewise.
* libgnat/s-os_lib.adb: Likewise.
* libgnat/s-osprim__darwin.adb: Delegate to System.C_Time.
* libgnat/s-osprim__posix.adb: Likewise.
* libgnat/s-osprim__posix2008.adb: Likewise.
* libgnat/s-osprim__rtems.adb: Likewise.
* libgnat/s-osprim__unix.adb: Likewise.
* libgnat/s-osprim__solaris.adb: Delete.
* libgnat/s-osprim__x32.adb: Likewise.
* libgnat/s-parame.ads (time_t_bits): Remove.
* libgnat/s-parame__hpux.ads: Likewise.
* libgnat/s-parame__vxworks.ads: Likewise.
* libgnat/s-parame__posix2008.ads: Delete.
* s-oscons-tmplt.c (SIZEOF_tv_nsec): New constant.
|
|
|
|
gcc/ada/ChangeLog:
* gcc-interface/trans.cc (gnat_to_gnu): Fix typo in comment.
|
|
|
|
No functional change intended.
gcc/ada/ChangeLog:
* gcc-interface/misc.cc: Make
diagnostics::context::m_source_printing private.
gcc/analyzer/ChangeLog:
* program-point.cc: Make diagnostics::context::m_source_printing
private.
gcc/c-family/ChangeLog:
* c-common.cc: Make diagnostics::context::m_source_printing
private.
* c-format.cc: Likewise.
* c-opts.cc: Likewise.
gcc/ChangeLog:
* diagnostic.h (diagnostic_set_caret_max_width): Drop forward
decl.
(diagnostic_same_line): Make
diagnostics::context::m_source_printing private.
* diagnostics/context.cc (diagnostic_set_caret_max_width): Convert
to...
(diagnostics::context::set_caret_max_width): ...this.
* diagnostics/context.h
(diagnostics::context::get_source_printing_options): New
accessors.
(diagnostics::context::m_source_printing): Make private.
* diagnostics/html-sink.cc: Make
diagnostics::context::m_source_printing private.
* diagnostics/paths-output.cc: Likewise.
* diagnostics/sarif-sink.cc: Likewise.
* diagnostics/selftest-context.cc: Likewise.
* diagnostics/selftest-context.h
(diagnostics::selftest::test_context::colorize_source): New.
(diagnostics::selftest::test_context::show_labels): New.
(diagnostics::selftest::test_context::show_line_numbers): New.
(diagnostics::selftest::test_context::show_ruler): New.
(diagnostics::selftest::test_context::show_event_links): New.
(diagnostics::selftest::test_context::set_caret_char): New.
* diagnostics/source-printing.cc: Make
diagnostics::context::m_source_printing private.
* diagnostics/text-sink.h: Likewise.
* libgdiagnostics.cc: Likewise.
* opts.cc: Likewise.
* toplev.cc: Likewise.
gcc/fortran/ChangeLog:
* error.cc: Make diagnostics::context::m_source_printing private.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic_plugin_show_trees.cc: Make
diagnostics::context::m_source_printing private.
* gcc.dg/plugin/diagnostic_plugin_test_inlining.cc: Likewise.
* gcc.dg/plugin/diagnostic_plugin_test_string_literals.cc:
Likewise.
* gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.cc:
Likewise.
* gcc.dg/plugin/diagnostic_plugin_test_paths.cc: Likewise.
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Likewise.
* gcc.dg/plugin/expensive_selftests_plugin.cc: Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
|
|
No functional change intended.
gcc/ChangeLog:
* Makefile.in: Replace diagnostic.def with diagnostics/kinds.def.
* config/aarch64/aarch64.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* config/i386/i386-options.cc: Likewise.
* config/s390/s390.cc: Likewise.
* diagnostic-core.h: Replace typedef diagnostic_t with
enum class diagnostics::kind in diagnostics/kinds.h and include
it.
* diagnostic-global-context.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* diagnostic.cc: Likewise.
* diagnostic.h: Likewise.
* diagnostics/buffering.cc: Likewise.
* diagnostics/buffering.h: Likewise.
* diagnostics/context.h: Likewise.
* diagnostics/diagnostic-info.h: Likewise.
* diagnostics/html-sink.cc: Likewise.
* diagnostic.def: Move to...
* diagnostics/kinds.def: ...here and update for diagnostic_t
becoming enum class diagnostics::kind.
* diagnostics/kinds.h: New file, based on material in
diagnostic-core.h.
* diagnostics/lazy-paths.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* diagnostics/option-classifier.cc: Likewise.
* diagnostics/option-classifier.h: Likewise.
* diagnostics/output-spec.h: Likewise.
* diagnostics/paths-output.cc: Likewise.
* diagnostics/sarif-sink.cc: Likewise.
* diagnostics/selftest-context.cc: Likewise.
* diagnostics/selftest-context.h: Likewise.
* diagnostics/sink.h: Likewise.
* diagnostics/source-printing.cc: Likewise.
* diagnostics/text-sink.cc: Likewise.
* diagnostics/text-sink.h: Likewise.
* gcc.cc: Likewise.
* libgdiagnostics.cc: Likewise.
* lto-wrapper.cc: Likewise.
* opts-common.cc: Likewise.
* opts-diagnostic.h: Likewise.
* opts.cc: Likewise.
* rtl-error.cc: Likewise.
* substring-locations.cc: Likewise.
* toplev.cc: Likewise.
gcc/ada/ChangeLog:
* gcc-interface/trans.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
gcc/analyzer/ChangeLog:
* pending-diagnostic.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* program-point.cc: Likewise.
gcc/c-family/ChangeLog:
* c-common.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* c-format.cc: Likewise.
* c-lex.cc: Likewise.
* c-opts.cc: Likewise.
* c-pragma.cc: Likewise.
* c-warn.cc: Likewise.
gcc/c/ChangeLog:
* c-errors.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* c-parser.cc: Likewise.
* c-typeck.cc: Likewise.
gcc/cobol/ChangeLog:
* util.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
gcc/cp/ChangeLog:
* call.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* constexpr.cc: Likewise.
* cp-tree.h: Likewise.
* decl.cc: Likewise.
* error.cc: Likewise.
* init.cc: Likewise.
* method.cc: Likewise.
* module.cc: Likewise.
* parser.cc: Likewise.
* pt.cc: Likewise.
* semantics.cc: Likewise.
* typeck.cc: Likewise.
* typeck2.cc: Likewise.
gcc/d/ChangeLog:
* d-diagnostic.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
gcc/fortran/ChangeLog:
* cpp.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* error.cc: Likewise.
* options.cc: Likewise.
gcc/jit/ChangeLog:
* dummy-frontend.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
gcc/m2/ChangeLog:
* gm2-gcc/m2linemap.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* gm2-gcc/rtegraph.cc: Likewise.
gcc/rust/ChangeLog:
* backend/rust-tree.cc: Update for diagnostic_t becoming
enum class diagnostics::kind.
* backend/rust-tree.h: Likewise.
* resolve/rust-ast-resolve-expr.cc: Likewise.
* resolve/rust-ice-finalizer.cc: Likewise.
* resolve/rust-ice-finalizer.h: Likewise.
* resolve/rust-late-name-resolver-2.0.cc: Likewise.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Update for
diagnostic_t becoming enum class diagnostics::kind.
* gcc.dg/plugin/expensive_selftests_plugin.cc: Likewise.
* gcc.dg/plugin/location_overflow_plugin.cc: Likewise.
* lib/gcc-dg.exp: Likewise.
libcpp/ChangeLog:
* internal.h: Update comment for diagnostic_t becoming
enum class diagnostics::kind.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
|
|
No functional change intended.
gcc/ada/ChangeLog:
* gcc-interface/misc.cc: Update for diagnostic_context becoming
diagnostics::context.
gcc/analyzer/ChangeLog:
* program-point.cc: : Update for diagnostic_context becoming
diagnostics::context, and for diagnostic_source_print_policy
becoming diagnostics::source_print_policy.
gcc/c-family/ChangeLog:
* c-common.h: Update for diagnostic_context becoming
diagnostics::context.
* c-opts.cc: Likewise.
gcc/c/ChangeLog:
* c-objc-common.cc: Update for diagnostic_context becoming
diagnostics::context.
* c-tree.h: Likewise.
gcc/ChangeLog:
* coretypes.h: Update for diagnostic_context becoming
diagnostics::context.
* diagnostic-global-context.cc: Likewise.
* diagnostic.cc: Likewise. Also for diagnostic_option_classifier
becoming diagnostics::option_classifier.
* diagnostic.h (diagnostic_text_starter_fn): Rename to...
(diagnostics::text_starter_fn): ...this, and move to
diagnostics/context.h.
(get_printer): Rename to...
(diagnostics::get_printer): ...this, and move to
diagnostics/context.h.
(class diagnostic_option_manager): Rename to...
(class diagnostics::option_manager): ...this, and move to
diagnostics/context.h.
(class diagnostic_option_classifier): Rename to...
(class diagnostics::option_classifier): ...this, and move to
diagnostics/context.h.
(struct diagnostic_source_printing_options): Rename to...
(struct diagnostics::source_printing_options): ...this, and move
to diagnostics/context.h.
(class diagnostic_column_policy): Rename to...
(class diagnostics::column_policy): ...this, and move to
diagnostics/context.h.
(class diagnostic_location_print_policy): Rename to...
(class diagnostics::location_print_policy): ...this, and move to
diagnostics/context.h.
(class html_label_writer): Rename to...
(class diagnostics::html_label_writer): ...this, and move to
diagnostics/context.h.
(class diagnostic_source_print_policy): Rename to...
(class diagnostics::source_print_policy): ...this, and move to
diagnostics/context.h.
(struct diagnostic_counters): Rename to...
(struct diagnostics::counters): ...this, and move to
diagnostics/context.h.
(class diagnostic_context): Rename to...
(class diagnostics::context): ...this, and move to
diagnostics/context.h.
(diagnostic_text_starter): Rename to...
(diagnostics::text_starter): ...this, and move to
diagnostics/context.h.
(diagnostic_start_span): Rename to...
(diagnostics::start_span): ...this, and move to
diagnostics/context.h.
(diagnostic_text_finalizer): Rename to...
(diagnostics::text_finalizer): ...this, and move to
diagnostics/context.h.
Include "diagnostics/context.h".
* diagnostics/buffering.h: Update for diagnostic_context becoming
diagnostics::context; similarly for diagnostic_counters.
* diagnostics/client-data-hooks.h: Likewise.
* diagnostics/context.h: New file, taken from material in
diagnostic.h.
* diagnostics/html-sink.cc: : Update for diagnostic_context
becoming diagnostics::context.
* diagnostics/html-sink.h: Likewise.
* diagnostics/lazy-paths.cc: Likewise for
diagnostic_option_manager.
* diagnostics/output-file.h: Likewise for diagnostic_context.
* diagnostics/output-spec.cc: Likewise.
* diagnostics/output-spec.h: Likewise.
* diagnostics/paths-output.cc: Likewise.
* diagnostics/sarif-sink.cc: Likewise.
* diagnostics/sarif-sink.h: Likewise.
* diagnostics/sink.h: Likewise.
* diagnostics/source-printing.cc: Likewise.
* diagnostics/text-sink.cc: Likewise.
* diagnostics/text-sink.h: Likewise.
* gcc-rich-location.h: Likewise.
* gcc.cc: Likewise.
* gdbinit.in: Likewise.
* langhooks-def.h: Likewise.
* langhooks.cc: Likewise.
* langhooks.h: Likewise.
* libgdiagnostics.cc: Likewise.
* optc-gen.awk: Likewise.
* opth-gen.awk: Likewise.
* opts-common.cc: Likewise.
* opts-diagnostic.cc: Likewise.
* opts-diagnostic.h: Likewise.
* opts-global.cc: Likewise.
* opts.cc: Likewise.
* opts.h: Likewise.
* selftest-diagnostic.cc: Likewise.
* selftest-diagnostic.h: Likewise.
* toplev.cc: Likewise.
* tree-diagnostic-client-data-hooks.cc: Likewise.
* tree-diagnostic.cc: Likewise.
* tree-diagnostic.h: Likewise.
gcc/cp/ChangeLog:
* cp-tree.h: Update for diagnostic_context becoming
diagnostics::context.
* error.cc: Likewise.
* module.cc: Likewise.
gcc/fortran/ChangeLog:
* error.cc: Update for diagnostic_context becoming
diagnostics::context.
gcc/jit/ChangeLog:
* dummy-frontend.cc: Update for diagnostic_context becoming
diagnostics::context.
* jit-playback.h: Likewise.
gcc/rust/ChangeLog:
* resolve/rust-ast-resolve-expr.cc: Update for diagnostic_text_finalizer
becoming diagnostics::text_finalizer.
* resolve/rust-late-name-resolver-2.0.cc: Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/plugin/show_template_tree_color_plugin.cc: Update for
moves to namespace diagnostics.
* gcc.dg/plugin/diagnostic_group_plugin.cc: Likewise.
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.cc: Likewise.
* gcc.dg/plugin/location_overflow_plugin.cc: Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
|
|
Renamed local variables to make it easier to read.
gcc/ada/ChangeLog:
* gcc-interface/utils.cc (update_pointer_to): Renamed ptr/old_ptr, ref/old_ref.
|
|
VxWorks 6 lacks pthread_condattr_setclock, so define CLOCK_RT_Ada to
CLOCK_REALTIME to use the dummy definition of
__gnat_pthread_condattr_setup in libgnarl/thread.c.
socket.c and sysdep.c use FD_ZERO, that relies on bzero on VxWorks 6.
We need to include strings.h to get a declaration for bzero, but don't
require strings.h to exist, since it's nonstandard.
gcc/ada/ChangeLog:
* s-oscons-tmplt.c (CLOCK_RT_Ada) [__vxworks]: Define to
CLOCK_REALTIME on VxWorks6.
* gsocket.h [__vxworks]: Include strings.h if available.
* sysdep.c [__vxworks]: Likewise.
|
|
Two follow-up fixes for the previous change for this issue.
gcc/ada/ChangeLog:
* exp_ch6.adb (Apply_Access_Discrims_Accessibility_Check): Do
nothing and simply return if either Ada_Version <= Ada_95 or if
the function being returned from lacks the extra formal parameter
needed to perform the check (typically because the result is
tagged).
|
|
Fix bug when an instance of Indefinite_Holders with a class-wide type is
passed as a generic formal package; Program_Error was raised when
dealing with the implicit "=" function.
The fix is to disable legality checks in formal packages when the
entity is an E_Subprogram_Body, because these are implicitly generated
for class-wide predefined functions when passed to generics.
gcc/ada/ChangeLog:
* sem_ch12.adb (Check_Formal_Package_Instance):
Do nothing in case of E_Subprogram_Body.
|
|
A previous patch changed the mechanism of early usage detection for
discriminants but failed to update a couple of surrounding comments
accordingly. This patch fixes this omission.
gcc/ada/ChangeLog:
* sem_ch3.adb (Process_Discriminants): Update comments
|
|
A recent patch introduced a new flag to mark the types for which looking
up finalization primitives needs special handling. But there was one
place in Build_Derived_Record_Type where the flag was not set when it
should, which introduced a regression in some cases.
This patch adds the missing setting of the flag.
gcc/ada/ChangeLog:
* sem_ch3.adb (Build_Derived_Record_Type): Set flag appropriately.
|
|
The 3 units Ada.Calendar, GNAT.Calendar and GNAT.Sockets contain conversion
functions from the Duration fixed-point type that implement the same idiom
but with some inconsistencies:
* GNAT.Sockets only handles Timeval_Duration, i.e. positive Duration, and
is satisfactory, although a simpler implementation can be written,
* GNAT.Calendar mishandles negative Duration values, as well as integral
Duration values,
* Ada.Calendar mishandles negative Duration values, and rounds nanoseconds
instead of truncating them.
gcc/ada/ChangeLog:
* libgnat/a-calend.adb (To_Struct_Timespec_64): Deal with negative
Duration values and truncate the nanoseconds too.
* libgnat/g-calend.adb (timeval_to_duration): Unsuppress overflow
checks.
(duration_to_timeval): Likewise. Deal with negative Duration values
as well as integral Duration values.
* libgnat/g-socket.adb (To_Timeval): Simplify the implementation.
|
|
|
|
In some cases involving assigning an aggregate to a formal parameter of
an unconstrained discriminated subtype that has a Dynamic_Predicate, and where
the discriminated type also has a component of an unconstrained discriminated
subtype, the front end generates a malformed tree which causes a compilation
failure when the backend fails a consistency check.
gcc/ada/ChangeLog:
* exp_aggr.adb (Convert_To_Assignments): Add calls to Ensure_Defined
before generating assignments to components that could be
associated with a not-yet-defined itype.
|
|
RM 6.5 defines static and dynamic checks to ensure that a function result
with one or more access discriminants will not outlive the entity
designated by a non-null access discriminant value (see paragraphs
5.9 and 21). Implement these checks. Also fix a bug in passing along
an implicit parameter needed to perform the dynamic checks when a function
that takes such a parameter returns a call to another such function.
gcc/ada/ChangeLog:
* accessibility.adb (Function_Call_Or_Allocator_Level): Handle the
case where a function that has an Extra_Accessibility_Of_Result
parameter returns as its result a call to another such function.
In that case, the extra parameter should be passed along.
(Check_Return_Construct_Accessibility): Replace a warning about an
inevitable failure of a dynamic check with a legality-rule-violation
error message; adjust the text of the message accordingly.
* exp_ch6.ads (Apply_Access_Discrims_Accessibility_Check): New
procedure, following example of the existing
Apply_CW_Accessibility procedure.
* exp_ch6.adb (Apply_Access_Discrims_Accessibility_Check): body
for new procedure.
(Expand_Simple_Function_Return): Add call to new
Apply_Access_Discrims_Accessibility_Check procedure.
* exp_ch3.adb (Make_Allocator_For_Return): Add call to new
Apply_Access_Discrims_Accessibility_Check procedure.
|
|
gcc/ada/ChangeLog:
* doc/gnat_rm/standard_and_implementation_defined_restrictions.rst:
clarify parameter description.
* gnat_rm.texi: Regenerate.
|
|
|
|
The compiler mishandles nested use_type_clauses in the case where the
outer one is a normal use_type_clause and the inner one has "all".
Upon leaving the scope of the inner use_type_clause, the outer one
is effectively disabled, because it's not considered redundant (and
in fact it's only partially redundant). This is fixed by testing for
the presence of a use_type_clause for the same type that has a wider
scope when ending the inner use_type_clause.
gcc/ada/ChangeLog:
* sem_ch8.adb (End_Use_Type): Add a test for there not being an earlier
use_type_clause for the same type as an additional criterion for turning
off In_Use and Current_Use_Clause.
|
|
Fix missing checks for prefixes of array attributes in GNATprove mode.
gcc/ada/ChangeLog:
* sem_attr.adb (Eval_Attribute): Only fold array attributes when prefix
is static or at least safe to evaluate
|
|
gcc/ada/ChangeLog:
* einfo.ads (Is_Controlled_Active): Fix pasto in comment.
* sem_util.ads (Propagate_Controlled_Flags): Update comment for
Destructor aspect.
|
|
This patch adds a GNAT-specific extension which enables "destructors".
Destructors are an optional replacement for Ada.Finalization where some
aspects of the interaction with type derivation are different.
gcc/ada/ChangeLog:
* doc/gnat_rm/gnat_language_extensions.rst: Document new extension.
* snames.ads-tmpl: Add name for new aspect.
* gen_il-fields.ads (Has_Destructor, Is_Destructor): Add new fields.
* gen_il-gen-gen_entities.adb (E_Procedure, Type_Kind): Add new fields.
* einfo.ads (Has_Destructor, Is_Destructor): Document new fields.
* aspects.ads: Add new aspect.
* sem_ch13.adb (Analyze_Aspect_Specifications,
Check_Aspect_At_Freeze_Point, Check_Aspect_At_End_Of_Declarations):
Add semantic analysis for new aspect.
(Resolve_Finalization_Procedure): New function.
(Resolve_Finalizable_Argument): Use new function above.
* sem_util.adb (Propagate_Controlled_Flags): Extend for new field.
* freeze.adb (Freeze_Entity): Add legality check for new aspect.
* exp_ch3.adb (Expand_Freeze_Record_Type, Predefined_Primitive_Bodies):
Use new field.
* exp_ch7.adb (Build_Finalize_Statements): Add expansion for
destructors.
(Make_Final_Call, Build_Record_Deep_Procs): Adapt to new Has_Destructor
field.
(Build_Adjust_Statements): Tweak to handle cases of empty lists.
* gnat_rm.texi: Regenerate.
|
|
This patch makes sure that we return the same decision for all aliased
types when checking if the BIP task extra actuals are needed.
gcc/ada/ChangeLog:
* sem_ch6.adb (Might_Need_BIP_Task_Actuals): Before retrieving the original corresponding
operation we retrieve first the root of the aliased chain.
|
|
Before this patch, Make_Init_Call and Make_Adjust_Call made the
assumption that if the type they were called with was untagged and a
derived type, it was the untagged private view of a tagged type. That
assumption made it possible to inspect the root type's primitives to
handle the case where the underlying type was implicitly generated by
the compiler without all inherited primitives.
The introduction of the Finalizable aspect broke that assumption, so
this patch adds a new field to type entities that make the generated
full view stand out, and updates Make_Init_Call and Make_Adjust_Call to
only jump to the root type when they're passed one of those generated
types.
Make_Final_Call and Finalize_Address are two other subprograms that
perform the same test on the types they're passed. They did not suffer
from the same bug as Make_Init_Call and Make_Adjust_Call because of an
earlier, more ad hoc fix, but this patch switches them over to the newly
introduced mechanism for the sake of consistency.
gcc/ada/ChangeLog:
* gen_il-fields.ads (Is_Implicit_Full_View): New field.
* gen_il-gen-gen_entities.adb (Type_Kind): Use new field.
* einfo.ads (Is_Implicit_Full_View): Document new field.
* exp_ch7.adb (Make_Adjust_Call, Make_Init_Call, Make_Final_Call): Use
new field.
* exp_util.adb (Finalize_Address): Likewise.
* sem_ch3.adb (Copy_And_Build): Set new field.
|
|
That's a kludge added to work around the limitations of the stack checking
mechanism used in the early days.
gcc/ada/ChangeLog:
* exp_util.ads (May_Generate_Large_Temp): Delete.
* exp_util.adb (May_Generate_Large_Temp): Likewise.
(Safe_Unchecked_Type_Conversion): Do not take stack checking into
account to compute the result.
|
|
The compiler generates wrong code in a dispatching call on result
when the call is performed under dependent conditional expressions
or case-expressions.
gcc/ada/ChangeLog:
* sinfo.ads (Is_Expanded_Dispatching_Call): New flag.
(Tag_Propagated): New flag.
* exp_ch6.adb (Expand_Call_Helper): Propagate the tag when
the dispatching call is placed in conditionl expressions or
case-expressions.
* sem_ch5.adb (Analyze_Assignment): For assignment of tag-
indeterminate expression, do not propagate the tag if
previously done.
* sem_disp.adb (Is_Tag_Indeterminate): Add missing support
for conditional expression and case expression.
* exp_disp.ads (Is_Expanded_Dispatching_Call): Removed. Function
replaced by a new flag in the nodes.
* exp_disp.adb (Expand_Dispatching_Call): Set a flag in the
call node to remember that the call has been expanded.
(Is_Expanded_Dispatching_Call): Function removed.
* gen_il-fields.ads (Tag_Propagated): New flag.
(Is_Expanded_Dispatching_Call): New flag.
* gen_il-gen-gen_nodes.adb (Tag_Propagated): New flag.
(Is_Expanded_Dispatching_Call): New flag.
|
|
aggregates
This change test an additional condition as part of the criteria used
for deciding whether to generate a call to a container type's Length
function (for passing to the Empty function) when determining the
size of the object to allocate for a bounded container aggregate
with a "for of" iterator.
An update is also made to function Empty in Ada.Containers.Bounded_Hash_Maps,
adding a default to the formal Capacity, to make it consistent with other
bounded containers (and to make it conformant with the Ada RM).
gcc/ada/ChangeLog:
* libgnat/a-cbhama.ads (Empty): Add missing default to Capacity formal.
* libgnat/a-cbhama.adb (Empty): Add missing default to Capacity formal.
* exp_aggr.adb (Build_Size_Expr): Test for presence of Capacity
discriminant as additional criterion for generating the call to
the Length function. Update comments.
|
|
The assertion is:
pragma Assert (Side_Effect_Free (L));
in Make_Tag_Ctrl_Assignment and demonstrates that the sequence:
Remove_Side_Effects (L);
pragma Assert (Side_Effect_Free (L));
does not hold in this case.
What happens is that Remove_Side_Effects uses a renaming to remove the side
effects of L but, at the end, the renamed object is substituted back for the
renamed object in the node by Expand_Renaming, which is invoked because the
Is_Renaming_Of_Object flag is set on the renaming after Evaluate_Name has
been invoked on its Name.
This is a general discrepancy between Evaluate_Name and Side_Effect_Free of
Exp_Util, coming from the call to Safe_Unchecked_Type_Conversion present in
Side_Effect_Free in this case. The long term goal is probably to remove the
call but, in the meantime, this change is sufficient to fix the failure.
gcc/ada/ChangeLog:
* exp_util.adb (Safe_Unchecked_Type_Conversion): Always return True
if the expression is the prefix of an N_Selected_Component.
|
|
This patch checks the presence of No_Task_Parts on any ancestor or
inherited interface, not only its root type, since No_Task_Parts
prohibits tasking for any of its descendant. In case the current
subprogram is overridden/inherited, we need to return the same value
we would return for the original corresponding operation. The aspect
No_Task_Parts is nonoverridable and applies also when specified in a
partial view.
gcc/ada/ChangeLog:
* sem_ch6.adb (Might_Need_BIP_Task_Actuals): Check whether No_Task_Parts is enabled in any
of the derived types, or interfaces, from the user-defined primitive return type.
* sem_ch13.adb (Analyze_Aspect_Specifications): Add No_Task_Parts and No_Controlled_Parts to
the representation chain to be visible in the full view of private types.
* aspects.ads (Nonoverridable_Aspect_Id): As per GNAT RM, No_Task_Parts is nonoverridable.
* sem_util.adb (Check_Inherited_Nonoverridable_Aspects): Likewise.
* sem_util.ads: Fix typo and style.
* sem_disp.adb: Missing comment.
|
|
Add support to create the extra formals when the underlying type
of some formal type or return type of a subprogram, subprogram type
or entry is not available when the entity is frozen. For example,
when a function that returns a private type is frozen before the
full-view of its private type is analyzed.
gcc/ada/ChangeLog:
* einfo.ads (Extra_Formals): Complete documentation.
(Has_First_Controlling_Parameter_Aspect): Place it in alphabetical order.
(Has_Frozen_Extra_Formals): New attribute.
* gen_il-fields.ads (Has_Frozen_Extra_Formals): New entity field.
* gen_il-gen-gen_entities.adb (Has_Frozen_Extra_Formals): Adding new
entity flag to subprograms, subprogram types, and and entries.
* gen_il-internals.adb (Image): Adding Has_Frozen_Extra_Formals.
* exp_ch3.adb (Build_Array_Init_Proc): Freeze its extra formals.
(Build_Init_Procedure): Freeze its extra formals.
(Expand_Freeze_Record_Type): For tagged types with foreign convention
create the extra formals of primitives with convention Ada.
* exp_ch6.ads (Create_Extra_Actuals): New subprogram.
* exp_ch6.adb (Check_BIP_Actuals): Adding assertions.
(Create_Extra_Actuals): New subprogram that factorizes code from
Expand_Call_Helper.
(Expand_Call_Helper): Adding support to defer the addition of extra
actuals. Move the code that adds the extra actuals to a new subprogram.
(Is_Unchecked_Union_Equality): Renamed as Is_Unchecked_Union_Predefined_
Equality_Call.
* exp_ch7.adb (Create_Finalizer): Freeze its extra formals.
(Wrap_Transient_Expression): Link the temporary with its relocated
expression to facilitate locating the expression in the expanded code.
* exp_ch9.ads (Expand_N_Entry_Declaration): Adding one formal.
* exp_ch9.adb (Expand_N_Entry_Declaration): Defer the expansion of
the entry if the extra formals are not available; analyze the built
declarations for the record type that holds all the parameters if
the expansion of the entry declaration was deferred.
* exp_disp.adb (Expand_Dispatching_Call): Handle deferred extra formals.
(Set_CPP_Constructors): Freeze its extra formals.
* freeze.adb (Freeze_Entity): Create the extra actuals of acccess to
subprograms whose designated type is a subprogram type.
(Freeze_Subprogram): Adjust assertion to support deferred extra formals,
and freeze extra formals of non-dispatching subprograms with foreign
convention. Added assertion to check matching of formals in thunks.
* sem_aux.adb (Get_Called_Entity): Adding documentation.
* sem_ch3.adb (Analyze_Full_Type_Declaration): Create the extra formals
of deferred subprograms, subprogram types and entries; create also the
extra actuals of deferred calls.
* sem_ch6.ads (Freeze_Extra_Formals): New subprogram.
(Deferred_Extra_Formals_Support): New package.
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Create the extra formals
of subprograms without separate spec.
(Add_Extra_Formal): Add documentation.
(Has_Extra_Formals): Removed.
(Parent_Subprogram): Adding documentation.
(Create_Extra_Formals): Defer adding extra formals if the underlying_type
of some formal type or return type is not available.
(Extra_Formals_Match_OK): Add missing check on the extra formals of
unchecked unions.
(Freeze_Extra_Formals): New subprogram.
(Deferred_Extra_Formals_Support): New package.
* sem_ch9.adb (Analyze_Entry_Declaration): Freeze its extra formals.
* sem_ch13.adb (New_Put_Image_Subprogram): ditto.
* sem_util.ads (Is_Unchecked_Union_Equality): New subprogram.
* sem_util.adb (Is_Unchecked_Union_Equality): ditto.
|
|
When GNAT is operating in GNATprove_Mode the Expander_Active flag is disabled,
but we still must do things that ordinary backends expect.
gcc/ada/ChangeLog:
* sem_util.adb (Get_Actual_Subtype): Do the same for GCC and GNATprove
backends.
|
|
Continue being a non-reserved keyword, occurrences of continue may
be resolved as procedure calls. Get that special case out of the
way for GNATprove, in anticipation of support for continue keyword.
gcc/ada/ChangeLog:
* exp_spark.adb (Expand_SPARK): Add expansion of continue statements.
(Expand_SPARK_N_Continue_Statement): Expand continue statements resolved
as procedure calls into said procedure calls.
|
|
When checking restriction No_Relative_Delay and detecting calls to
Ada.Real_Time.Timing_Events.Set_Handler with a Time_Span parameter,
we looked at the exact type of the actual parameter, while we should
look at its base type.
This patch looks at the type of actual parameter like it is done in
Expand_N_Delay_Until_Statement.
gcc/ada/ChangeLog:
* sem_res.adb (Resolve_Call): Look at the base type of actual parameter
when checking call to Set_Handler.
|