public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <derodat@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Eric Botcazou <ebotcazou@adacore.com>
Subject: [Ada] Fix implementation issues with equality for untagged record types
Date: Mon, 16 May 2022 08:43:03 +0000	[thread overview]
Message-ID: <20220516084303.GA3843484@adacore.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2654 bytes --]

This moves the implementation of AI12-0101 + AI05-0123 from the expander
to the semantic analyzer and completes the implementation of AI12-0413,
which are both binding interpretations in Ada 2012, fixing a few bugs in
the process and removing a fair amount of duplicated code throughout.

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

gcc/ada/

	* einfo-utils.adb (Remove_Entity): Fix couple of oversights.
	* exp_ch3.adb (Is_User_Defined_Equality): Delete.
	(User_Defined_Eq): Call Get_User_Defined_Equality.
	(Make_Eq_Body): Likewise.
	(Predefined_Primitive_Eq_Body): Call Is_User_Defined_Equality.
	* exp_ch4.adb (Build_Eq_Call): Call Get_User_Defined_Equality.
	(Is_Equality): Delete.
	(User_Defined_Primitive_Equality_Op): Likewise.
	(Find_Aliased_Equality): Call Is_User_Defined_Equality.
	(Expand_N_Op_Eq): Call Underlying_Type unconditionally.
	Do not implement AI12-0101 + AI05-0123 here.
	(Expand_Set_Membership): Call Resolve_Membership_Equality.
	* exp_ch6.adb (Expand_Call_Helper): Remove obsolete code.
	* sem_aux.ads (Is_Record_Or_Limited_Type): Delete.
	* sem_aux.adb (Is_Record_Or_Limited_Type): Likewise.
	* sem_ch4.ads (Nondispatching_Call_To_Abstract_Operation): Declare.
	* sem_ch4.adb (Analyze_Call): Call Call_Abstract_Operation.
	(Analyze_Membership_Op): Call Resolve_Membership_Equality.
	(Nondispatching_Call_To_Abstract_Operation): New procedure.
	(Remove_Abstract_Operations): Call it.
	* sem_ch6.adb (Check_Untagged_Equality): Remove obsolete error and
	call Is_User_Defined_Equality.
	* sem_ch7.adb (Inspect_Untagged_Record_Completion): New procedure
	implementing AI12-0101 + AI05-0123.
	(Analyze_Package_Specification): Call it.
	(Declare_Inherited_Private_Subprograms): Minor tweak.
	(Uninstall_Declarations): Likewise.
	* sem_disp.adb (Check_Direct_Call): Adjust to new implementation
	of Is_User_Defined_Equality.
	* sem_res.ads (Resolve_Membership_Equality): Declare.
	* sem_res.adb (Resolve): Replace direct error handling with call to
	Nondispatching_Call_To_Abstract_Operation
	(Resolve_Call): Likewise.
	(Resolve_Equality_Op): Likewise.  mplement AI12-0413.
	(Resolve_Membership_Equality): New procedure.
	(Resolve_Membership_Op): Call Get_User_Defined_Equality.
	* sem_util.ads (Get_User_Defined_Eq): Rename into...
	(Get_User_Defined_Equality): ...this.
	* sem_util.adb (Get_User_Defined_Eq): Rename into...
	(Get_User_Defined_Equality): ...this. Call Is_User_Defined_Equality.
	(Is_User_Defined_Equality): Also check the profile but remove tests
	on Comes_From_Source and Parent.
	* sinfo.ads (Generic_Parent_Type): Adjust field description.
	* uintp.ads (Ubool): Invoke user-defined equality in predicate.

[-- Attachment #2: patch.diff.gz --]
[-- Type: application/gzip, Size: 9872 bytes --]

                 reply	other threads:[~2022-05-16  8:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220516084303.GA3843484@adacore.com \
    --to=derodat@adacore.com \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).