aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2024-04-29 08:35:43 -0400
committerMarc Poulhiès <poulhies@adacore.com>2024-06-13 15:30:33 +0200
commit79a35e558e74fd61fa265e0307f2296114ab1b86 (patch)
tree48c2887313101046673f492580e50805bbafc560
parenta028b7f0090e82e79a5458b0e7e34915b377c04c (diff)
downloadgcc-79a35e558e74fd61fa265e0307f2296114ab1b86.zip
gcc-79a35e558e74fd61fa265e0307f2296114ab1b86.tar.gz
gcc-79a35e558e74fd61fa265e0307f2296114ab1b86.tar.bz2
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.
-rw-r--r--gcc/ada/libgnat/a-ticoau.ads2
-rw-r--r--gcc/ada/libgnat/a-wtcoau.ads2
-rw-r--r--gcc/ada/libgnat/a-ztcoau.ads2
-rw-r--r--gcc/ada/sem_ch12.adb28
4 files changed, 17 insertions, 17 deletions
diff --git a/gcc/ada/libgnat/a-ticoau.ads b/gcc/ada/libgnat/a-ticoau.ads
index 223e823..58feea3a 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 854b7b9..781582d 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 953ed5d..89f19e8 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 7daa35f..93e81fd 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;