Commit 84157c9a by Robert Dewar Committed by Arnaud Charlet

a-calend.adb: Minor code reorganization (use conditional expressions)

2009-07-07  Robert Dewar  <dewar@adacore.com>

	* a-calend.adb: Minor code reorganization (use conditional expressions)

	* s-stusta.ads, s-interr-hwint.adb, g-expect-vms.adb, s-secsta.ads,
	prj-nmsc.adb, a-teioed.adb, output.ads, prj-attr.ads, a-textio.adb,
	s-taskin.ads, scans.ads, s-osinte-vms.adb, s-taprop-solaris.adb,
	s-tpopsp-posix-foreign.adb, s-trafor-default.adb, gnat1drv.adb,
	s-stchop-vxworks.adb, s-tpopsp-posix.adb, prj-env.adb, prj-env.ads,
	g-comlin.adb, exp_ch11.adb: Minor reformatting.

From-SVN: r149320
parent 535536b4
2009-07-07 Robert Dewar <dewar@adacore.com>
* a-calend.adb: Minor code reorganization (use conditional expressions)
* s-stusta.ads, s-interr-hwint.adb, g-expect-vms.adb, s-secsta.ads,
prj-nmsc.adb, a-teioed.adb, output.ads, prj-attr.ads, a-textio.adb,
s-taskin.ads, scans.ads, s-osinte-vms.adb, s-taprop-solaris.adb,
s-tpopsp-posix-foreign.adb, s-trafor-default.adb, gnat1drv.adb,
s-stchop-vxworks.adb, s-tpopsp-posix.adb, prj-env.adb, prj-env.ads,
g-comlin.adb, exp_ch11.adb: Minor reformatting.
2009-07-07 Gary Dismukes <dismukes@adacore.com> 2009-07-07 Gary Dismukes <dismukes@adacore.com>
* checks.adb (Generate_Range_Check): Replace type conversions with * checks.adb (Generate_Range_Check): Replace type conversions with
......
...@@ -940,11 +940,7 @@ package body Ada.Calendar is ...@@ -940,11 +940,7 @@ package body Ada.Calendar is
-- Step 3: Handle leap second occurrences -- Step 3: Handle leap second occurrences
if Leap_Sec then tm_sec := (if Leap_Sec then 60 else Second);
tm_sec := 60;
else
tm_sec := Second;
end if;
end To_Struct_Tm; end To_Struct_Tm;
------------------ ------------------
...@@ -1014,11 +1010,8 @@ package body Ada.Calendar is ...@@ -1014,11 +1010,8 @@ package body Ada.Calendar is
-- the input. Guard against very large delay values such as the end -- the input. Guard against very large delay values such as the end
-- of time since the computation will overflow. -- of time since the computation will overflow.
if Res_N > Safe_Ada_High then Res_N := (if Res_N > Safe_Ada_High then Safe_Ada_High
Res_N := Safe_Ada_High; else Res_N + Epoch_Offset);
else
Res_N := Res_N + Epoch_Offset;
end if;
return Time_Rep_To_Duration (Res_N); return Time_Rep_To_Duration (Res_N);
end To_Duration; end To_Duration;
...@@ -1495,7 +1488,7 @@ package body Ada.Calendar is ...@@ -1495,7 +1488,7 @@ package body Ada.Calendar is
--------------------- ---------------------
function UTC_Time_Offset (Date : Time) return Long_Integer is function UTC_Time_Offset (Date : Time) return Long_Integer is
Adj_Cent : Integer := 0; Adj_Cent : Integer;
Date_N : Time_Rep; Date_N : Time_Rep;
Offset : aliased long; Offset : aliased long;
Secs_T : aliased time_t; Secs_T : aliased time_t;
...@@ -1507,18 +1500,11 @@ package body Ada.Calendar is ...@@ -1507,18 +1500,11 @@ package body Ada.Calendar is
-- saving and so on. Non-leap centennial years violate this rule by -- saving and so on. Non-leap centennial years violate this rule by
-- one day and as a consequence, special adjustment is needed. -- one day and as a consequence, special adjustment is needed.
if Date_N > T_2100_2_28 then Adj_Cent :=
if Date_N > T_2200_2_28 then (if Date_N <= T_2100_2_28 then 0
if Date_N > T_2300_2_28 then elsif Date_N <= T_2200_2_28 then 1
Adj_Cent := 3; elsif Date_N <= T_2300_2_28 then 2
else else 3);
Adj_Cent := 2;
end if;
else
Adj_Cent := 1;
end if;
end if;
if Adj_Cent > 0 then if Adj_Cent > 0 then
Date_N := Date_N - Time_Rep (Adj_Cent) * Nanos_In_Day; Date_N := Date_N - Time_Rep (Adj_Cent) * Nanos_In_Day;
......
...@@ -306,14 +306,12 @@ package body Ada.Text_IO.Editing is ...@@ -306,14 +306,12 @@ package body Ada.Text_IO.Editing is
raise Ada.Text_IO.Layout_Error; raise Ada.Text_IO.Layout_Error;
end if; end if;
if Pic.Radix_Position = Invalid_Position then Position :=
Position := Answer'Last; (if Pic.Radix_Position = Invalid_Position
else then Answer'Last
Position := Pic.Radix_Position - 1; else Pic.Radix_Position - 1);
end if;
for J in reverse Attrs.Start_Of_Int .. Attrs.End_Of_Int loop for J in reverse Attrs.Start_Of_Int .. Attrs.End_Of_Int loop
while Answer (Position) /= '9' while Answer (Position) /= '9'
and Answer (Position) /= Pic.Floater and Answer (Position) /= Pic.Floater
loop loop
...@@ -562,7 +560,6 @@ package body Ada.Text_IO.Editing is ...@@ -562,7 +560,6 @@ package body Ada.Text_IO.Editing is
Last := Pic.Radix_Position + 1; Last := Pic.Radix_Position + 1;
for J in Last .. Answer'Last loop for J in Last .. Answer'Last loop
if Answer (J) = '9' or Answer (J) = Pic.Floater then if Answer (J) = '9' or Answer (J) = Pic.Floater then
Answer (J) := Rounded (Position); Answer (J) := Rounded (Position);
...@@ -624,15 +621,13 @@ package body Ada.Text_IO.Editing is ...@@ -624,15 +621,13 @@ package body Ada.Text_IO.Editing is
-- No trailing digits, but now J may need to stick in a currency -- No trailing digits, but now J may need to stick in a currency
-- symbol or sign. -- symbol or sign.
if Pic.Start_Currency = Invalid_Position then Position :=
Position := Answer'Last + 1; (if Pic.Start_Currency = Invalid_Position
else then Answer'Last + 1
Position := Pic.Start_Currency; else Pic.Start_Currency);
end if;
end if; end if;
for J in Position .. Answer'Last loop for J in Position .. Answer'Last loop
if Pic.Start_Currency /= Invalid_Position and then if Pic.Start_Currency /= Invalid_Position and then
Answer (Pic.Start_Currency) = '#' then Answer (Pic.Start_Currency) = '#' then
Currency_Pos := 1; Currency_Pos := 1;
......
...@@ -562,13 +562,10 @@ package body Ada.Text_IO is ...@@ -562,13 +562,10 @@ package body Ada.Text_IO is
if ch = EOF then if ch = EOF then
raise End_Error; raise End_Error;
else else
if not Is_Start_Of_Encoding Item :=
(Character'Val (ch), File.WC_Method) (if not Is_Start_Of_Encoding (Character'Val (ch), File.WC_Method)
then then Character'Val (ch)
Item := Character'Val (ch); else Get_Upper_Half_Char_Immed (Character'Val (ch), File));
else
Item := Get_Upper_Half_Char_Immed (Character'Val (ch), File);
end if;
end if; end if;
end if; end if;
end Get_Immediate; end Get_Immediate;
...@@ -625,13 +622,10 @@ package body Ada.Text_IO is ...@@ -625,13 +622,10 @@ package body Ada.Text_IO is
else else
Available := True; Available := True;
if Is_Start_Of_Encoding Item :=
(Character'Val (ch), File.WC_Method) (if Is_Start_Of_Encoding (Character'Val (ch), File.WC_Method)
then then Character'Val (ch)
Item := Character'Val (ch); else Get_Upper_Half_Char_Immed (Character'Val (ch), File));
else
Item := Get_Upper_Half_Char_Immed (Character'Val (ch), File);
end if;
end if; end if;
end if; end if;
......
...@@ -1401,9 +1401,7 @@ package body Exp_Ch11 is ...@@ -1401,9 +1401,7 @@ package body Exp_Ch11 is
-- If a string expression is present, then the raise statement is -- If a string expression is present, then the raise statement is
-- converted to a call: -- converted to a call:
-- Raise_Exception (exception-name'Identity, string); -- Raise_Exception (exception-name'Identity, string);
-- and there is nothing else to do. -- and there is nothing else to do.
if Present (Expression (N)) then if Present (Expression (N)) then
......
...@@ -113,10 +113,10 @@ package body GNAT.Command_Line is ...@@ -113,10 +113,10 @@ package body GNAT.Command_Line is
-- the beginning, else it is appended. -- the beginning, else it is appended.
function Can_Have_Parameter (S : String) return Boolean; function Can_Have_Parameter (S : String) return Boolean;
-- True if S can have a parameter. -- True if S can have a parameter
function Require_Parameter (S : String) return Boolean; function Require_Parameter (S : String) return Boolean;
-- True if S requires a parameter. -- True if S requires a parameter
function Actual_Switch (S : String) return String; function Actual_Switch (S : String) return String;
-- Remove any possible trailing '!', ':', '?' and '=' -- Remove any possible trailing '!', ':', '?' and '='
......
...@@ -1103,7 +1103,7 @@ package body GNAT.Expect is ...@@ -1103,7 +1103,7 @@ package body GNAT.Expect is
-- currently we can cleanly close the unneeded ends of the pipes, but -- currently we can cleanly close the unneeded ends of the pipes, but
-- this doesn't really matter. -- this doesn't really matter.
-- We could close Pipe1.Output, Pipe2.Input, Pipe3.Input. -- We could close Pipe1.Output, Pipe2.Input, Pipe3.Input
Dup2 (Pipe1.Input, GNAT.OS_Lib.Standin); Dup2 (Pipe1.Input, GNAT.OS_Lib.Standin);
Dup2 (Pipe2.Output, GNAT.OS_Lib.Standout); Dup2 (Pipe2.Output, GNAT.OS_Lib.Standout);
......
...@@ -87,7 +87,7 @@ procedure Gnat1drv is ...@@ -87,7 +87,7 @@ procedure Gnat1drv is
-- There are various interactions between front end switch settings, -- There are various interactions between front end switch settings,
-- including debug switch settings and target dependent parameters. -- including debug switch settings and target dependent parameters.
-- This procedure takes care of properly handling these interactions. -- This procedure takes care of properly handling these interactions.
-- We do it after scanning out all the switches, that way we are not -- We do it after scanning out all the switches, so that we are not
-- depending on the order in which switches appear. -- depending on the order in which switches appear.
procedure Check_Bad_Body; procedure Check_Bad_Body;
...@@ -174,7 +174,7 @@ procedure Gnat1drv is ...@@ -174,7 +174,7 @@ procedure Gnat1drv is
-- Deal with forcing OpenVMS switches True if debug flag M is set, but -- Deal with forcing OpenVMS switches True if debug flag M is set, but
-- record the setting of Targparm.Open_VMS_On_Target in True_VMS_Target -- record the setting of Targparm.Open_VMS_On_Target in True_VMS_Target
-- before doing this, so we know if we are in real openVMS or not! -- before doing this, so we know if we are in real OpenVMS or not!
Opt.True_VMS_Target := Targparm.OpenVMS_On_Target; Opt.True_VMS_Target := Targparm.OpenVMS_On_Target;
......
...@@ -91,7 +91,7 @@ package Output is ...@@ -91,7 +91,7 @@ package Output is
-- beginning of the line, wrapping around if it gets too long. -- beginning of the line, wrapping around if it gets too long.
procedure Outdent; procedure Outdent;
-- Decreases the current indentation level. -- Decreases the current indentation level
procedure Write_Char (C : Character); procedure Write_Char (C : Character);
-- Write one character to the standard output file. If the character is LF, -- Write one character to the standard output file. If the character is LF,
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2001-2008, Free Software Foundation, Inc. -- -- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -183,7 +183,7 @@ package Prj.Attr is ...@@ -183,7 +183,7 @@ package Prj.Attr is
-- Default value of Package_Node_Id objects -- Default value of Package_Node_Id objects
Unknown_Package : constant Package_Node_Id; Unknown_Package : constant Package_Node_Id;
-- Value of an unknown package that has been found but is unknown. -- Value of an unknown package that has been found but is unknown
procedure Register_New_Package (Name : String; Id : out Package_Node_Id); procedure Register_New_Package (Name : String; Id : out Package_Node_Id);
-- Add a new package. Fails if Name (the package name) is empty or is -- Add a new package. Fails if Name (the package name) is empty or is
......
...@@ -438,6 +438,7 @@ package body Prj.Env is ...@@ -438,6 +438,7 @@ package body Prj.Env is
Lang : constant Language_Ptr := Lang : constant Language_Ptr :=
Get_Language_From_Name (Project, "ada"); Get_Language_From_Name (Project, "ada");
Naming : Lang_Naming_Data; Naming : Lang_Naming_Data;
begin begin
if Current_Verbosity = High then if Current_Verbosity = High then
Write_Str ("Checking project file """); Write_Str ("Checking project file """);
...@@ -450,6 +451,7 @@ package body Prj.Env is ...@@ -450,6 +451,7 @@ package body Prj.Env is
if Current_Verbosity = High then if Current_Verbosity = High then
Write_Str ("Languages does not contain Ada, nothing to do"); Write_Str ("Languages does not contain Ada, nothing to do");
end if; end if;
return; return;
end if; end if;
...@@ -984,7 +986,7 @@ package body Prj.Env is ...@@ -984,7 +986,7 @@ package body Prj.Env is
The_Body_Name : Name_Id; The_Body_Name : Name_Id;
begin begin
-- ??? Same block in Project_Od -- ??? Same block in Project_Of
Canonical_Case_File_Name (Original_Name); Canonical_Case_File_Name (Original_Name);
Name_Len := Original_Name'Length; Name_Len := Original_Name'Length;
Name_Buffer (1 .. Name_Len) := Original_Name; Name_Buffer (1 .. Name_Len) := Original_Name;
...@@ -994,9 +996,12 @@ package body Prj.Env is ...@@ -994,9 +996,12 @@ package body Prj.Env is
declare declare
Naming : constant Lang_Naming_Data := Lang.Config.Naming_Data; Naming : constant Lang_Naming_Data := Lang.Config.Naming_Data;
Extended_Spec_Name : String := Extended_Spec_Name : String :=
Name & Namet.Get_Name_String (Naming.Spec_Suffix); Name & Namet.Get_Name_String
(Naming.Spec_Suffix);
Extended_Body_Name : String := Extended_Body_Name : String :=
Name & Namet.Get_Name_String (Naming.Body_Suffix); Name & Namet.Get_Name_String
(Naming.Body_Suffix);
begin begin
Canonical_Case_File_Name (Extended_Spec_Name); Canonical_Case_File_Name (Extended_Spec_Name);
Name_Len := Extended_Spec_Name'Length; Name_Len := Extended_Spec_Name'Length;
...@@ -1455,9 +1460,12 @@ package body Prj.Env is ...@@ -1455,9 +1460,12 @@ package body Prj.Env is
declare declare
Naming : Lang_Naming_Data renames Lang.Config.Naming_Data; Naming : Lang_Naming_Data renames Lang.Config.Naming_Data;
Extended_Spec_Name : String := Extended_Spec_Name : String :=
Name & Namet.Get_Name_String (Naming.Spec_Suffix); Name & Namet.Get_Name_String
(Naming.Spec_Suffix);
Extended_Body_Name : String := Extended_Body_Name : String :=
Name & Namet.Get_Name_String (Naming.Body_Suffix); Name & Namet.Get_Name_String
(Naming.Body_Suffix);
begin begin
Canonical_Case_File_Name (Extended_Spec_Name); Canonical_Case_File_Name (Extended_Spec_Name);
Name_Len := Extended_Spec_Name'Length; Name_Len := Extended_Spec_Name'Length;
...@@ -1469,14 +1477,15 @@ package body Prj.Env is ...@@ -1469,14 +1477,15 @@ package body Prj.Env is
Name_Buffer (1 .. Name_Len) := Extended_Body_Name; Name_Buffer (1 .. Name_Len) := Extended_Body_Name;
The_Body_Name := Name_Find; The_Body_Name := Name_Find;
end; end;
else else
The_Spec_Name := The_Original_Name; The_Spec_Name := The_Original_Name;
The_Body_Name := The_Original_Name; The_Body_Name := The_Original_Name;
end if; end if;
Unit := Units_Htable.Get_First (In_Tree.Units_HT); Unit := Units_Htable.Get_First (In_Tree.Units_HT);
while Unit /= null loop while Unit /= null loop
-- Case of a body present -- Case of a body present
if Unit.File_Names (Impl) /= null then if Unit.File_Names (Impl) /= null then
......
...@@ -93,6 +93,9 @@ package body Prj.Nmsc is ...@@ -93,6 +93,9 @@ package body Prj.Nmsc is
-- Hash table to store file names found in string list attribute -- Hash table to store file names found in string list attribute
-- Source_Files or in a source list file, stored in hash table -- Source_Files or in a source list file, stored in hash table
-- Source_Names, used by procedure Get_Path_Names_And_Record_Sources. -- Source_Names, used by procedure Get_Path_Names_And_Record_Sources.
--
-- ??? Should not be a global table, as it is needed only when processing
-- a project
-- More documentation needed on what unit exceptions are about ??? -- More documentation needed on what unit exceptions are about ???
...@@ -280,11 +283,10 @@ package body Prj.Nmsc is ...@@ -280,11 +283,10 @@ package body Prj.Nmsc is
Bodies : out Array_Element_Id; Bodies : out Array_Element_Id;
Specs : out Array_Element_Id); Specs : out Array_Element_Id);
-- Check the naming scheme part of Data, and initialize the naming scheme -- Check the naming scheme part of Data, and initialize the naming scheme
-- data in the config of the various languages. -- data in the config of the various languages. Is_Config_File should be
-- Is_Config_File should be True if Project is a config file (.cgpr) -- True if Project is a config file (.cgpr) This also returns the naming
-- This also returns the naming scheme exceptions for unit-based -- scheme exceptions for unit-based languages (Bodies and Specs are
-- languages (Bodies and Specs are associative arrays mapping individual -- associative arrays mapping individual unit names to source file names).
-- unit names to source file names).
procedure Check_Configuration procedure Check_Configuration
(Project : Project_Id; (Project : Project_Id;
...@@ -569,7 +571,10 @@ package body Prj.Nmsc is ...@@ -569,7 +571,10 @@ package body Prj.Nmsc is
procedure Remove_Source procedure Remove_Source
(Id : Source_Id; (Id : Source_Id;
Replaced_By : Source_Id); Replaced_By : Source_Id);
-- ??? needs comment -- Remove a file from the list of sources of a project.
-- This might be because the file is replaced by another one in an
-- extending project, or because a file was added as a naming exception
-- but was not found in the end.
procedure Report_No_Sources procedure Report_No_Sources
(Project : Project_Id; (Project : Project_Id;
...@@ -2398,8 +2403,7 @@ package body Prj.Nmsc is ...@@ -2398,8 +2403,7 @@ package body Prj.Nmsc is
Lang_Index := Project.Languages; Lang_Index := Project.Languages;
while Lang_Index /= No_Language_Index loop while Lang_Index /= No_Language_Index loop
-- For all languages, Compiler_Driver needs to be specified. This is -- For all languages, Compiler_Driver needs to be specified. This is
-- only necessary if we do intend to compile (not in GPS for -- only needed if we do intend to compile (not in GPS for instance).
-- instance)
if Compiler_Driver_Mandatory if Compiler_Driver_Mandatory
and then Lang_Index.Config.Compiler_Driver = No_File and then Lang_Index.Config.Compiler_Driver = No_File
...@@ -3124,13 +3128,15 @@ package body Prj.Nmsc is ...@@ -3124,13 +3128,15 @@ package body Prj.Nmsc is
Sep_Suffix_Loc : Source_Ptr; Sep_Suffix_Loc : Source_Ptr;
begin begin
-- If no language, then nothing to do
if Ada = null then if Ada = null then
-- No language, thus nothing to do
return; return;
end if; end if;
declare declare
Data : Lang_Naming_Data renames Ada.Config.Naming_Data; Data : Lang_Naming_Data renames Ada.Config.Naming_Data;
begin begin
-- The default value of separate suffix should be the same as the -- The default value of separate suffix should be the same as the
-- body suffix, so we need to compute that first. -- body suffix, so we need to compute that first.
...@@ -3192,9 +3198,9 @@ package body Prj.Nmsc is ...@@ -3192,9 +3198,9 @@ package body Prj.Nmsc is
if Data.Spec_Suffix = Data.Body_Suffix then if Data.Spec_Suffix = Data.Body_Suffix then
Error_Msg Error_Msg
(Project, In_Tree, (Project, In_Tree,
"Body_Suffix (""" & "Body_Suffix ("""
Get_Name_String (Data.Body_Suffix) & & Get_Name_String (Data.Body_Suffix)
""") cannot be the same as Spec_Suffix.", & """) cannot be the same as Spec_Suffix.",
Ada_Body_Suffix_Loc); Ada_Body_Suffix_Loc);
end if; end if;
...@@ -3203,9 +3209,9 @@ package body Prj.Nmsc is ...@@ -3203,9 +3209,9 @@ package body Prj.Nmsc is
then then
Error_Msg Error_Msg
(Project, In_Tree, (Project, In_Tree,
"Separate_Suffix (""" & "Separate_Suffix ("""
Get_Name_String (Data.Separate_Suffix) & & Get_Name_String (Data.Separate_Suffix)
""") cannot be the same as Spec_Suffix.", & """) cannot be the same as Spec_Suffix.",
Sep_Suffix_Loc); Sep_Suffix_Loc);
end if; end if;
end; end;
...@@ -3233,8 +3239,8 @@ package body Prj.Nmsc is ...@@ -3233,8 +3239,8 @@ package body Prj.Nmsc is
Separate_Suffix => Separate_Suffix, Separate_Suffix => Separate_Suffix,
Sep_Suffix_Loc => Sep_Suffix_Loc); Sep_Suffix_Loc => Sep_Suffix_Loc);
-- For all unit based languages, if any, set the specified -- For all unit based languages, if any, set the specified value
-- value of Dot_Replacement, Casing and/or Separate_Suffix. Do not -- of Dot_Replacement, Casing and/or Separate_Suffix. Do not
-- systematically overwrite, since the defaults come from the -- systematically overwrite, since the defaults come from the
-- configuration file -- configuration file
...@@ -4197,6 +4203,8 @@ package body Prj.Nmsc is ...@@ -4197,6 +4203,8 @@ package body Prj.Nmsc is
end if; end if;
end Add_Language; end Add_Language;
-- Start of processing for Check_Programming_Languages
begin begin
Project.Languages := null; Project.Languages := null;
Languages := Languages :=
...@@ -4230,6 +4238,7 @@ package body Prj.Nmsc is ...@@ -4230,6 +4238,7 @@ package body Prj.Nmsc is
"no languages defined for this project", "no languages defined for this project",
Project.Location); Project.Location);
Def_Lang_Id := No_Name; Def_Lang_Id := No_Name;
else else
Def_Lang_Id := Name_Ada; Def_Lang_Id := Name_Ada;
end if; end if;
...@@ -4299,6 +4308,7 @@ package body Prj.Nmsc is ...@@ -4299,6 +4308,7 @@ package body Prj.Nmsc is
Extending : Boolean) return Boolean Extending : Boolean) return Boolean
is is
Prj : Project_Id; Prj : Project_Id;
begin begin
if P = Root_Project then if P = Root_Project then
return True; return True;
...@@ -6048,6 +6058,7 @@ package body Prj.Nmsc is ...@@ -6048,6 +6058,7 @@ package body Prj.Nmsc is
Unit_Except : Unit_Exception; Unit_Except : Unit_Exception;
Masked : Boolean := False; Masked : Boolean := False;
begin begin
Unit := No_Name; Unit := No_Name;
Kind := Spec; Kind := Spec;
...@@ -6056,6 +6067,7 @@ package body Prj.Nmsc is ...@@ -6056,6 +6067,7 @@ package body Prj.Nmsc is
if Current_Verbosity = High then if Current_Verbosity = High then
Write_Line (" No dot_replacement specified"); Write_Line (" No dot_replacement specified");
end if; end if;
return; return;
end if; end if;
...@@ -6087,6 +6099,7 @@ package body Prj.Nmsc is ...@@ -6087,6 +6099,7 @@ package body Prj.Nmsc is
if Current_Verbosity = High then if Current_Verbosity = High then
Write_Line (" No matching suffix"); Write_Line (" No matching suffix");
end if; end if;
return; return;
end if; end if;
...@@ -6102,6 +6115,7 @@ package body Prj.Nmsc is ...@@ -6102,6 +6115,7 @@ package body Prj.Nmsc is
if Current_Verbosity = High then if Current_Verbosity = High then
Write_Line (" Invalid casing"); Write_Line (" Invalid casing");
end if; end if;
return; return;
end if; end if;
end loop; end loop;
...@@ -6114,6 +6128,7 @@ package body Prj.Nmsc is ...@@ -6114,6 +6128,7 @@ package body Prj.Nmsc is
if Current_Verbosity = High then if Current_Verbosity = High then
Write_Line (" Invalid casing"); Write_Line (" Invalid casing");
end if; end if;
return; return;
end if; end if;
end loop; end loop;
...@@ -6137,12 +6152,14 @@ package body Prj.Nmsc is ...@@ -6137,12 +6152,14 @@ package body Prj.Nmsc is
if Current_Verbosity = High then if Current_Verbosity = High then
Write_Line (" Invalid name, contains dot"); Write_Line (" Invalid name, contains dot");
end if; end if;
return; return;
end if; end if;
end loop; end loop;
Replace_Into_Name_Buffer Replace_Into_Name_Buffer
(Filename (Filename'First .. Last), Dot_Repl, '.'); (Filename (Filename'First .. Last), Dot_Repl, '.');
else else
Name_Len := Last - Filename'First + 1; Name_Len := Last - Filename'First + 1;
Name_Buffer (1 .. Name_Len) := Filename (Filename'First .. Last); Name_Buffer (1 .. Name_Len) := Filename (Filename'First .. Last);
...@@ -7288,7 +7305,6 @@ package body Prj.Nmsc is ...@@ -7288,7 +7305,6 @@ package body Prj.Nmsc is
else else
if Name_Loc.Found then if Name_Loc.Found then
-- Check if it is OK to have the same file name in several -- Check if it is OK to have the same file name in several
-- source directories. -- source directories.
...@@ -7309,6 +7325,12 @@ package body Prj.Nmsc is ...@@ -7309,6 +7325,12 @@ package body Prj.Nmsc is
Check_Name := True; Check_Name := True;
else else
-- ??? Issue: there could be several entries for the same
-- source file in the list of sources, in case the file
-- contains multiple units. We should share the data as much
-- as possible, and more importantly set the path for all
-- instances.
Name_Loc.Source.Path := (Canonical_Path, Path); Name_Loc.Source.Path := (Canonical_Path, Path);
Source_Paths_Htable.Set Source_Paths_Htable.Set
......
...@@ -1078,7 +1078,7 @@ package body System.Interrupts is ...@@ -1078,7 +1078,7 @@ package body System.Interrupts is
POP.Write_Lock (Self_Id); POP.Write_Lock (Self_Id);
-- Unassociate the interrupt handler. -- Unassociate the interrupt handler
Semaphore_ID_Map (Interrupt) := 0; Semaphore_ID_Map (Interrupt) := 0;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1991-1994, Florida State University -- -- Copyright (C) 1991-1994, Florida State University --
-- Copyright (C) 1995-2006, AdaCore -- -- Copyright (C) 1995-2009, AdaCore --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- This is a OpenVMS/Alpha version of this package. -- This is a OpenVMS/Alpha version of this package
-- This package encapsulates all direct interfaces to OS services -- This package encapsulates all direct interfaces to OS services
-- that are needed by children of System. -- that are needed by children of System.
......
...@@ -83,6 +83,7 @@ package System.Secondary_Stack is ...@@ -83,6 +83,7 @@ package System.Secondary_Stack is
procedure SS_Release (M : Mark_Id); procedure SS_Release (M : Mark_Id);
-- Restore the state of the stack corresponding to the mark M. If an -- Restore the state of the stack corresponding to the mark M. If an
-- additional chunk have been allocated, it will never be freed during a -- additional chunk have been allocated, it will never be freed during a
-- ??? missing comment here
function SS_Get_Max return Long_Long_Integer; function SS_Get_Max return Long_Long_Integer;
-- Return maximum used space in storage units for the current secondary -- Return maximum used space in storage units for the current secondary
......
...@@ -85,10 +85,12 @@ package body System.Stack_Checking.Operations is ...@@ -85,10 +85,12 @@ package body System.Stack_Checking.Operations is
procedure Initialize_Stack_Limit is procedure Initialize_Stack_Limit is
begin begin
-- For the environment task. -- For the environment task
Set_Stack_Limit_For_Current_Task; Set_Stack_Limit_For_Current_Task;
-- Will be called by every created task. -- Will be called by every created task
Set_Stack_Limit_Hook := Set_Stack_Limit_For_Current_Task'Access; Set_Stack_Limit_Hook := Set_Stack_Limit_For_Current_Task'Access;
end Initialize_Stack_Limit; end Initialize_Stack_Limit;
...@@ -99,10 +101,10 @@ package body System.Stack_Checking.Operations is ...@@ -99,10 +101,10 @@ package body System.Stack_Checking.Operations is
procedure Set_Stack_Limit_For_Current_Task is procedure Set_Stack_Limit_For_Current_Task is
use Interfaces.C; use Interfaces.C;
-- Import from VxWorks.
function Task_Var_Add (Tid : Interfaces.C.int; Var : Address) function Task_Var_Add (Tid : Interfaces.C.int; Var : Address)
return Interfaces.C.int; return Interfaces.C.int;
pragma Import (C, Task_Var_Add, "taskVarAdd"); pragma Import (C, Task_Var_Add, "taskVarAdd");
-- Import from VxWorks
type OS_Stack_Info is record type OS_Stack_Info is record
Size : Interfaces.C.int; Size : Interfaces.C.int;
...@@ -121,8 +123,10 @@ package body System.Stack_Checking.Operations is ...@@ -121,8 +123,10 @@ package body System.Stack_Checking.Operations is
Stack_Info : aliased OS_Stack_Info; Stack_Info : aliased OS_Stack_Info;
Limit : System.Address; Limit : System.Address;
begin begin
-- Get stack bounds from VxWorks. -- Get stack bounds from VxWorks
Get_Stack_Info (Stack_Info'Access); Get_Stack_Info (Stack_Info'Access);
if Stack_Grows_Down then if Stack_Grows_Down then
...@@ -131,7 +135,8 @@ package body System.Stack_Checking.Operations is ...@@ -131,7 +135,8 @@ package body System.Stack_Checking.Operations is
Limit := Stack_Info.Base + Storage_Offset (Stack_Info.Size); Limit := Stack_Info.Base + Storage_Offset (Stack_Info.Size);
end if; end if;
-- Note: taskVarAdd implicitly calls taskVarInit if required. -- Note: taskVarAdd implicitly calls taskVarInit if required
if Task_Var_Add (0, Stack_Limit'Address) = 0 then if Task_Var_Add (0, Stack_Limit'Address) = 0 then
Stack_Limit := Limit; Stack_Limit := Limit;
end if; end if;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
-- -- -- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- -- -- --
-- S Y S T E M . S T A C K _ U S A G E . T AS K I N G -- -- S Y S T E M . S T A C K _ U S A G E . T A S K I N G --
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
...@@ -60,7 +60,7 @@ package System.Stack_Usage.Tasking is ...@@ -60,7 +60,7 @@ package System.Stack_Usage.Tasking is
"__gnat_tasks_stack_usage_report_current_task"); "__gnat_tasks_stack_usage_report_current_task");
subtype Stack_Usage_Result is System.Stack_Usage.Task_Result; subtype Stack_Usage_Result is System.Stack_Usage.Task_Result;
-- This type is a descriptor for task stack usage result. -- This type is a descriptor for task stack usage result
type Stack_Usage_Result_Array is type Stack_Usage_Result_Array is
array (Positive range <>) of Stack_Usage_Result; array (Positive range <>) of Stack_Usage_Result;
......
...@@ -1136,7 +1136,7 @@ package body System.Task_Primitives.Operations is ...@@ -1136,7 +1136,7 @@ package body System.Task_Primitives.Operations is
-- System.Real_Time.Time_Span in the same way, i.e., as a 64-bit count of -- System.Real_Time.Time_Span in the same way, i.e., as a 64-bit count of
-- nanoseconds. -- nanoseconds.
-- This allows us to always pass the timeout value as a Duration. -- This allows us to always pass the timeout value as a Duration
-- ??? -- ???
-- We are taking liberties here with the semantics of the delays. That is, -- We are taking liberties here with the semantics of the delays. That is,
......
...@@ -200,7 +200,7 @@ package System.Tasking is ...@@ -200,7 +200,7 @@ package System.Tasking is
-- completion event/signal to occur. -- completion event/signal to occur.
Activating, Activating,
-- Task has been created and is being made Runnable. -- Task has been created and is being made Runnable
Acceptor_Delay_Sleep Acceptor_Delay_Sleep
-- Task is waiting on an selective wait statement -- Task is waiting on an selective wait statement
......
...@@ -94,7 +94,7 @@ package body Specific is ...@@ -94,7 +94,7 @@ package body Specific is
begin begin
Result := pthread_getspecific (ATCB_Key); Result := pthread_getspecific (ATCB_Key);
-- If the key value is Null, then it is a non-Ada task. -- If the key value is Null then it is a non-Ada task
if Result /= System.Null_Address then if Result /= System.Null_Address then
return To_Task_Id (Result); return To_Task_Id (Result);
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- This is a POSIX-like version of this package. -- This is a POSIX-like version of this package
separate (System.Task_Primitives.Operations) separate (System.Task_Primitives.Operations)
package body Specific is package body Specific is
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2009 Free Software Foundation, Inc. -- -- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- GNARL 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -66,25 +66,25 @@ package body System.Traces.Format is ...@@ -66,25 +66,25 @@ package body System.Traces.Format is
function Append function Append
(Source : String_Trace; (Source : String_Trace;
Annex : String) Annex : String) return String_Trace
return String_Trace
is is
Result : String_Trace := (others => ' '); Result : String_Trace := (others => ' ');
Source_Length : Integer := 1;
Annex_Length : Integer := Annex'Length; Annex_Length : Integer := Annex'Length;
Source_Length : Integer;
begin begin
if Parameters.Runtime_Traces then if Parameters.Runtime_Traces then
-- First we determine the size used, without the spaces at the -- First we determine the size used, without the spaces at the end,
-- end, if a String_Trace is present. Look at -- if a String_Trace is present. Look at System.Traces.Tasking for
-- System.Traces.Tasking for examples. -- examples.
Source_Length := 1;
while Source (Source_Length) /= ASCII.NUL loop while Source (Source_Length) /= ASCII.NUL loop
Source_Length := Source_Length + 1; Source_Length := Source_Length + 1;
end loop; end loop;
-- Then we fill the string. -- Then we fill the string
if Source_Length - 1 + Annex_Length <= Max_Size then if Source_Length - 1 + Annex_Length <= Max_Size then
Result (1 .. Source_Length - 1) := Result (1 .. Source_Length - 1) :=
...@@ -97,6 +97,7 @@ package body System.Traces.Format is ...@@ -97,6 +97,7 @@ package body System.Traces.Format is
Result (Source_Length + Annex_Length + 1 .. Max_Size) := Result (Source_Length + Annex_Length + 1 .. Max_Size) :=
(others => ' '); (others => ' ');
else else
Result (1 .. Source_Length - 1) := Source (1 .. Source_Length - 1); Result (1 .. Source_Length - 1) := Source (1 .. Source_Length - 1);
Result (Source_Length .. Max_Size - 1) := Result (Source_Length .. Max_Size - 1) :=
......
...@@ -363,7 +363,7 @@ package Scans is ...@@ -363,7 +363,7 @@ package Scans is
-- Pointer to first character of current token -- Pointer to first character of current token
Current_Line_Start : Source_Ptr := No_Location; -- init for -gnatVa Current_Line_Start : Source_Ptr := No_Location; -- init for -gnatVa
-- Pointer to first character of line containing current token. -- Pointer to first character of line containing current token
Start_Column : Column_Number := No_Column_Number; -- init for -gnatVa Start_Column : Column_Number := No_Column_Number; -- init for -gnatVa
-- Starting column number (zero origin) of the first non-blank character -- Starting column number (zero origin) of the first non-blank character
...@@ -444,6 +444,11 @@ package Scans is ...@@ -444,6 +444,11 @@ package Scans is
-- Is it really right for this to be a Name rather than a String, what -- Is it really right for this to be a Name rather than a String, what
-- about the case of Wide_Wide_Characters??? -- about the case of Wide_Wide_Characters???
Inside_Conditional_Expression : Nat := 0;
-- This is a counter that is set non-zero while scanning out a conditional
-- expression (incremented on entry, decremented on exit). It is used to
-- disconnect format checks that normally apply to keywords THEN, ELSE etc.
-------------------------------------------------------- --------------------------------------------------------
-- Procedures for Saving and Restoring the Scan State -- -- Procedures for Saving and Restoring the Scan State --
-------------------------------------------------------- --------------------------------------------------------
......
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