From 182770c28bbc3d84e5c39b504790c3a6bbf162d3 Mon Sep 17 00:00:00 2001 From: Xiretza Date: Sat, 26 Feb 2022 16:26:03 +0100 Subject: 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 --- src/vhdl/vhdl-sem_decls.adb | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src') 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 => -- cgit v1.2.3