From 1c8b894c429a29a34ac251c5536ececd18bac048 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 12 May 2015 22:42:22 +0200 Subject: Always report pure rules violation, but as a warning in 93c or -frelaxed-rules For ticket 57. --- src/vhdl/sem_decls.adb | 48 +++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 25 deletions(-) (limited to 'src/vhdl/sem_decls.adb') diff --git a/src/vhdl/sem_decls.adb b/src/vhdl/sem_decls.adb index c7b26cc..8d79338 100644 --- a/src/vhdl/sem_decls.adb +++ b/src/vhdl/sem_decls.adb @@ -1894,31 +1894,29 @@ package body Sem_Decls is -- Note: this check is also performed when a file is referenced. -- But a file can be declared without being explicitly referenced. - if Flags.Vhdl_Std > Vhdl_93c then - declare - Parent : Iir; - Spec : Iir; - begin - Parent := Get_Parent (Decl); - case Get_Kind (Parent) is - when Iir_Kind_Function_Body => - Spec := Get_Subprogram_Specification (Parent); - if Get_Pure_Flag (Spec) then - Error_Msg_Sem - ("cannot declare a file in a pure function", Decl); - end if; - when Iir_Kind_Procedure_Body => - Spec := Get_Subprogram_Specification (Parent); - Set_Purity_State (Spec, Impure); - Set_Impure_Depth (Parent, Iir_Depth_Impure); - when Iir_Kind_Function_Declaration - | Iir_Kind_Procedure_Declaration => - Error_Kind ("sem_file_declaration", Parent); - when others => - null; - end case; - end; - end if; + declare + Parent : Iir; + Spec : Iir; + begin + Parent := Get_Parent (Decl); + case Get_Kind (Parent) is + when Iir_Kind_Function_Body => + Spec := Get_Subprogram_Specification (Parent); + if Get_Pure_Flag (Spec) then + Error_Msg_Sem_Relaxed + ("cannot declare a file in a pure function", Decl); + end if; + when Iir_Kind_Procedure_Body => + Spec := Get_Subprogram_Specification (Parent); + Set_Purity_State (Spec, Impure); + Set_Impure_Depth (Parent, Iir_Depth_Impure); + when Iir_Kind_Function_Declaration + | Iir_Kind_Procedure_Declaration => + Error_Kind ("sem_file_declaration", Parent); + when others => + null; + end case; + end; end Sem_File_Declaration; procedure Sem_Attribute_Declaration (Decl: Iir_Attribute_Declaration) -- cgit