[Ada] Fix search for "for ... of" loop subprograms
This patch makes the search for Get_Element_Access, Step (Next/Prev),
Reference_Control_Type, and Pseudo_Reference (for optimized "for ... of"
loops) more robust. In particular, we have a new Next procedure in Ada
2022, and we need to pick the right one.
We have not yet added the new Next and other subprograms.
gcc/ada/
* exp_ch5.adb (Expand_Iterator_Loop_Over_Container): For each
subprogram found, assert that the variable is Empty, so we can
detect bugs where we find two or more things with the same name.
Without this patch, that bug would happen when we add the new
Next procedure. For Step, make sure we pick the right one, by
checking name and number of parameters. For Get_Element_Access,
check that we're picking a function. That's not really
necessary, because there is no procedure with that name, but it
seems cleaner this way.
* rtsfind.ads: Minor comment improvement. It seems kind of odd
to say "under no circumstances", and then immediately contradict
that with "The one exception is...".