Commit 5164151f by Vincent Celier Committed by Arnaud Charlet

errout.adb (Write_Error_Summary): Do not output the number of lines when…

errout.adb (Write_Error_Summary): Do not output the number of lines when Main_Source_File is unknown.

2013-10-14  Vincent Celier  <celier@adacore.com>

	* errout.adb (Write_Error_Summary): Do not output the number
	of lines when Main_Source_File is unknown.
	(Output_Messages): Do not write the header when Main_Source_File is
	unknown.

2013-10-14  Vincent Celier  <celier@adacore.com>

	* prep.adb (Expression): Accept terms of the form 'symbol <relop>
	integer", where relop is =, <, <=, > or >=.
	(Parse_Def_File): Accept literal integer values.
	* gcc-interface/Make-lang.in: Add s-valint.o, s-valuns.o and
	s-valuti.o to the compiler object files.

From-SVN: r203540
parent 0247964d
2013-10-14 Vincent Celier <celier@adacore.com>
* errout.adb (Write_Error_Summary): Do not output the number
of lines when Main_Source_File is unknown.
(Output_Messages): Do not write the header when Main_Source_File is
unknown.
2013-10-14 Vincent Celier <celier@adacore.com>
* prep.adb (Expression): Accept terms of the form 'symbol <relop>
integer", where relop is =, <, <=, > or >=.
(Parse_Def_File): Accept literal integer values.
* gcc-interface/Make-lang.in: Add s-valint.o, s-valuns.o and
s-valuti.o to the compiler object files.
2013-10-14 Robert Dewar <dewar@adacore.com>
* exp_prag.adb, exp_ch11.adb, s-exctab.adb: Minor reformatting.
......
......@@ -1625,15 +1625,18 @@ package body Errout is
Set_Standard_Error;
end if;
-- Message giving total number of lines
-- Message giving total number of lines, only when Main_Source_Line
-- is known.
Write_Str (" ");
Write_Int (Num_Source_Lines (Main_Source_File));
if Main_Source_File /= No_Source_File then
Write_Str (" ");
Write_Int (Num_Source_Lines (Main_Source_File));
if Num_Source_Lines (Main_Source_File) = 1 then
Write_Str (" line: ");
else
Write_Str (" lines: ");
if Num_Source_Lines (Main_Source_File) = 1 then
Write_Str (" line: ");
else
Write_Str (" lines: ");
end if;
end if;
if Total_Errors_Detected = 0 then
......@@ -1831,8 +1834,13 @@ package body Errout is
begin
Write_Eol;
Write_Header (Sfile);
Write_Eol;
-- Only write the header if Sfile is known
if Sfile /= No_Source_File then
Write_Header (Sfile);
Write_Eol;
end if;
-- Normally, we don't want an "error messages from file"
-- message when listing the entire file, so we set the
......@@ -1847,28 +1855,33 @@ package body Errout is
Current_Error_Source_File := Sfile;
end if;
for N in 1 .. Last_Source_Line (Sfile) loop
while E /= No_Error_Msg
and then Errors.Table (E).Deleted
loop
E := Errors.Table (E).Next;
end loop;
-- Only output the listing if Sfile is known, to avoid
-- crashing the compiler.
Err_Flag :=
E /= No_Error_Msg
and then Errors.Table (E).Line = N
and then Errors.Table (E).Sfile = Sfile;
if Sfile /= No_Source_File then
for N in 1 .. Last_Source_Line (Sfile) loop
while E /= No_Error_Msg
and then Errors.Table (E).Deleted
loop
E := Errors.Table (E).Next;
end loop;
Output_Source_Line (N, Sfile, Err_Flag);
Err_Flag :=
E /= No_Error_Msg
and then Errors.Table (E).Line = N
and then Errors.Table (E).Sfile = Sfile;
if Err_Flag then
Output_Error_Msgs (E);
Output_Source_Line (N, Sfile, Err_Flag);
if not Debug_Flag_2 then
Write_Eol;
if Err_Flag then
Output_Error_Msgs (E);
if not Debug_Flag_2 then
Write_Eol;
end if;
end if;
end if;
end loop;
end loop;
end if;
end;
end if;
end loop;
......@@ -1917,7 +1930,13 @@ package body Errout is
and then (not Full_List or else Full_List_File_Name /= null)
then
Write_Eol;
Write_Header (Main_Source_File);
-- Output the header only when Main_Source_File is known
if Main_Source_File /= No_Source_File then
Write_Header (Main_Source_File);
end if;
E := First_Error_Msg;
-- Loop through error lines
......
......@@ -371,6 +371,9 @@ GNAT_ADA_OBJS = \
ada/s-traent.o \
ada/s-unstyp.o \
ada/s-utf_32.o \
ada/s-valint.o \
ada/s-valuns.o \
ada/s-valuti.o \
ada/s-wchcnv.o \
ada/s-wchcon.o \
ada/s-wchjis.o \
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2002-2012, Free Software Foundation, Inc. --
-- Copyright (C) 2002-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -33,6 +33,7 @@ with Snames; use Snames;
with Sinput;
with Stringt; use Stringt;
with Table;
with Uintp; use Uintp;
with GNAT.Heap_Sort_G;
......@@ -268,9 +269,14 @@ package body Prep is
-- Check the syntax of the value
if Definition (Index + 1) /= '"'
or else Definition (Definition'Last) /= '"'
if Definition (Index + 1) = '"'
and then Definition (Definition'Last) = '"'
then
Result.Is_A_String := True;
else
Result.Is_A_String := False;
for J in Index + 1 .. Definition'Last loop
case Definition (J) is
when '_' | '.' | '0' .. '9' | 'a' .. 'z' | 'A' .. 'Z' =>
......@@ -286,7 +292,6 @@ package body Prep is
-- And put the value in the result
Result.Is_A_String := False;
Start_String;
Store_String_Chars (Definition (Index + 1 .. Definition'Last));
Result.Value := End_String;
......@@ -390,6 +395,8 @@ package body Prep is
Symbol_Value1 : String_Id;
Symbol_Value2 : String_Id;
Relop : Token_Type;
begin
-- Loop for each term
......@@ -447,12 +454,96 @@ package body Prep is
Current_Result := Index_Of (Symbol_Name1) /= No_Symbol;
end if;
elsif Token = Tok_Equal then
elsif
Token = Tok_Equal or else
Token = Tok_Less or else
Token = Tok_Less_Equal or else
Token = Tok_Greater or else
Token = Tok_Greater_Equal
then
Relop := Token;
Scan.all;
Change_Reserved_Keyword_To_Symbol;
if Token = Tok_Identifier then
if Token = Tok_Integer_Literal then
-- symbol = integer
-- symbol < integer
-- symbol <= integer
-- symbol > integer
-- symbol >= integer
declare
Value : constant Int := UI_To_Int (Int_Literal_Value);
Data : Symbol_Data;
Symbol_Value : Int;
begin
if Evaluation then
Symbol1 := Index_Of (Symbol_Name1);
if Symbol1 = No_Symbol then
Error_Msg_Name_1 := Symbol_Name1;
Error_Msg ("unknown symbol %", Symbol_Pos1);
Symbol_Value1 := No_String;
else
Data := Mapping.Table (Symbol1);
if Data.Is_A_String then
Error_Msg_Name_1 := Symbol_Name1;
Error_Msg
("symbol % value is not integer",
Symbol_Pos1);
else
begin
String_To_Name_Buffer (Data.Value);
Symbol_Value :=
Int'Value (Name_Buffer (1 .. Name_Len));
case Relop is
when Tok_Equal =>
Current_Result :=
Symbol_Value = Value;
when Tok_Less =>
Current_Result :=
Symbol_Value < Value;
when Tok_Less_Equal =>
Current_Result :=
Symbol_Value <= Value;
when Tok_Greater =>
Current_Result :=
Symbol_Value > Value;
when Tok_Greater_Equal =>
Current_Result :=
Symbol_Value >= Value;
when others =>
null;
end case;
exception
when Constraint_Error =>
Error_Msg_Name_1 := Symbol_Name1;
Error_Msg
("symbol % value is not integer",
Symbol_Pos1);
end;
end if;
end if;
end if;
Scan.all;
end;
elsif Relop /= Tok_Equal then
Error_Msg ("number expected", Token_Ptr);
elsif Token = Tok_Identifier then
-- symbol = symbol
......@@ -535,7 +626,8 @@ package body Prep is
else
Error_Msg
("symbol or literal string expected", Token_Ptr);
("literal integer, symbol or literal string expected",
Token_Ptr);
end if;
else
......@@ -914,7 +1006,33 @@ package body Prep is
Scan.all;
if Token = Tok_String_Literal then
if Token = Tok_Integer_Literal then
declare
Ptr : Source_Ptr := Token_Ptr;
begin
Start_String;
while Ptr < Scan_Ptr loop
Store_String_Char (Sinput.Source (Ptr));
Ptr := Ptr + 1;
end loop;
Data := (Symbol => Symbol_Name,
Original => Original_Name,
On_The_Command_Line => False,
Is_A_String => False,
Value => End_String);
end;
Scan.all;
if Token /= Tok_End_Of_Line and then Token /= Tok_EOF then
Error_Msg ("extraneous text in definition", Token_Ptr);
goto Cleanup;
end if;
elsif Token = Tok_String_Literal then
Data := (Symbol => Symbol_Name,
Original => Original_Name,
On_The_Command_Line => False,
......@@ -1088,8 +1206,7 @@ package body Prep is
begin
Start_Of_Processing := Scan_Ptr;
-- We need to call Scan for the first time, because Initialize_Scanner
-- is no longer doing it.
-- First a call to Scan, because Initialize_Scanner is not doing it
Scan.all;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment