This patch implements the No_Tagged_Type_Registration restriction,
analogous to No_Exception_Registration, but for tagged types.

Fix several violations of the RTE_Available protocol, as documented in
rtsfind.ads:

   --  If we call this and it returns True, we should generate a reference to
   --  E (usually a call). In other words, for a subprogram E, the compiler
   --  should not call RTE_Available (E) until it has decided it wants to
   --  generate a call to E.

This implies that RTE_Available must be called last in certain if statements.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

        * libgnat/s-rident.ads (No_Tagged_Type_Registration): New
        restriction identifier.
        * restrict.ads (Implementation_Restriction): Add restriction.
        * exp_ch7.adb (Process_Declarations): Suppress
        tagged-type-related finalization actions if the restriction is
        active.  Call RTE_Available last.
        * exp_disp.adb (Make_DT): Likewise.
        * exp_util.adb (Requires_Cleanup_Actions): Return False for a
        tagged type declaration if No_Tagged_Type_Registration is
        active.
        * sem_attr.adb (Check_Stream_Attribute): Check restriction
        No_Tagged_Type_Registration.
        * libgnat/a-except.ads (Null_Occurrence): Minor: Initialize, to
        avoid stopping at a warning in gdb.
        * doc/gnat_rm/standard_and_implementation_defined_restrictions.rst:
        Document new restriction.
        * gnat_rm.texi: Regenerate.

Attachment: patch.diff.gz
Description: application/gzip

Reply via email to