aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
diff options
context:
space:
mode:
authorXiretza <xiretza@xiretza.xyz>2022-02-26 16:26:03 +0100
committertgingold <tgingold@users.noreply.github.com>2022-03-01 19:17:40 +0100
commit182770c28bbc3d84e5c39b504790c3a6bbf162d3 (patch)
tree53877d2d44c5b0bb9f539dde6c8679c52a820d4a /src/vhdl
parentaad9a1fcc0344f0e5d1c8cee56d8d889dda13359 (diff)
downloadghdl-182770c28bbc3d84e5c39b504790c3a6bbf162d3.tar.gz
ghdl-182770c28bbc3d84e5c39b504790c3a6bbf162d3.tar.bz2
ghdl-182770c28bbc3d84e5c39b504790c3a6bbf162d3.zip
vhdl-sem_decls: allow out/inout parameters to impure function in VHDL-2019
This implements LCS-2016-002: http://www.eda-twiki.org/cgi-bin/view.cgi/P1076/LCS2016_002
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/vhdl-sem_decls.adb18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/vhdl/vhdl-sem_decls.adb b/src/vhdl/vhdl-sem_decls.adb
index a78f482c1..c081cba5d 100644
--- a/src/vhdl/vhdl-sem_decls.adb
+++ b/src/vhdl/vhdl-sem_decls.adb
@@ -415,6 +415,10 @@ package body Vhdl.Sem_Decls is
when Parameter_Interface_List =>
if Get_Kind (Inter) = Iir_Kind_Interface_Variable_Declaration
and then Interface_Kind = Function_Parameter_Interface_List
+ and then (
+ Vhdl_Std < Vhdl_19
+ or else Get_Pure_Flag (Get_Parent (Inter))
+ )
then
Error_Msg_Sem (+Inter, "variable interface parameter are not "
& "allowed for a function (use a constant)");
@@ -440,9 +444,17 @@ package body Vhdl.Sem_Decls is
and then
Get_Kind (Inter) /= Iir_Kind_Interface_File_Declaration
then
- Error_Msg_Sem
- (+Inter,
- "mode of a function parameter cannot be inout or out");
+ if Vhdl_Std < Vhdl_19 then
+ Error_Msg_Sem
+ (+Inter,
+ "mode of a function parameter cannot " &
+ "be inout or out");
+ elsif Get_Pure_Flag (Get_Parent (Inter)) then
+ Error_Msg_Sem
+ (+Inter,
+ "mode of a pure function's parameter cannot " &
+ "be inout or out");
+ end if;
end if;
when Iir_Buffer_Mode
| Iir_Linkage_Mode =>