[gcc r15-1280] ada: Minor cleanups in generic formal matching
Marc Poulhi?s
dkm@gcc.gnu.org
Thu Jun 13 13:35:21 GMT 2024
https://gcc.gnu.org/g:79a35e558e74fd61fa265e0307f2296114ab1b86
commit r15-1280-g79a35e558e74fd61fa265e0307f2296114ab1b86
Author: Bob Duff <duff@adacore.com>
Date: Mon Apr 29 08:35:43 2024 -0400
ada: Minor cleanups in generic formal matching
Minor rewording of a warning.
Disallow positional notation for <> (but disable this check),
and fix resulting errors.
Copy use clauses.
gcc/ada/
* sem_ch12.adb (Check_Fixed_Point_Actual): Minor rewording; it seems
more proper to say "operator" rather than "operation".
(Matching_Actual): Give an error for <> in positional notation.
This is a syntax error. Disable this for now.
(Analyze_Associations): Copy the use clause in all cases.
The "mustn't recopy" comment seems wrong, because New_Copy_Tree
preserves Slocs.
* libgnat/a-ticoau.ads: Fix violation of new postion-box error.
* libgnat/a-wtcoau.ads: Likewise.
* libgnat/a-ztcoau.ads: Likewise.
Diff:
---
gcc/ada/libgnat/a-ticoau.ads | 2 +-
gcc/ada/libgnat/a-wtcoau.ads | 2 +-
gcc/ada/libgnat/a-ztcoau.ads | 2 +-
gcc/ada/sem_ch12.adb | 28 ++++++++++++++--------------
4 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/gcc/ada/libgnat/a-ticoau.ads b/gcc/ada/libgnat/a-ticoau.ads
index 223e82376045..58feea3af71c 100644
--- a/gcc/ada/libgnat/a-ticoau.ads
+++ b/gcc/ada/libgnat/a-ticoau.ads
@@ -42,7 +42,7 @@ private generic
type Num is digits <>;
- with package Aux is new Ada.Text_IO.Float_Aux (Num, <>, <>);
+ with package Aux is new Ada.Text_IO.Float_Aux (Num, others => <>);
package Ada.Text_IO.Complex_Aux is
diff --git a/gcc/ada/libgnat/a-wtcoau.ads b/gcc/ada/libgnat/a-wtcoau.ads
index 854b7b9fb60b..781582dff9b4 100644
--- a/gcc/ada/libgnat/a-wtcoau.ads
+++ b/gcc/ada/libgnat/a-wtcoau.ads
@@ -42,7 +42,7 @@ private generic
type Num is digits <>;
- with package Aux is new Ada.Wide_Text_IO.Float_Aux (Num, <>, <>);
+ with package Aux is new Ada.Wide_Text_IO.Float_Aux (Num, others => <>);
package Ada.Wide_Text_IO.Complex_Aux is
diff --git a/gcc/ada/libgnat/a-ztcoau.ads b/gcc/ada/libgnat/a-ztcoau.ads
index 953ed5d9a184..89f19e8e1d3f 100644
--- a/gcc/ada/libgnat/a-ztcoau.ads
+++ b/gcc/ada/libgnat/a-ztcoau.ads
@@ -26,7 +26,7 @@ private generic
type Num is digits <>;
- with package Aux is new Ada.Wide_Wide_Text_IO.Float_Aux (Num, <>, <>);
+ with package Aux is new Ada.Wide_Wide_Text_IO.Float_Aux (Num, others => <>);
package Ada.Wide_Wide_Text_IO.Complex_Aux is
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 7daa35f7fe18..93e81fd95392 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -1402,8 +1402,8 @@ package body Sem_Ch12 is
if No (Formal) then
Error_Msg_Sloc := Sloc (Node (Elem));
Error_Msg_NE
- ("?instance uses predefined operation, not primitive "
- & "operation&#", Actual, Node (Elem));
+ ("?instance uses predefined, not primitive, operator&#",
+ Actual, Node (Elem));
end if;
end if;
@@ -1490,6 +1490,16 @@ package body Sem_Ch12 is
-- Case of positional parameter corresponding to current formal
elsif No (Selector_Name (Actual)) then
+ -- A "<>" without "name =>" is illegal syntax
+
+ if Box_Present (Actual) then
+ if False then -- ???
+ -- Disable this for now, because we have various code that
+ -- needs to be updated.
+ Error_Msg_N ("box requires named notation", Actual);
+ end if;
+ end if;
+
Found_Assoc := Actual;
Act := Explicit_Generic_Actual_Parameter (Actual);
Num_Matched := Num_Matched + 1;
@@ -2208,22 +2218,12 @@ package body Sem_Ch12 is
end Explicit_Freeze_Check;
end if;
- -- For use type and use package appearing in the generic part,
- -- we have already copied them, so we can just move them where
- -- they belong (we mustn't recopy them since this would mess up
- -- the Sloc values).
+ -- Copy use clauses to where they belong
when N_Use_Package_Clause
| N_Use_Type_Clause
=>
- if Nkind (Original_Node (I_Node)) =
- N_Formal_Package_Declaration
- then
- Append (New_Copy_Tree (Formal), Assoc_List);
- else
- Remove (Formal);
- Append (Formal, Assoc_List);
- end if;
+ Append (New_Copy_Tree (Formal), Assoc_List);
when others =>
raise Program_Error;
More information about the Gcc-cvs
mailing list