summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--errorout.adb18
-rw-r--r--errorout.ads3
-rw-r--r--sem_assocs.adb28
-rw-r--r--sem_specs.adb34
4 files changed, 53 insertions, 30 deletions
diff --git a/errorout.adb b/errorout.adb
index 9892728..51611f5 100644
--- a/errorout.adb
+++ b/errorout.adb
@@ -1069,4 +1069,22 @@ package body Errorout is
end if;
end Error_Not_Match;
+ function Get_Mode_Name (Mode : Iir_Mode) return String is
+ begin
+ case Mode is
+ when Iir_Unknown_Mode =>
+ raise Internal_Error;
+ when Iir_Linkage_Mode =>
+ return "linkage";
+ when Iir_Buffer_Mode =>
+ return "buffer";
+ when Iir_Out_Mode =>
+ return "out";
+ when Iir_Inout_Mode =>
+ return "inout";
+ when Iir_In_Mode =>
+ return "in";
+ end case;
+ end Get_Mode_Name;
+
end Errorout;
diff --git a/errorout.ads b/errorout.ads
index fddd355..35a6531 100644
--- a/errorout.ads
+++ b/errorout.ads
@@ -121,4 +121,7 @@ package Errorout is
-- Report an error message as type of EXPR does not match A_TYPE.
-- Location is LOC.
procedure Error_Not_Match (Expr: Iir; A_Type: Iir; Loc : Iir);
+
+ -- Disp interface mode MODE.
+ function Get_Mode_Name (Mode : Iir_Mode) return String;
end Errorout;
diff --git a/sem_assocs.adb b/sem_assocs.adb
index d752c79..ff7c5eb 100644
--- a/sem_assocs.adb
+++ b/sem_assocs.adb
@@ -65,24 +65,6 @@ package body Sem_Assocs is
return Ok;
end Sem_Actual_Of_Association_Chain;
- function Get_Mode_Name (Mode : Iir_Mode) return String is
- begin
- case Mode is
- when Iir_Unknown_Mode =>
- raise Internal_Error;
- when Iir_Linkage_Mode =>
- return "linkage";
- when Iir_Buffer_Mode =>
- return "buffer";
- when Iir_Out_Mode =>
- return "out";
- when Iir_Inout_Mode =>
- return "inout";
- when Iir_In_Mode =>
- return "in";
- end case;
- end Get_Mode_Name;
-
procedure Check_Parameter_Association_Restriction
(Inter : Iir; Base_Actual : Iir; Loc : Iir)
is
@@ -344,10 +326,12 @@ package body Sem_Assocs is
end if;
end if;
- Error_Msg_Sem
- ("cannot associate " & Get_Mode_Name (Fmode) & " "
- & Disp_Node (Formal) & " with actual port of mode "
- & Get_Mode_Name (Amode), Assoc);
+ if Assoc /= Null_Iir then
+ Error_Msg_Sem
+ ("cannot associate " & Get_Mode_Name (Fmode) & " "
+ & Disp_Node (Formal) & " with actual port of mode "
+ & Get_Mode_Name (Amode), Assoc);
+ end if;
return False;
end Check_Port_Association_Restriction;
diff --git a/sem_specs.adb b/sem_specs.adb
index b746a34..56dbd9e 100644
--- a/sem_specs.adb
+++ b/sem_specs.adb
@@ -1475,18 +1475,36 @@ package body Sem_Specs is
Location_Copy (Assoc, Parent);
else
if not Are_Nodes_Compatible (Comp_El, Ent_El) then
+ if not Error then
+ Error_Msg_Sem
+ ("for default port binding of " & Disp_Node (Parent)
+ & ":", Parent);
+ end if;
Error_Msg_Sem
- ("type of "
- & Disp_Node (Comp_El) & " from " & Disp_Node (Comp)
- & " and "
- & Disp_Node (Ent_El) & " from " & Disp_Node (Entity)
- & " are not compatible for an association",
- Parent);
+ ("type of " & Disp_Node (Comp_El)
+ & " declarared at " & Disp_Location (Comp_El), Parent);
+ Error_Msg_Sem
+ ("not compatible with type of " & Disp_Node (Ent_El)
+ & " declarared at " & Disp_Location (Ent_El), Parent);
Error := True;
elsif Kind = Map_Port
- and then
- not Check_Port_Association_Restriction (Ent_El, Comp_El, Parent)
+ and then not Check_Port_Association_Restriction
+ (Ent_El, Comp_El, Null_Iir)
then
+ if not Error then
+ Error_Msg_Sem
+ ("for default port binding of " & Disp_Node (Parent)
+ & ":", Parent);
+ end if;
+ Error_Msg_Sem
+ ("cannot associate "
+ & Get_Mode_Name (Get_Mode (Ent_El))
+ & " " & Disp_Node (Ent_El)
+ & " declarared at " & Disp_Location (Ent_El), Parent);
+ Error_Msg_Sem
+ ("with actual port of mode "
+ & Get_Mode_Name (Get_Mode (Comp_El))
+ & " declared at " & Disp_Location (Comp_El), Parent);
Error := True;
end if;
Assoc := Create_Iir (Iir_Kind_Association_Element_By_Expression);