diff options
author | gingold <gingold@b72b5c32-5f01-0410-b925-b5c7b92870f7> | 2008-08-31 02:22:57 +0000 |
---|---|---|
committer | gingold <gingold@b72b5c32-5f01-0410-b925-b5c7b92870f7> | 2008-08-31 02:22:57 +0000 |
commit | b42e36e23f23a0d27e7b08d6cb4461237720de3b (patch) | |
tree | 05c59df8138658b9f811510264c32bb753123bc0 | |
parent | 1d5464fd378387a0e17021af24065784ea66bb47 (diff) | |
download | ghdl-b42e36e23f23a0d27e7b08d6cb4461237720de3b.tar.gz ghdl-b42e36e23f23a0d27e7b08d6cb4461237720de3b.tar.bz2 ghdl-b42e36e23f23a0d27e7b08d6cb4461237720de3b.zip |
Create package options from flags to avoid circular elaboration
-rw-r--r-- | back_end.adb | 5 | ||||
-rw-r--r-- | canon.adb | 4 | ||||
-rw-r--r-- | evaluation.adb | 2 | ||||
-rw-r--r-- | flags.adb | 202 | ||||
-rw-r--r-- | flags.ads | 18 | ||||
-rw-r--r-- | iir_chains.ads | 4 | ||||
-rw-r--r-- | iirs_utils.adb | 2 | ||||
-rw-r--r-- | options.adb | 219 | ||||
-rw-r--r-- | options.ads | 27 | ||||
-rw-r--r-- | parse.adb | 2 | ||||
-rw-r--r-- | sem.adb | 6 | ||||
-rw-r--r-- | sem_assocs.adb | 2 | ||||
-rw-r--r-- | sem_decls.adb | 2 | ||||
-rw-r--r-- | sem_expr.adb | 2 | ||||
-rw-r--r-- | sem_names.adb | 2 | ||||
-rw-r--r-- | sem_specs.adb | 2 | ||||
-rw-r--r-- | sem_stmts.adb | 2 | ||||
-rw-r--r-- | sem_types.adb | 2 | ||||
-rw-r--r-- | std_package.adb | 18 | ||||
-rw-r--r-- | translate/Makefile | 2 | ||||
-rw-r--r-- | translate/gcc/dist-common.sh | 2 | ||||
-rw-r--r-- | translate/ghdldrv/ghdldrv.adb | 3 | ||||
-rw-r--r-- | translate/ghdldrv/ghdllocal.adb | 9 | ||||
-rw-r--r-- | translate/ghdldrv/ghdlmain.adb | 4 | ||||
-rw-r--r-- | translate/ghdldrv/ghdlprint.adb | 1 | ||||
-rw-r--r-- | translate/ortho_front.adb | 7 | ||||
-rw-r--r-- | translate/translation.adb | 2 | ||||
-rw-r--r-- | types.ads | 4 |
28 files changed, 300 insertions, 257 deletions
diff --git a/back_end.adb b/back_end.adb index 034aa23eb..7efb15e79 100644 --- a/back_end.adb +++ b/back_end.adb @@ -15,8 +15,7 @@ -- along with GCC; see the file COPYING. If not, write to the Free -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. -with Flags; -with Types; use Types; +with Flags; use Flags; with Iirs_Utils; use Iirs_Utils; package body Back_End is @@ -27,7 +26,7 @@ package body Back_End is return String is begin - case Flags.Vhdl_Std is + case Vhdl_Std is when Vhdl_87 => return Image_Identifier (Library) & "-obj87.cf"; when Vhdl_93c | Vhdl_93 | Vhdl_00 | Vhdl_02 => @@ -22,7 +22,7 @@ with Name_Table; with Sem; with Std_Names; with Iir_Chains; use Iir_Chains; -with Flags; +with Flags; use Flags; package body Canon is -- Canonicalize a list of declarations. LIST can be null. @@ -1712,7 +1712,7 @@ package body Canon is end if; when Iir_Kind_Generate_Statement => if False - and then Flags.Vhdl_Std = Vhdl_87 + and then Vhdl_Std = Vhdl_87 and then Get_Kind (Conf) = Iir_Kind_Configuration_Specification then diff --git a/evaluation.adb b/evaluation.adb index ddb110988..2323691b7 100644 --- a/evaluation.adb +++ b/evaluation.adb @@ -20,7 +20,7 @@ with Name_Table; use Name_Table; with Str_Table; with Iirs_Utils; use Iirs_Utils; with Std_Package; use Std_Package; -with Flags; +with Flags; use Flags; with Std_Names; package body Evaluation is @@ -1,5 +1,5 @@ --- Command line flags. --- Copyright (C) 2002, 2003, 2004, 2005 Tristan Gingold +-- Global flags. +-- Copyright (C) 2002, 2003, 2004, 2005, 2008 Tristan Gingold -- -- GHDL is free software; you can redistribute it and/or modify it under -- the terms of the GNU General Public License as published by the Free @@ -15,206 +15,8 @@ -- along with GCC; see the file COPYING. If not, write to the Free -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. -with Ada.Text_IO; use Ada.Text_IO; -with Name_Table; -with Libraries; -with Scan; -with Back_End; use Back_End; package body Flags is - function Option_Warning (Opt: String; Val : Boolean) return Boolean is - begin --- if Opt = "undriven" then --- Warn_Undriven := True; - if Opt = "library" then - Warn_Library := Val; - elsif Opt = "default-binding" then - Warn_Default_Binding := Val; - elsif Opt = "binding" then - Warn_Binding := Val; - elsif Opt = "reserved" then - Warn_Reserved_Word := Val; - elsif Opt = "vital-generic" then - Warn_Vital_Generic := Val; - elsif Opt = "delayed-checks" then - Warn_Delayed_Checks := Val; - elsif Opt = "body" then - Warn_Body := Val; - elsif Opt = "specs" then - Warn_Specs := Val; - elsif Opt = "unused" then - Warn_Unused := Val; - elsif Opt = "error" then - Warn_Error := Val; - else - return False; - end if; - return True; - end Option_Warning; - - function Parse_Option (Opt: String) return Boolean is - Beg: constant Integer := Opt'First; - begin - if Opt'Length > 5 and then Opt (Beg .. Beg + 5) = "--std=" then - if Opt'Length = 8 then - if Opt (Beg + 6 .. Beg + 7) = "87" then - Vhdl_Std := Vhdl_87; - elsif Opt (Beg + 6 .. Beg + 7) = "93" then - Vhdl_Std := Vhdl_93; - elsif Opt (Beg + 6 .. Beg + 7) = "00" then - Vhdl_Std := Vhdl_00; - elsif Opt (Beg + 6 .. Beg + 7) = "02" then - Vhdl_Std := Vhdl_02; - else - return False; - end if; - elsif Opt'Length = 9 and then Opt (Beg + 6 .. Beg + 8) = "93c" then - Vhdl_Std := Vhdl_93c; - else - return False; - end if; - elsif Opt'Length > 2 and then Opt (Beg .. Beg + 1) = "-P" then - Libraries.Add_Library_Path (Opt (Beg + 2 .. Opt'Last)); - elsif Opt'Length > 10 and then Opt (Beg .. Beg + 9) = "--workdir=" then - Libraries.Set_Work_Library_Path (Opt (Beg + 10 .. Opt'Last)); - elsif Opt'Length > 10 and then Opt (Beg .. Beg + 9) = "--warn-no-" then - return Option_Warning (Opt (Beg + 10 .. Opt'Last), False); - elsif Opt'Length > 7 and then Opt (Beg .. Beg + 6) = "--warn-" then - return Option_Warning (Opt (Beg + 7 .. Opt'Last), True); - elsif Opt'Length > 7 and then Opt (Beg .. Beg + 6) = "--work=" then - declare - use Name_Table; - begin - Name_Length := Opt'Last - (Beg + 7) + 1; - Name_Buffer (1 .. Name_Length) := Opt (Beg + 7 .. Opt'Last); - Scan.Convert_Identifier; - Libraries.Work_Library_Name := Get_Identifier; - end; - elsif Opt = "-C" or else Opt = "--mb-comments" then - Mb_Comment := True; - elsif Opt = "--bootstrap" then - Bootstrap := True; - elsif Opt = "-fexplicit" then - Flag_Explicit := True; - elsif Opt = "--syn-binding" then - Flag_Syn_Binding := True; - elsif Opt = "--no-vital-checks" then - Flag_Vital_Checks := False; - elsif Opt = "--vital-checks" then - Flag_Vital_Checks := True; - elsif Opt = "-dp" then - Dump_Parse := True; - elsif Opt = "-ds" then - Dump_Sem := True; - elsif Opt = "-dc" then - Dump_Canon := True; - elsif Opt = "-da" then - Dump_Annotate := True; - elsif Opt = "--dall" then - Dump_All := True; - elsif Opt = "-dstats" then - Dump_Stats := True; - elsif Opt = "--lall" then - List_All := True; - elsif Opt = "-lv" then - List_Verbose := True; - elsif Opt = "-ls" then - List_Sem := True; - elsif Opt = "-lc" then - List_Canon := True; - elsif Opt = "-la" then - List_Annotate := True; - elsif Opt = "-v" then - Verbose := True; - elsif Opt = "--finteger64" then - Flag_Integer_64 := True; - elsif Opt = "--ftime32" then - Flag_Time_64 := False; --- elsif Opt'Length > 17 --- and then Opt (Beg .. Beg + 17) = "--time-resolution=" --- then --- Beg := Beg + 18; --- if Opt (Beg .. Beg + 1) = "fs" then --- Time_Resolution := 'f'; --- elsif Opt (Beg .. Beg + 1) = "ps" then --- Time_Resolution := 'p'; --- elsif Opt (Beg .. Beg + 1) = "ns" then --- Time_Resolution := 'n'; --- elsif Opt (Beg .. Beg + 1) = "us" then --- Time_Resolution := 'u'; --- elsif Opt (Beg .. Beg + 1) = "ms" then --- Time_Resolution := 'm'; --- elsif Opt (Beg .. Beg + 2) = "sec" then --- Time_Resolution := 's'; --- elsif Opt (Beg .. Beg + 2) = "min" then --- Time_Resolution := 'M'; --- elsif Opt (Beg .. Beg + 1) = "hr" then --- Time_Resolution := 'h'; --- else --- return False; --- end if; - elsif Back_End.Parse_Option /= null - and then Back_End.Parse_Option.all (Opt) - then - null; - else - return False; - end if; - return True; - end Parse_Option; - - -- Disp help about these options. - procedure Disp_Options_Help - is - procedure P (S : String) renames Put_Line; - begin - P ("Main options:"); - P (" --work=LIB use LIB as work library"); - P (" --workdir=DIR use DIR for the file library"); - P (" -PPATH add PATH in the library path list"); - P (" --std=87 select vhdl 87 standard"); - P (" --std=93 select vhdl 93 standard"); - P (" --std=93c select vhdl 93 standard and allow 87 syntax"); - P (" --[no-]vital-checks do [not] check VITAL restrictions"); - P ("Warnings:"); --- P (" --warn-undriven disp undriven signals"); - P (" --warn-binding warns for component not bound"); - P (" --warn-reserved warns use of 93 reserved words in vhdl87"); - P (" --warn-library warns for redefinition of a design unit"); - P (" --warn-vital-generic warns of non-vital generic names"); - P (" --warn-delayed-checks warns for checks performed at elaboration"); - P (" --warn-body warns for not necessary package body"); - P (" --warn-specs warns if a all/others spec does not apply"); - P (" --warn-unused warns if a subprogram is never used"); - P (" --warn-error turns warnings into errors"); --- P ("Simulation option:"); --- P (" --time-resolution=UNIT set the resolution of type time"); --- P (" UNIT can be fs, ps, ns, us, ms, sec, min or hr"); --- P (" --assert-level=LEVEL set the level which stop the"); --- P (" simulation. LEVEL is note, warning, error,"); --- P (" failure or none"); - P ("Illegal extensions:"); - P (" -fexplicit give priority to explicitly declared operator"); - P (" -C --mb-comments allow multi-bytes chars in a comment"); - P (" --bootstrap allow --work=std"); - P (" --syn-binding use synthesis default binding rule"); - P ("Compilation list:"); - P (" -ls after semantics"); - P (" -lc after canon"); - P (" -la after annotation"); - P (" --lall -lX options apply to all files"); - P (" -lv verbose list"); - P (" -v disp compilation stages"); - P ("Compilation dump:"); - P (" -dp dump tree after parsing"); - P (" -ds dump tree after semantics"); - P (" -da dump tree after annotate"); - P (" --dall -dX options apply to all files"); - if Back_End.Disp_Option /= null then - Back_End.Disp_Option.all; - end if; - end Disp_Options_Help; - procedure Create_Flag_String is begin case Vhdl_Std is @@ -1,5 +1,5 @@ --- Command line flags. --- Copyright (C) 2002, 2003, 2004, 2005 Tristan Gingold +-- Global flags. +-- Copyright (C) 2002, 2003, 2004, 2005, 2008 Tristan Gingold -- -- GHDL is free software; you can redistribute it and/or modify it under -- the terms of the GNU General Public License as published by the Free @@ -22,20 +22,14 @@ -- Since the names are not prefixed, this package is expected to be with'ed -- but not to be use'd. -with Types; use Types; - package Flags is + -- List of vhdl standards. + -- VHDL_93c is vhdl_93 with backward compatibility with 87 (file). + type Vhdl_Std_Type is (Vhdl_87, Vhdl_93c, Vhdl_93, Vhdl_00, Vhdl_02); + -- Standard accepted. Vhdl_Std: Vhdl_Std_Type := Vhdl_93c; - -- Return true if opt is recognize by flags. - -- Note: std_names.std_names_initialize and files_map.init_pathes must have - -- been called before this subprogram. - function Parse_Option (Opt: String) return Boolean; - - -- Disp help about these options. - procedure Disp_Options_Help; - -- Some flags (such as vhdl version) must be the same for every design -- units of a hierarchy. -- The Flag_String is a signature of all these flags. diff --git a/iir_chains.ads b/iir_chains.ads index 116ae8466..45da27fa6 100644 --- a/iir_chains.ads +++ b/iir_chains.ads @@ -17,9 +17,7 @@ -- 02111-1307, USA. with Iirs; use Iirs; with Iir_Chain_Handling; -pragma Warnings (Off); -pragma Elaborate (Iir_Chain_Handling); -pragma Warnings (On); +pragma Elaborate_All (Iir_Chain_Handling); package Iir_Chains is -- Chains are simply linked list of iirs. diff --git a/iirs_utils.adb b/iirs_utils.adb index 4d64f3478..01c98d22f 100644 --- a/iirs_utils.adb +++ b/iirs_utils.adb @@ -21,7 +21,7 @@ with Errorout; use Errorout; with Name_Table; with Str_Table; with Std_Names; use Std_Names; -with Flags; +with Flags; use Flags; package body Iirs_Utils is -- Transform the current token into an iir literal. diff --git a/options.adb b/options.adb new file mode 100644 index 000000000..36aeb2105 --- /dev/null +++ b/options.adb @@ -0,0 +1,219 @@ +-- Command line options. +-- Copyright (C) 2008 Tristan Gingold +-- +-- GHDL is free software; you can redistribute it and/or modify it under +-- the terms of the GNU General Public License as published by the Free +-- Software Foundation; either version 2, or (at your option) any later +-- version. +-- +-- GHDL is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or +-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +-- for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with GCC; see the file COPYING. If not, write to the Free +-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA +-- 02111-1307, USA. +with Ada.Text_IO; use Ada.Text_IO; +with Name_Table; +with Libraries; +with Scan; +with Back_End; use Back_End; +with Flags; use Flags; + +package body Options is + function Option_Warning (Opt: String; Val : Boolean) return Boolean is + begin +-- if Opt = "undriven" then +-- Warn_Undriven := True; + if Opt = "library" then + Warn_Library := Val; + elsif Opt = "default-binding" then + Warn_Default_Binding := Val; + elsif Opt = "binding" then + Warn_Binding := Val; + elsif Opt = "reserved" then + Warn_Reserved_Word := Val; + elsif Opt = "vital-generic" then + Warn_Vital_Generic := Val; + elsif Opt = "delayed-checks" then + Warn_Delayed_Checks := Val; + elsif Opt = "body" then + Warn_Body := Val; + elsif Opt = "specs" then + Warn_Specs := Val; + elsif Opt = "unused" then + Warn_Unused := Val; + elsif Opt = "error" then + Warn_Error := Val; + else + return False; + end if; + return True; + end Option_Warning; + + function Parse_Option (Opt: String) return Boolean is + Beg: constant Integer := Opt'First; + begin + if Opt'Length > 5 and then Opt (Beg .. Beg + 5) = "--std=" then + if Opt'Length = 8 then + if Opt (Beg + 6 .. Beg + 7) = "87" then + Vhdl_Std := Vhdl_87; + elsif Opt (Beg + 6 .. Beg + 7) = "93" then + Vhdl_Std := Vhdl_93; + elsif Opt (Beg + 6 .. Beg + 7) = "00" then + Vhdl_Std := Vhdl_00; + elsif Opt (Beg + 6 .. Beg + 7) = "02" then + Vhdl_Std := Vhdl_02; + else + return False; + end if; + elsif Opt'Length = 9 and then Opt (Beg + 6 .. Beg + 8) = "93c" then + Vhdl_Std := Vhdl_93c; + else + return False; + end if; + elsif Opt'Length > 2 and then Opt (Beg .. Beg + 1) = "-P" then + Libraries.Add_Library_Path (Opt (Beg + 2 .. Opt'Last)); + elsif Opt'Length > 10 and then Opt (Beg .. Beg + 9) = "--workdir=" then + Libraries.Set_Work_Library_Path (Opt (Beg + 10 .. Opt'Last)); + elsif Opt'Length > 10 and then Opt (Beg .. Beg + 9) = "--warn-no-" then + return Option_Warning (Opt (Beg + 10 .. Opt'Last), False); + elsif Opt'Length > 7 and then Opt (Beg .. Beg + 6) = "--warn-" then + return Option_Warning (Opt (Beg + 7 .. Opt'Last), True); + elsif Opt'Length > 7 and then Opt (Beg .. Beg + 6) = "--work=" then + declare + use Name_Table; + begin + Name_Length := Opt'Last - (Beg + 7) + 1; + Name_Buffer (1 .. Name_Length) := Opt (Beg + 7 .. Opt'Last); + Scan.Convert_Identifier; + Libraries.Work_Library_Name := Get_Identifier; + end; + elsif Opt = "-C" or else Opt = "--mb-comments" then + Mb_Comment := True; + elsif Opt = "--bootstrap" then + Bootstrap := True; + elsif Opt = "-fexplicit" then + Flag_Explicit := True; + elsif Opt = "--syn-binding" then + Flag_Syn_Binding := True; + elsif Opt = "--no-vital-checks" then + Flag_Vital_Checks := False; + elsif Opt = "--vital-checks" then + Flag_Vital_Checks := True; + elsif Opt = "-dp" then + Dump_Parse := True; + elsif Opt = "-ds" then + Dump_Sem := True; + elsif Opt = "-dc" then + Dump_Canon := True; + elsif Opt = "-da" then + Dump_Annotate := True; + elsif Opt = "--dall" then + Dump_All := True; + elsif Opt = "-dstats" then + Dump_Stats := True; + elsif Opt = "--lall" then + List_All := True; + elsif Opt = "-lv" then + List_Verbose := True; + elsif Opt = "-ls" then + List_Sem := True; + elsif Opt = "-lc" then + List_Canon := True; + elsif Opt = "-la" then + List_Annotate := True; + elsif Opt = "-v" then + Verbose := True; + elsif Opt = "--finteger64" then + Flag_Integer_64 := True; + elsif Opt = "--ftime32" then + Flag_Time_64 := False; +-- elsif Opt'Length > 17 +-- and then Opt (Beg .. Beg + 17) = "--time-resolution=" +-- then +-- Beg := Beg + 18; +-- if Opt (Beg .. Beg + 1) = "fs" then +-- Time_Resolution := 'f'; +-- elsif Opt (Beg .. Beg + 1) = "ps" then +-- Time_Resolution := 'p'; +-- elsif Opt (Beg .. Beg + 1) = "ns" then +-- Time_Resolution := 'n'; +-- elsif Opt (Beg .. Beg + 1) = "us" then +-- Time_Resolution := 'u'; +-- elsif Opt (Beg .. Beg + 1) = "ms" then +-- Time_Resolution := 'm'; +-- elsif Opt (Beg .. Beg + 2) = "sec" then +-- Time_Resolution := 's'; +-- elsif Opt (Beg .. Beg + 2) = "min" then +-- Time_Resolution := 'M'; +-- elsif Opt (Beg .. Beg + 1) = "hr" then +-- Time_Resolution := 'h'; +-- else +-- return False; +-- end if; + elsif Back_End.Parse_Option /= null + and then Back_End.Parse_Option.all (Opt) + then + null; + else + return False; + end if; + return True; + end Parse_Option; + + -- Disp help about these options. + procedure Disp_Options_Help + is + procedure P (S : String) renames Put_Line; + begin + P ("Main options:"); + P (" --work=LIB use LIB as work library"); + P (" --workdir=DIR use DIR for the file library"); + P (" -PPATH add PATH in the library path list"); + P (" --std=87 select vhdl 87 standard"); + P (" --std=93 select vhdl 93 standard"); + P (" --std=93c select vhdl 93 standard and allow 87 syntax"); + P (" --[no-]vital-checks do [not] check VITAL restrictions"); + P ("Warnings:"); +-- P (" --warn-undriven disp undriven signals"); + P (" --warn-binding warns for component not bound"); + P (" --warn-reserved warns use of 93 reserved words in vhdl87"); + P (" --warn-library warns for redefinition of a design unit"); + P (" --warn-vital-generic warns of non-vital generic names"); + P (" --warn-delayed-checks warns for checks performed at elaboration"); + P (" --warn-body warns for not necessary package body"); + P (" --warn-specs warns if a all/others spec does not apply"); + P (" --warn-unused warns if a subprogram is never used"); + P (" --warn-error turns warnings into errors"); +-- P ("Simulation option:"); +-- P (" --time-resolution=UNIT set the resolution of type time"); +-- P (" UNIT can be fs, ps, ns, us, ms, sec, min or hr"); +-- P (" --assert-level=LEVEL set the level which stop the"); +-- P (" simulation. LEVEL is note, warning, error,"); +-- P (" failure or none"); + P ("Illegal extensions:"); + P (" -fexplicit give priority to explicitly declared operator"); + P (" -C --mb-comments allow multi-bytes chars in a comment"); + P (" --bootstrap allow --work=std"); + P (" --syn-binding use synthesis default binding rule"); + P ("Compilation list:"); + P (" -ls after semantics"); + P (" -lc after canon"); + P (" -la after annotation"); + P (" --lall -lX options apply to all files"); + P (" -lv verbose list"); + P (" -v disp compilation stages"); + P ("Compilation dump:"); + P (" -dp dump tree after parsing"); + P (" -ds dump tree after semantics"); + P (" -da dump tree after annotate"); + P (" --dall -dX options apply to all files"); + if Back_End.Disp_Option /= null then + Back_End.Disp_Option.all; + end if; + end Disp_Options_Help; + +end Options; diff --git a/options.ads b/options.ads new file mode 100644 index 000000000..c5fa09c14 --- /dev/null +++ b/options.ads @@ -0,0 +1,27 @@ +-- Command line options. +-- Copyright (C) 2008 Tristan Gingold +-- +-- GHDL is free software; you can redistribute it and/or modify it under +-- the terms of the GNU General Public License as published by the Free +-- Software Foundation; either version 2, or (at your option) any later +-- version. +-- +-- GHDL is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or +-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +-- for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with GCC; see the file COPYING. If not, write to the Free +-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA +-- 02111-1307, USA. + +package Options is + -- Return true if opt is recognize by flags. + -- Note: std_names.std_names_initialize and files_map.init_pathes must have + -- been called before this subprogram. + function Parse_Option (Opt: String) return Boolean; + + -- Disp help about these options. + procedure Disp_Options_Help; +end Options; @@ -23,7 +23,7 @@ with Scan; use Scan; with Iirs_Utils; use Iirs_Utils; with Errorout; use Errorout; with Std_Names; use Std_Names; -with Flags; +with Flags; use Flags; with Name_Table; with Str_Table; with Xrefs; @@ -27,7 +27,7 @@ with Sem_Specs; use Sem_Specs; with Sem_Decls; use Sem_Decls; with Sem_Assocs; use Sem_Assocs; with Iirs_Utils; use Iirs_Utils; -with Flags; +with Flags; use Flags; with Name_Table; with Str_Table; with Sem_Stmts; use Sem_Stmts; @@ -197,11 +197,11 @@ package body Sem is -- considered to occur immediatly within the declarative region -- associated with the entity declaration corresponding to the given -- architecture body. - if Flags.Vhdl_Std >= Vhdl_02 then + if Vhdl_Std >= Vhdl_02 then Open_Declarative_Region; end if; Sem_Block (Arch, True); - if Flags.Vhdl_Std >= Vhdl_02 then + if Vhdl_Std >= Vhdl_02 then Close_Declarative_Region; end if; diff --git a/sem_assocs.adb b/sem_assocs.adb index 859226ee3..23b315a23 100644 --- a/sem_assocs.adb +++ b/sem_assocs.adb @@ -17,7 +17,7 @@ -- 02111-1307, USA. with Evaluation; use Evaluation; with Errorout; use Errorout; -with Flags; +with Flags; use Flags; with Types; use Types; with Iirs_Utils; use Iirs_Utils; with Sem_Names; use Sem_Names; diff --git a/sem_decls.adb b/sem_decls.adb index 3d1736c4d..1ab069831 100644 --- a/sem_decls.adb +++ b/sem_decls.adb @@ -19,7 +19,7 @@ with Errorout; use Errorout; with Types; use Types; with Std_Names; with Tokens; -with Flags; +with Flags; use Flags; with Std_Package; use Std_Package; with Iir_Chains; with Evaluation; use Evaluation; diff --git a/sem_expr.adb b/sem_expr.adb index ca862b063..ad1138a42 100644 --- a/sem_expr.adb +++ b/sem_expr.adb @@ -17,7 +17,7 @@ -- 02111-1307, USA. with Std_Package; use Std_Package; with Errorout; use Errorout; -with Flags; +with Flags; use Flags; with Sem_Scopes; use Sem_Scopes; with Sem_Names; use Sem_Names; with Sem; diff --git a/sem_names.adb b/sem_names.adb index ff5cd7183..69ffa1000 100644 --- a/sem_names.adb +++ b/sem_names.adb @@ -19,7 +19,7 @@ with Evaluation; use Evaluation; with Iirs_Utils; use Iirs_Utils; with Libraries; with Errorout; use Errorout; -with Flags; +with Flags; use Flags; with Name_Table; with Std_Package; use Std_Package; with Types; use Types; diff --git a/sem_specs.adb b/sem_specs.adb index 005ad57b9..7d1274984 100644 --- a/sem_specs.adb +++ b/sem_specs.adb @@ -28,7 +28,7 @@ with Sem_Assocs; use Sem_Assocs; with Libraries; with Iir_Chains; use Iir_Chains; with Sem_Types; -with Flags; +with Flags; use Flags; with Name_Table; with Std_Names; with Sem_Decls; diff --git a/sem_stmts.adb b/sem_stmts.adb index 6703acf27..ab0979afe 100644 --- a/sem_stmts.adb +++ b/sem_stmts.adb @@ -17,7 +17,7 @@ -- 02111-1307, USA. with Errorout; use Errorout; with Types; use Types; -with Flags; +with Flags; use Flags; with Sem_Specs; use Sem_Specs; with Std_Package; use Std_Package; with Sem; use Sem; diff --git a/sem_types.adb b/sem_types.adb index efd14801e..bd3cc55fc 100644 --- a/sem_types.adb +++ b/sem_types.adb @@ -16,7 +16,7 @@ -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. with Libraries; -with Flags; +with Flags; use Flags; with Types; use Types; with Errorout; use Errorout; with Evaluation; use Evaluation; diff --git a/std_package.adb b/std_package.adb index 074a75d8c..f18582eea 100644 --- a/std_package.adb +++ b/std_package.adb @@ -20,7 +20,7 @@ with Files_Map; with Name_Table; with Str_Table; with Std_Names; use Std_Names; -with Flags; +with Flags; use Flags; with Iirs_Utils; with Sem; with Sem_Decls; @@ -346,7 +346,7 @@ package body Std_Package is (Get_Std_Character (I), Character_Type_Definition); end loop; El := Create_Std_Literal (Name_Del, Character_Type_Definition); - if Flags.Vhdl_Std /= Vhdl_87 then + if Vhdl_Std /= Vhdl_87 then for I in Name_C128 .. Name_C159 loop El := Create_Std_Literal (I, Character_Type_Definition); end loop; @@ -724,7 +724,7 @@ package body Std_Package is Time_Hr_Unit: Iir_Unit_Declaration; Constraint : Iir_Range_Expression; begin - if Flags.Vhdl_Std >= Vhdl_93c then + if Vhdl_Std >= Vhdl_93c then Time_Staticness := Globally; else Time_Staticness := Locally; @@ -813,7 +813,7 @@ package body Std_Package is -- VHDL93 -- subtype DELAY_LENGTH is TIME range 0 to TIME'HIGH - if Flags.Vhdl_Std >= Vhdl_93c then + if Vhdl_Std >= Vhdl_93c then Delay_Length_Subtype_Definition := Create_Std_Iir (Iir_Kind_Physical_Subtype_Definition); Set_Type_Mark (Delay_Length_Subtype_Definition, @@ -855,12 +855,12 @@ package body Std_Package is Function_Now := Create_Std_Decl (Iir_Kind_Implicit_Function_Declaration); Set_Std_Identifier (Function_Now, Std_Names.Name_Now); - if Flags.Vhdl_Std = Vhdl_87 then + if Vhdl_Std = Vhdl_87 then Set_Return_Type (Function_Now, Time_Subtype_Definition); else Set_Return_Type (Function_Now, Delay_Length_Subtype_Definition); end if; - if Flags.Vhdl_Std = Vhdl_02 then + if Vhdl_Std = Vhdl_02 then Set_Pure_Flag (Function_Now, True); else Set_Pure_Flag (Function_Now, False); @@ -872,7 +872,7 @@ package body Std_Package is -- VHDL93: -- type file_open_kind is (read_mode, write_mode, append_mode); - if Flags.Vhdl_Std >= Vhdl_93c then + if Vhdl_Std >= Vhdl_93c then File_Open_Kind_Type_Definition := Create_Std_Iir (Iir_Kind_Enumeration_Type_Definition); Set_Base_Type (File_Open_Kind_Type_Definition, @@ -912,7 +912,7 @@ package body Std_Package is -- VHDL93: -- type file_open_status is -- (open_ok, status_error, name_error, mode_error); - if Flags.Vhdl_Std >= Vhdl_93c then + if Vhdl_Std >= Vhdl_93c then File_Open_Status_Type_Definition := Create_Std_Iir (Iir_Kind_Enumeration_Type_Definition); Set_Base_Type (File_Open_Status_Type_Definition, @@ -954,7 +954,7 @@ package body Std_Package is -- VHDL93: -- attribute FOREIGN: string; - if Flags.Vhdl_Std >= Vhdl_93c then + if Vhdl_Std >= Vhdl_93c then Foreign_Attribute := Create_Std_Decl (Iir_Kind_Attribute_Declaration); Set_Std_Identifier (Foreign_Attribute, Name_Foreign); Set_Type (Foreign_Attribute, String_Type_Definition); diff --git a/translate/Makefile b/translate/Makefile index 1fb63e5be..f33e6d52d 100644 --- a/translate/Makefile +++ b/translate/Makefile @@ -18,7 +18,7 @@ BE=gcc ortho_srcdir=../ortho -GNAT_FLAGS=-aI.. -gnaty3befhkmr -gnata -gnatf -gnatwa -gnatwe +GNAT_FLAGS=-aI.. -gnaty3befhkmr -gnata -gnatf -gnatwael #GNAT_FLAGS+=-O -gnatn LN=ln -s diff --git a/translate/gcc/dist-common.sh b/translate/gcc/dist-common.sh index 58c8ba5af..e3ccc9139 100644 --- a/translate/gcc/dist-common.sh +++ b/translate/gcc/dist-common.sh @@ -35,6 +35,8 @@ configuration.adb configuration.ads nodes.ads nodes.adb +options.ads +options.adb lists.ads lists.adb iirs.adb diff --git a/translate/ghdldrv/ghdldrv.adb b/translate/ghdldrv/ghdldrv.adb index 9de01b4ee..b21d63398 100644 --- a/translate/ghdldrv/ghdldrv.adb +++ b/translate/ghdldrv/ghdldrv.adb @@ -36,6 +36,7 @@ with System; with Ghdlmain; use Ghdlmain; with Ghdllocal; use Ghdllocal; with Version; +with Options; package body Ghdldrv is -- Name of the tools used. @@ -655,7 +656,7 @@ package body Ghdldrv is Add_Argument (Compiler_Args, new String'(Opt)); Flag_Expect_Failure := True; Res := Option_Ok; - elsif Flags.Parse_Option (Opt) then + elsif Options.Parse_Option (Opt) then Add_Argument (Compiler_Args, new String'(Opt)); Res := Option_Ok; elsif Opt'Length >= 2 diff --git a/translate/ghdldrv/ghdllocal.adb b/translate/ghdldrv/ghdllocal.adb index 6565f9dce..310dabbfb 100644 --- a/translate/ghdldrv/ghdllocal.adb +++ b/translate/ghdldrv/ghdllocal.adb @@ -33,6 +33,7 @@ with Configuration; with Files_Map; with Post_Sems; with Disp_Tree; +with Options; package body Ghdllocal is -- Version of the IEEE library to use. This just change pathes. @@ -137,7 +138,7 @@ package body Ghdllocal is -- Silently accept -g and -O. Res := Option_Ok; else - if Flags.Parse_Option (Opt) then + if Options.Parse_Option (Opt) then Res := Option_Ok; end if; end if; @@ -161,9 +162,11 @@ package body Ghdllocal is P (" none: do not use a predefined ieee library"); end Disp_Long_Help; - function Get_Version_Path return String is + function Get_Version_Path return String + is + use Flags; begin - case Flags.Vhdl_Std is + case Vhdl_Std is when Vhdl_87 => return "v87"; when Vhdl_93c diff --git a/translate/ghdldrv/ghdlmain.adb b/translate/ghdldrv/ghdlmain.adb index b77ceca01..7cbada3f8 100644 --- a/translate/ghdldrv/ghdlmain.adb +++ b/translate/ghdldrv/ghdlmain.adb @@ -18,8 +18,8 @@ with Ada.Text_IO; with Ada.Command_Line; with Version; -with Flags; with Bug; +with Options; package body Ghdlmain is procedure Init (Cmd : in out Command_Type) @@ -183,7 +183,7 @@ package body Ghdlmain is Error ("warning: command '--option-help' does not accept any argument"); end if; - Flags.Disp_Options_Help; + Options.Disp_Options_Help; end Perform_Action; -- Command Version diff --git a/translate/ghdldrv/ghdlprint.adb b/translate/ghdldrv/ghdlprint.adb index 3dc555044..7a9585402 100644 --- a/translate/ghdldrv/ghdlprint.adb +++ b/translate/ghdldrv/ghdlprint.adb @@ -75,6 +75,7 @@ package body Ghdlprint is procedure PP_Html_File (File : Source_File_Entry) is + use Flags; use Scan; use Tokens; use Files_Map; diff --git a/translate/ortho_front.adb b/translate/ortho_front.adb index aecc232bf..d69c9b1c4 100644 --- a/translate/ortho_front.adb +++ b/translate/ortho_front.adb @@ -31,6 +31,7 @@ with Canon; with Disp_Vhdl; with Bug; with Trans_Be; +with Options; package body Ortho_Front is -- The action to be performed by the compiler. @@ -197,18 +198,18 @@ package body Ortho_Front is end if; return 2; elsif Opt.all = "--help" then - Flags.Disp_Options_Help; + Options.Disp_Options_Help; return 1; elsif Opt.all = "--expect-failure" then Flag_Expect_Failure := True; return 1; elsif Opt'Length > 7 and then Opt (1 .. 7) = "--ghdl-" then - if Flags.Parse_Option (Opt (7 .. Opt'Last)) then + if Options.Parse_Option (Opt (7 .. Opt'Last)) then return 1; else return 0; end if; - elsif Flags.Parse_Option (Opt.all) then + elsif Options.Parse_Option (Opt.all) then return 1; else return 0; diff --git a/translate/translation.adb b/translate/translation.adb index d1d570f06..24fdc7696 100644 --- a/translate/translation.adb +++ b/translate/translation.adb @@ -21,7 +21,7 @@ with Interfaces; use Interfaces; with Ortho_Nodes; use Ortho_Nodes; with Ortho_Ident; use Ortho_Ident; with Evaluation; use Evaluation; -with Flags; +with Flags; use Flags; with Ada.Text_IO; with Types; use Types; with Errorout; use Errorout; @@ -20,10 +20,6 @@ with Interfaces; package Types is pragma Preelaborate (Types); - -- List of vhdl standards. - -- VHDL_93c is vhdl_93 with backward compatibility with 87 (file). - type Vhdl_Std_Type is (Vhdl_87, Vhdl_93c, Vhdl_93, Vhdl_00, Vhdl_02); - -- A tri state type. type Tri_State_Type is (Unknown, False, True); |