diff options
| -rw-r--r-- | src/errorout.adb | 68 | ||||
| -rw-r--r-- | src/errorout.ads | 5 | ||||
| -rw-r--r-- | src/ghdldrv/ghdlmain.adb | 4 | ||||
| -rw-r--r-- | src/ghdldrv/ghdlprint.adb | 2 | ||||
| -rw-r--r-- | src/libraries.adb | 2 | ||||
| -rw-r--r-- | src/psl/psl-errors.adb | 13 | ||||
| -rw-r--r-- | src/psl/psl-errors.ads | 2 | ||||
| -rw-r--r-- | src/synth/synth-errors.adb | 4 | ||||
| -rw-r--r-- | src/types.ads | 3 | ||||
| -rw-r--r-- | src/vhdl/simulate/simul-elaboration.adb | 4 | ||||
| -rw-r--r-- | src/vhdl/translate/trans-chap12.adb | 8 | ||||
| -rw-r--r-- | src/vhdl/vhdl-errors.adb | 21 | ||||
| -rw-r--r-- | src/vhdl/vhdl-errors.ads | 1 | ||||
| -rw-r--r-- | src/vhdl/vhdl-parse.adb | 8 | ||||
| -rw-r--r-- | src/vhdl/vhdl-parse_psl.adb | 10 | ||||
| -rw-r--r-- | src/vhdl/vhdl-scanner-directive_protect.adb | 2 | ||||
| -rw-r--r-- | src/vhdl/vhdl-scanner.adb | 73 | ||||
| -rw-r--r-- | src/vhdl/vhdl-scanner.ads | 3 | ||||
| -rw-r--r-- | src/vhdl/vhdl-sem_lib.adb | 2 | ||||
| -rw-r--r-- | src/vhdl/vhdl-sem_psl.adb | 1 | 
20 files changed, 116 insertions, 120 deletions
| diff --git a/src/errorout.adb b/src/errorout.adb index ac42a3d51..76a05dbd4 100644 --- a/src/errorout.adb +++ b/src/errorout.adb @@ -16,11 +16,9 @@  --  Software Foundation, 59 Temple Place - Suite 330, Boston, MA  --  02111-1307, USA. -with Vhdl.Scanner;  with Name_Table;  with Files_Map; use Files_Map;  with Flags; use Flags; -with PSL.Nodes;  with Str_Table;  with Vhdl.Errors; use Vhdl.Errors; @@ -127,21 +125,18 @@ package body Errorout is        return (Kind => Earg_String8, Val_Str8 => V);     end "+"; -   function "+" (L : PSL.Types.PSL_Node) return Location_Type +   function "+" (L : Location_Type) return Source_Coord_Type     is -      use PSL.Types; -      use PSL.Nodes; +      Res : Source_Coord_Type;     begin -      if L = Null_Node then -         return No_Location; -      else -         return PSL.Nodes.Get_Location (L); -      end if; +      Files_Map.Location_To_Coord +        (L, Res.File, Res.Line_Pos, Res.Line, Res.Offset); +      return Res;     end "+";     procedure Report_Msg (Id : Msgid_Type;                           Origin : Report_Origin; -                         Loc : Location_Type; +                         Loc : Source_Coord_Type;                           Msg : String;                           Args : Earg_Arr := No_Eargs;                           Cont : Boolean := False) @@ -159,13 +154,7 @@ package body Errorout is           Coord_To_Position (File, Line_Pos, Offset, Name, Col);        end Location_To_Position; -      File : Source_File_Entry; -      Line : Natural;        New_Id : Msgid_Type; -      Offset : Natural; -      Loc_Length : Natural; -      Line_Pos : Source_Ptr; -      pragma Unreferenced (Line_Pos);     begin        --  Discard warnings that aren't enabled.        if Id in Msgid_Warnings and then not Is_Warning_Enabled (Id) then @@ -190,45 +179,8 @@ package body Errorout is           end if;        end if; -      --  Set error location. -      File := No_Source_File_Entry; -      Line := 0; -      Offset := 0; -      Loc_Length := 0; - -      case Origin is -         when Option -           | Library => -            pragma Assert (Loc = No_Location); -            null; -         when others => -            if Loc /= No_Location then -               Location_To_Coord (Loc, File, Line_Pos, Line, Offset); -            else -               case Origin is -                  when Option -                    | Library => -                     raise Program_Error; -                  when Elaboration => -                     null; -                  when Scan => -                     File := Vhdl.Scanner.Get_Current_Source_File; -                     Line := Vhdl.Scanner.Get_Current_Line; -                     Offset := Vhdl.Scanner.Get_Current_Offset; -                     Loc_Length := 1; -                  when Parse => -                     File := Vhdl.Scanner.Get_Current_Source_File; -                     Line := Vhdl.Scanner.Get_Current_Line; -                     Offset := Vhdl.Scanner.Get_Token_Offset; -                     Loc_Length := Vhdl.Scanner.Get_Current_Offset - Offset; -                  when Semantic => -                     null; -               end case; -            end if; -      end case; -        Report_Handler.Error_Start -        (Err => (Origin, New_Id, Cont, File, Line, Offset, Loc_Length)); +        (Err => (Origin, New_Id, Cont, Loc.File, Loc.Line, Loc.Offset, 0));        --  Display message.        declare @@ -329,7 +281,7 @@ package body Errorout is                          --  Do not print the filename if in the same file as                          --  the error location. -                        if Arg_File = File then +                        if Arg_File = Loc.File then                             Report_Handler.Message ("line ");                          else                             Report_Handler.Message @@ -400,7 +352,7 @@ package body Errorout is     procedure Error_Msg_Option_NR (Msg: String) is     begin -      Report_Msg (Msgid_Error, Option, No_Location, Msg); +      Report_Msg (Msgid_Error, Option, No_Source_Coord, Msg);     end Error_Msg_Option_NR;     procedure Error_Msg_Option (Msg: String) is @@ -411,7 +363,7 @@ package body Errorout is     procedure Warning_Msg_Option (Id : Msgid_Warnings; Msg: String) is     begin -      Report_Msg (Id, Option, No_Location, Msg); +      Report_Msg (Id, Option, No_Source_Coord, Msg);     end Warning_Msg_Option;     function Make_Earg_Vhdl_Node (V : Iir) return Earg_Type is diff --git a/src/errorout.ads b/src/errorout.ads index 5c32c315a..b340ec569 100644 --- a/src/errorout.ads +++ b/src/errorout.ads @@ -18,7 +18,6 @@  with Types; use Types;  with Vhdl.Nodes; use Vhdl.Nodes;  with Vhdl.Tokens; -with PSL.Types;  package Errorout is     Option_Error: exception; @@ -164,7 +163,7 @@ package Errorout is     function "+" (V : String8_Len_Type) return Earg_Type;     --  Convert location. -   function "+" (L : PSL.Types.PSL_Node) return Location_Type; +   function "+" (L : Location_Type) return Source_Coord_Type;     --  Pass that detected the error.     type Report_Origin is @@ -205,7 +204,7 @@ package Errorout is     --  name is displayed.     procedure Report_Msg (Id : Msgid_Type;                           Origin : Report_Origin; -                         Loc : Location_Type; +                         Loc : Source_Coord_Type;                           Msg : String;                           Args : Earg_Arr := No_Eargs;                           Cont : Boolean := False); diff --git a/src/ghdldrv/ghdlmain.adb b/src/ghdldrv/ghdlmain.adb index 872d9848d..02e01cc1b 100644 --- a/src/ghdldrv/ghdlmain.adb +++ b/src/ghdldrv/ghdlmain.adb @@ -252,14 +252,14 @@ package body Ghdlmain is     is        use Errorout;     begin -      Report_Msg (Msgid_Error, Option, No_Location, Msg); +      Report_Msg (Msgid_Error, Option, No_Source_Coord, Msg);     end Error;     procedure Warning (Msg : String)     is        use Errorout;     begin -      Report_Msg (Msgid_Warning, Option, No_Location, Msg); +      Report_Msg (Msgid_Warning, Option, No_Source_Coord, Msg);     end Warning;     procedure Main diff --git a/src/ghdldrv/ghdlprint.adb b/src/ghdldrv/ghdlprint.adb index 3addfbfe3..2fab7d67e 100644 --- a/src/ghdldrv/ghdlprint.adb +++ b/src/ghdldrv/ghdlprint.adb @@ -1092,7 +1092,7 @@ package body Ghdlprint is              loop                 Scan;                 if Ref_Tokens.Table (Tok_Idx) /= Current_Token then -                  Report_Msg (Msgid_Error, Errorout.Parse, No_Location, +                  Report_Msg (Msgid_Error, Errorout.Parse, No_Source_Coord,                                "token mismatch");                    exit;                 end if; diff --git a/src/libraries.adb b/src/libraries.adb index 0540c709e..3ce5581f5 100644 --- a/src/libraries.adb +++ b/src/libraries.adb @@ -49,7 +49,7 @@ package body Libraries is     --  Report an error message.     procedure Error_Lib_Msg (Msg : String) is     begin -      Report_Msg (Msgid_Error, Library, No_Location, Msg); +      Report_Msg (Msgid_Error, Library, No_Source_Coord, Msg);     end Error_Lib_Msg;     --  Initialize paths table. diff --git a/src/psl/psl-errors.adb b/src/psl/psl-errors.adb index a71b18e86..a4bd0980c 100644 --- a/src/psl/psl-errors.adb +++ b/src/psl/psl-errors.adb @@ -20,6 +20,17 @@ with Errorout; use Errorout;  with PSL.Nodes;  package body PSL.Errors is +   function "+" (L : PSL_Node) return Location_Type +   is +      use PSL.Nodes; +   begin +      if L = Null_Node then +         return No_Location; +      else +         return PSL.Nodes.Get_Location (L); +      end if; +   end "+"; +     procedure Error_Kind (Msg : String; N : PSL_Node) is     begin        Log (Msg); @@ -30,6 +41,6 @@ package body PSL.Errors is     procedure Error_Msg_Sem (Msg: String; Loc : PSL_Node) is     begin -      Report_Msg (Msgid_Error, Semantic, +Loc, Msg, No_Eargs, False); +      Report_Msg (Msgid_Error, Semantic, +(+Loc), Msg, No_Eargs, False);     end Error_Msg_Sem;  end PSL.Errors; diff --git a/src/psl/psl-errors.ads b/src/psl/psl-errors.ads index bbc571624..f197a8928 100644 --- a/src/psl/psl-errors.ads +++ b/src/psl/psl-errors.ads @@ -20,6 +20,8 @@ with Files_Map;  with PSL.Types; use PSL.Types;  package PSL.Errors is +   function "+" (L : PSL.Types.PSL_Node) return Location_Type; +     function Image (Loc : Location_Type; Filename : Boolean := True)                    return String renames Files_Map.Image; diff --git a/src/synth/synth-errors.adb b/src/synth/synth-errors.adb index 4acfe560c..a8e4c04c7 100644 --- a/src/synth/synth-errors.adb +++ b/src/synth/synth-errors.adb @@ -24,13 +24,13 @@ package body Synth.Errors is                                Arg1 : Earg_Type) is     begin        Report_Msg (Msgid_Error, Errorout.Elaboration, -                  Loc, Msg, (1 => Arg1)); +                  +Loc, Msg, (1 => Arg1));     end Error_Msg_Synth;     procedure Error_Msg_Synth (Loc : Location_Type;                                Msg : String) is     begin        Report_Msg (Msgid_Error, Errorout.Elaboration, -                  Loc, Msg, (1 .. 0 => <>)); +                  +Loc, Msg, (1 .. 0 => <>));     end Error_Msg_Synth;  end Synth.Errors; diff --git a/src/types.ads b/src/types.ads index 1f650ce81..71b981647 100644 --- a/src/types.ads +++ b/src/types.ads @@ -130,6 +130,9 @@ package Types is        Offset : Natural;     end record; +   No_Source_Coord : constant Source_Coord_Type := +     (No_Source_File_Entry, Source_Ptr_Bad, 0, 0); +     --  Indentation.     --  This is used by all packages that display vhdl code or informations.     Indentation : constant := 2; diff --git a/src/vhdl/simulate/simul-elaboration.adb b/src/vhdl/simulate/simul-elaboration.adb index 996a36804..05ea592e2 100644 --- a/src/vhdl/simulate/simul-elaboration.adb +++ b/src/vhdl/simulate/simul-elaboration.adb @@ -396,7 +396,7 @@ package body Simul.Elaboration is          Create_Instance_Value (Instance);        if Trace_Elaboration then -         Report_Msg (Msgid_Note, Errorout.Elaboration, No_Location, +         Report_Msg (Msgid_Note, Errorout.Elaboration, No_Source_Coord,                       "elaborating %n", (1 => +Decl));        end if; @@ -447,7 +447,7 @@ package body Simul.Elaboration is          Block.Objects (Package_Info.Pkg_Slot).Instance;     begin        if Trace_Elaboration then -         Report_Msg (Msgid_Note, Errorout.Elaboration, No_Location, +         Report_Msg (Msgid_Note, Errorout.Elaboration, No_Source_Coord,                       "elaborating %n", (1 => +Decl));        end if; diff --git a/src/vhdl/translate/trans-chap12.adb b/src/vhdl/translate/trans-chap12.adb index 469de7cf6..9fda541a8 100644 --- a/src/vhdl/translate/trans-chap12.adb +++ b/src/vhdl/translate/trans-chap12.adb @@ -564,12 +564,12 @@ package body Trans.Chap12 is        end if;        if Flags.Verbose then -         Report_Msg (Msgid_Note, Elaboration, No_Location, +         Report_Msg (Msgid_Note, Elaboration, No_Source_Coord,                       "List of units in the hierarchy design:");           for I in Design_Units.First .. Design_Units.Last loop              Unit := Design_Units.Table (I);              Lib_Unit := Get_Library_Unit (Unit); -            Report_Msg (Msgid_Note, Elaboration, No_Location, +            Report_Msg (Msgid_Note, Elaboration, No_Source_Coord,                          " %n", (1 => +Lib_Unit));           end loop;        end if; @@ -689,12 +689,12 @@ package body Trans.Chap12 is        --  Disp list of files needed.        if Flags.Verbose then -         Report_Msg (Msgid_Note, Elaboration, No_Location, +         Report_Msg (Msgid_Note, Elaboration, No_Source_Coord,                       "List of units not used:");           for I in Last_Design_Unit + 1 .. Design_Units.Last loop              Unit := Design_Units.Table (I);              Lib_Unit := Get_Library_Unit (Unit); -            Report_Msg (Msgid_Note, Elaboration, No_Location, +            Report_Msg (Msgid_Note, Elaboration, No_Source_Coord,                          " %n", (1 => +Lib_Unit));           end loop;        end if; diff --git a/src/vhdl/vhdl-errors.adb b/src/vhdl/vhdl-errors.adb index d6a8afd66..5cc54da90 100644 --- a/src/vhdl/vhdl-errors.adb +++ b/src/vhdl/vhdl-errors.adb @@ -51,7 +51,12 @@ package body Vhdl.Errors is     function "+" (L : Iir) return Location_Type renames Get_Location_Safe; -      procedure Warning_Msg_Sem (Id : Msgid_Warnings; +   function "+" (L : Iir) return Source_Coord_Type is +   begin +      return +Get_Location_Safe (L); +   end "+"; + +   procedure Warning_Msg_Sem (Id : Msgid_Warnings;                                Loc : Location_Type;                                Msg: String;                                Args : Earg_Arr := No_Eargs; @@ -60,7 +65,7 @@ package body Vhdl.Errors is        if Flags.Flag_Only_Elab_Warnings then           return;        end if; -      Report_Msg (Id, Semantic, Loc, Msg, Args, Cont); +      Report_Msg (Id, Semantic, +Loc, Msg, Args, Cont);     end Warning_Msg_Sem;     procedure Warning_Msg_Sem (Id : Msgid_Warnings; @@ -92,9 +97,9 @@ package body Vhdl.Errors is     -- Disp a message during semantic analysis.     -- LOC is used for location and current token. -   procedure Error_Msg_Sem (Msg: String; Loc: in Iir) is +   procedure Error_Msg_Sem (Msg: String; Loc: Iir) is     begin -      Report_Msg (Msgid_Error, Semantic, Get_Location_Safe (Loc), Msg); +      Report_Msg (Msgid_Error, Semantic, +Get_Location_Safe (Loc), Msg);     end Error_Msg_Sem;     procedure Error_Msg_Sem (Loc: Location_Type; @@ -102,13 +107,13 @@ package body Vhdl.Errors is                              Args : Earg_Arr := No_Eargs;                              Cont : Boolean := False) is     begin -      Report_Msg (Msgid_Error, Semantic, Loc, Msg, Args, Cont); +      Report_Msg (Msgid_Error, Semantic, +Loc, Msg, Args, Cont);     end Error_Msg_Sem;     procedure Error_Msg_Sem       (Loc: Location_Type; Msg: String; Arg1 : Earg_Type) is     begin -      Report_Msg (Msgid_Error, Semantic, Loc, Msg, (1 => Arg1)); +      Report_Msg (Msgid_Error, Semantic, +Loc, Msg, (1 => Arg1));     end Error_Msg_Sem;     procedure Error_Msg_Relaxed (Origin : Report_Origin; @@ -127,7 +132,7 @@ package body Vhdl.Errors is        else           Level := Msgid_Error;        end if; -      Report_Msg (Level, Origin, Get_Location_Safe (Loc), Msg, Args); +      Report_Msg (Level, Origin, +Loc, Msg, Args);     end Error_Msg_Relaxed;     procedure Error_Msg_Sem_Relaxed (Loc : Iir; @@ -142,7 +147,7 @@ package body Vhdl.Errors is     procedure Error_Msg_Elab       (Msg: String; Args : Earg_Arr := No_Eargs) is     begin -      Report_Msg (Msgid_Error, Elaboration, No_Location, Msg, Args); +      Report_Msg (Msgid_Error, Elaboration, No_Source_Coord, Msg, Args);     end Error_Msg_Elab;     procedure Error_Msg_Elab diff --git a/src/vhdl/vhdl-errors.ads b/src/vhdl/vhdl-errors.ads index b1b42c10c..73bf72c01 100644 --- a/src/vhdl/vhdl-errors.ads +++ b/src/vhdl/vhdl-errors.ads @@ -34,6 +34,7 @@ package Vhdl.Errors is     --  Convert location.     function "+" (L : Iir) return Location_Type; +   function "+" (L : Iir) return Source_Coord_Type;        -- Disp a message during semantic analysis.     procedure Warning_Msg_Sem (Id : Msgid_Warnings; diff --git a/src/vhdl/vhdl-parse.adb b/src/vhdl/vhdl-parse.adb index 4050a4b25..9b7be9091 100644 --- a/src/vhdl/vhdl-parse.adb +++ b/src/vhdl/vhdl-parse.adb @@ -89,13 +89,15 @@ package body Vhdl.Parse is     -- the message.     procedure Error_Msg_Parse (Msg: String; Arg1 : Earg_Type) is     begin -      Report_Msg (Msgid_Error, Errorout.Parse, No_Location, Msg, (1 => Arg1)); +      Report_Msg (Msgid_Error, Errorout.Parse, Get_Token_Coord, +                  Msg, (1 => Arg1));     end Error_Msg_Parse;     procedure Error_Msg_Parse       (Msg: String; Args : Earg_Arr := No_Eargs; Cont : Boolean := False) is     begin -      Report_Msg (Msgid_Error, Errorout.Parse, No_Location, Msg, Args, Cont); +      Report_Msg (Msgid_Error, Errorout.Parse, Get_Token_Coord, +                  Msg, Args, Cont);     end Error_Msg_Parse;     procedure Error_Msg_Parse (Loc : Location_Type; @@ -103,7 +105,7 @@ package body Vhdl.Parse is                                Args : Earg_Arr := No_Eargs;                                Cont : Boolean := False) is     begin -      Report_Msg (Msgid_Error, Errorout.Parse, Loc, Msg, Args, Cont); +      Report_Msg (Msgid_Error, Errorout.Parse, +Loc, Msg, Args, Cont);     end Error_Msg_Parse;     procedure Unexpected (Where: String) is diff --git a/src/vhdl/vhdl-parse_psl.adb b/src/vhdl/vhdl-parse_psl.adb index aff5967c2..13b3a2d02 100644 --- a/src/vhdl/vhdl-parse_psl.adb +++ b/src/vhdl/vhdl-parse_psl.adb @@ -30,16 +30,17 @@ package body Vhdl.Parse_Psl is     procedure Error_Msg_Parse (Msg: String) is     begin -      Report_Msg (Msgid_Error, Errorout.Parse, No_Location, Msg); +      Report_Msg (Msgid_Error, Errorout.Parse, Get_Token_Coord, Msg);     end Error_Msg_Parse;     procedure Error_Msg_Parse       (Loc : Location_Type; Msg: String; Args : Earg_Arr := No_Eargs) is     begin -      Report_Msg (Msgid_Error, Errorout.Parse, Loc, Msg, Args); +      Report_Msg (Msgid_Error, Errorout.Parse, +Loc, Msg, Args);     end Error_Msg_Parse; -   function Create_Node_Loc (K : Nkind) return Node is +   function Create_Node_Loc (K : Nkind) return Node +   is        Res : Node;     begin        Res := PSL.Nodes.Create_Node (K); @@ -47,7 +48,8 @@ package body Vhdl.Parse_Psl is        return Res;     end Create_Node_Loc; -   function Parse_Number return Node is +   function Parse_Number return Node +   is        Res : Node;     begin        if Current_Token = Tok_Integer then diff --git a/src/vhdl/vhdl-scanner-directive_protect.adb b/src/vhdl/vhdl-scanner-directive_protect.adb index bad3bd6ce..116326a30 100644 --- a/src/vhdl/vhdl-scanner-directive_protect.adb +++ b/src/vhdl/vhdl-scanner-directive_protect.adb @@ -32,7 +32,7 @@ package body Directive_Protect is        Scan_Identifier (False);        if Current_Token /= Tok_Identifier then -         Error_Msg_Scan (Get_Token_Location, "keyword must be an identifier"); +         Error_Msg_Scan (+Get_Token_Location, "keyword must be an identifier");           return False;        end if; diff --git a/src/vhdl/vhdl-scanner.adb b/src/vhdl/vhdl-scanner.adb index 5c787d756..ec0580f2d 100644 --- a/src/vhdl/vhdl-scanner.adb +++ b/src/vhdl/vhdl-scanner.adb @@ -163,28 +163,64 @@ package body Vhdl.Scanner is     end record;     pragma Suppress_Initialization (Scan_Context); +   -- The current context. +   -- Default value is an invalid context. +   Current_Context: Scan_Context := (Source => null, +                                     Source_File => No_Source_File_Entry, +                                     Line_Number => 0, +                                     Line_Pos => 0, +                                     Pos => 0, +                                     Prev_Pos => 0, +                                     Token_Pos => 0, +                                     File_Len => 0, +                                     Token => Tok_Invalid, +                                     Prev_Token => Tok_Invalid, +                                     Identifier => Null_Identifier, +                                     Bit_Str_Base => ' ', +                                     Bit_Str_Sign => ' ', +                                     Str_Id => Null_String8, +                                     Str_Len => 0, +                                     Lit_Int64 => 0, +                                     Lit_Fp64 => 0.0); + +   function Get_Current_Coord return Source_Coord_Type is +   begin +      return (File => Get_Current_Source_File, +              Line_Pos => Current_Context.Line_Pos, +              Line => Get_Current_Line, +              Offset => Get_Current_Offset); +   end Get_Current_Coord; + +   function Get_Token_Coord return Source_Coord_Type is +   begin +      return (File => Get_Current_Source_File, +              Line_Pos => Current_Context.Line_Pos, +              Line => Get_Current_Line, +              Offset => Get_Token_Offset); +   end Get_Token_Coord; +     -- Disp a message during scan.     -- The current location is automatically displayed before the message.     -- Disp a message during scan.     procedure Error_Msg_Scan (Msg: String) is     begin -      Report_Msg (Msgid_Error, Scan, No_Location, Msg); +      Report_Msg (Msgid_Error, Scan, Get_Current_Coord, Msg);     end Error_Msg_Scan; -   procedure Error_Msg_Scan (Loc : Location_Type; Msg: String) is +   procedure Error_Msg_Scan (Loc : Source_Coord_Type; Msg: String) is     begin        Report_Msg (Msgid_Error, Scan, Loc, Msg);     end Error_Msg_Scan;     procedure Error_Msg_Scan (Msg: String; Arg1 : Earg_Type) is     begin -      Report_Msg (Msgid_Error, Scan, No_Location, Msg, (1 => Arg1)); +      Report_Msg (Msgid_Error, Scan, Get_Current_Coord, Msg, (1 => Arg1));     end Error_Msg_Scan;     -- Disp a message during scan.     procedure Warning_Msg_Scan (Id : Msgid_Warnings; Msg: String) is     begin -      Report_Msg (Id, Scan, No_Location, Msg); +      Report_Msg (Id, Scan, Get_Current_Coord, Msg);     end Warning_Msg_Scan;     procedure Warning_Msg_Scan (Id : Msgid_Warnings; @@ -192,28 +228,9 @@ package body Vhdl.Scanner is                                 Arg1 : Earg_Type;                                 Cont : Boolean := False) is     begin -      Report_Msg (Id, Scan, No_Location, Msg, (1 => Arg1), Cont); +      Report_Msg (Id, Scan, Get_Current_Coord, Msg, (1 => Arg1), Cont);     end Warning_Msg_Scan; -   -- The current context. -   -- Default value is an invalid context. -   Current_Context: Scan_Context := (Source => null, -                                     Source_File => No_Source_File_Entry, -                                     Line_Number => 0, -                                     Line_Pos => 0, -                                     Pos => 0, -                                     Prev_Pos => 0, -                                     Token_Pos => 0, -                                     File_Len => 0, -                                     Token => Tok_Invalid, -                                     Prev_Token => Tok_Invalid, -                                     Identifier => Null_Identifier, -                                     Bit_Str_Base => ' ', -                                     Bit_Str_Sign => ' ', -                                     Str_Id => Null_String8, -                                     Str_Len => 0, -                                     Lit_Int64 => 0, -                                     Lit_Fp64 => 0.0);     Source: File_Buffer_Acc renames Current_Context.Source;     Pos: Source_Ptr renames Current_Context.Pos; @@ -477,7 +494,7 @@ package body Vhdl.Scanner is                    --  as the remainder operator, instead of 'rem'.  This will                    --  improve the error message.                    Error_Msg_Scan -                    (Get_Token_Location, +                    (+Get_Token_Location,                       "'%%' is not a vhdl operator, use 'rem'");                    Current_Token := Tok_Rem;                    Pos := Current_Context.Token_Pos + 1; @@ -624,7 +641,7 @@ package body Vhdl.Scanner is                 else                    if Mark = '%' then                       Error_Msg_Scan -                       (File_Pos_To_Location +                       (+File_Pos_To_Location                            (Current_Context.Source_File, Orig_Pos),                          "'%%' is not a vhdl operator, use 'rem'");                       Current_Token := Tok_Rem; @@ -1894,7 +1911,7 @@ package body Vhdl.Scanner is                          if Pos >= Current_Context.File_Len then                             --  Point at the start of the comment.                             Error_Msg_Scan -                             (Get_Token_Location, +                             (+Get_Token_Location,                                "block comment not terminated at end of file");                             exit;                          end if; @@ -1952,7 +1969,7 @@ package body Vhdl.Scanner is                 if Source (Pos + 1) = '=' then                    --  != is not allowed in VHDL, but be friendly with C users.                    Error_Msg_Scan -                    (Get_Token_Location, "Use '/=' for inequality in vhdl"); +                    (+Get_Token_Location, "Use '/=' for inequality in vhdl");                    Current_Token := Tok_Not_Equal;                    Pos := Pos + 1;                 else diff --git a/src/vhdl/vhdl-scanner.ads b/src/vhdl/vhdl-scanner.ads index 64f54bb3b..63d359e97 100644 --- a/src/vhdl/vhdl-scanner.ads +++ b/src/vhdl/vhdl-scanner.ads @@ -123,6 +123,9 @@ package Vhdl.Scanner is     function Get_Token_Offset return Natural;     function Get_Token_Position return Source_Ptr; +   function Get_Current_Coord return Source_Coord_Type; +   function Get_Token_Coord return Source_Coord_Type; +     --  Return the initial location before the current token (ie before all     --  the blanks, comments and newlines have been skipped).  Useful for the     --  location of a missing token. diff --git a/src/vhdl/vhdl-sem_lib.adb b/src/vhdl/vhdl-sem_lib.adb index fcbb9bd1e..e3ff86ed8 100644 --- a/src/vhdl/vhdl-sem_lib.adb +++ b/src/vhdl/vhdl-sem_lib.adb @@ -34,7 +34,7 @@ with Vhdl.Nodes_GC;  package body Vhdl.Sem_Lib is     procedure Error_Lib_Msg (Msg : String; Arg1 : Earg_Type) is     begin -      Report_Msg (Msgid_Error, Library, No_Location, Msg, (1 => Arg1)); +      Report_Msg (Msgid_Error, Library, No_Source_Coord, Msg, (1 => Arg1));     end Error_Lib_Msg;     function Load_File (File : Source_File_Entry) return Iir_Design_File diff --git a/src/vhdl/vhdl-sem_psl.adb b/src/vhdl/vhdl-sem_psl.adb index d6ead5002..57f8695d3 100644 --- a/src/vhdl/vhdl-sem_psl.adb +++ b/src/vhdl/vhdl-sem_psl.adb @@ -32,7 +32,6 @@ with Vhdl.Utils; use Vhdl.Utils;  with Vhdl.Evaluation; use Vhdl.Evaluation;  with Vhdl.Std_Package;  with Vhdl.Ieee.Std_Logic_1164; -with Errorout; use Errorout;  with Vhdl.Errors; use Vhdl.Errors;  with Vhdl.Xrefs; use Vhdl.Xrefs; | 
