Commit 727e7b1a by Arnaud Charlet

[multiple changes]

2012-07-12  Robert Dewar  <dewar@adacore.com>

	* s-atopri.adb, s-atopri.ads: Minor reformatting.

2012-07-12  Robert Dewar  <dewar@adacore.com>

	* ali.adb: Add circuitry to read new named form of restrictions lines.
	* debug.adb: Add doc for new -gnatd.R switch (used positional
	notation for output of restrictions data in ali file).
	* lib-writ.adb: Implement new named format for restrictions lines.
	* lib-writ.ads: Add documentation for new named format for
	restrictions in ali files.
	* restrict.adb, restrict.ads, sem_prag.adb: Update comments.
	* rident.ads: Go back to withing System.Rident
	* s-rident.ads: Add extensive comment on dealing with consistency
	checking.

2012-07-12  Thomas Quinot  <quinot@adacore.com>

	* par_sco.adb, scos.ads: Emit detailed SCOs for SELECT statements.

From-SVN: r189438
parent 03459f40
2012-07-12 Robert Dewar <dewar@adacore.com> 2012-07-12 Robert Dewar <dewar@adacore.com>
* s-atopri.adb, s-atopri.ads: Minor reformatting.
2012-07-12 Robert Dewar <dewar@adacore.com>
* ali.adb: Add circuitry to read new named form of restrictions lines.
* debug.adb: Add doc for new -gnatd.R switch (used positional
notation for output of restrictions data in ali file).
* lib-writ.adb: Implement new named format for restrictions lines.
* lib-writ.ads: Add documentation for new named format for
restrictions in ali files.
* restrict.adb, restrict.ads, sem_prag.adb: Update comments.
* rident.ads: Go back to withing System.Rident
* s-rident.ads: Add extensive comment on dealing with consistency
checking.
2012-07-12 Thomas Quinot <quinot@adacore.com>
* par_sco.adb, scos.ads: Emit detailed SCOs for SELECT statements.
2012-07-12 Robert Dewar <dewar@adacore.com>
* sem_disp.adb: Minor reformatting * sem_disp.adb: Minor reformatting
* s-bytswa.ads: Minor comment update. * s-bytswa.ads: Minor comment update.
......
...@@ -135,7 +135,7 @@ package body Debug is ...@@ -135,7 +135,7 @@ package body Debug is
-- d.O Dump internal SCO tables -- d.O Dump internal SCO tables
-- d.P Previous (non-optimized) handling of length comparisons -- d.P Previous (non-optimized) handling of length comparisons
-- d.Q -- d.Q
-- d.R -- d.R Restrictions in ali files in positional form
-- d.S Force Optimize_Alignment (Space) -- d.S Force Optimize_Alignment (Space)
-- d.T Force Optimize_Alignment (Time) -- d.T Force Optimize_Alignment (Time)
-- d.U Ignore indirect calls for static elaboration -- d.U Ignore indirect calls for static elaboration
...@@ -642,6 +642,11 @@ package body Debug is ...@@ -642,6 +642,11 @@ package body Debug is
-- This is there in case we find a situation where the optimization -- This is there in case we find a situation where the optimization
-- malfunctions, to provide a work around. -- malfunctions, to provide a work around.
-- d.R As documented in lib-writ.ads, restrictions in the ali file can
-- have two forms, positional and named. The named notation is the
-- current preferred form, but the use of this debug switch will force
-- the use of the obsolescent positional form.
-- d.S Force Optimize_Alignment (Space) mode as the default -- d.S Force Optimize_Alignment (Space) mode as the default
-- d.T Force Optimize_Alignment (Time) mode as the default -- d.T Force Optimize_Alignment (Time) mode as the default
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
with ALI; use ALI; with ALI; use ALI;
with Atree; use Atree; with Atree; use Atree;
with Casing; use Casing; with Casing; use Casing;
with Debug; use Debug;
with Einfo; use Einfo; with Einfo; use Einfo;
with Errout; use Errout; with Errout; use Errout;
with Fname; use Fname; with Fname; use Fname;
...@@ -1140,52 +1141,128 @@ package body Lib.Writ is ...@@ -1140,52 +1141,128 @@ package body Lib.Writ is
end if; end if;
end loop; end loop;
-- Output first restrictions line -- Positional case (only if debug flag -gnatd.R is set)
Write_Info_Initiate ('R'); if Debug_Flag_Dot_RR then
Write_Info_Char (' ');
-- First the information for the boolean restrictions -- Output first restrictions line
for R in All_Boolean_Restrictions loop Write_Info_Initiate ('R');
if Main_Restrictions.Set (R) Write_Info_Char (' ');
and then not Restriction_Warnings (R)
then
Write_Info_Char ('r');
elsif Main_Restrictions.Violated (R) then
Write_Info_Char ('v');
else
Write_Info_Char ('n');
end if;
end loop;
-- And now the information for the parameter restrictions -- First the information for the boolean restrictions
for RP in All_Parameter_Restrictions loop for R in All_Boolean_Restrictions loop
if Main_Restrictions.Set (RP) if Main_Restrictions.Set (R)
and then not Restriction_Warnings (RP) and then not Restriction_Warnings (R)
then then
Write_Info_Char ('r'); Write_Info_Char ('r');
Write_Info_Nat (Nat (Main_Restrictions.Value (RP))); elsif Main_Restrictions.Violated (R) then
else Write_Info_Char ('v');
Write_Info_Char ('n'); else
end if; Write_Info_Char ('n');
end if;
end loop;
if not Main_Restrictions.Violated (RP) -- And now the information for the parameter restrictions
or else RP not in Checked_Parameter_Restrictions
then for RP in All_Parameter_Restrictions loop
Write_Info_Char ('n'); if Main_Restrictions.Set (RP)
else and then not Restriction_Warnings (RP)
Write_Info_Char ('v'); then
Write_Info_Nat (Nat (Main_Restrictions.Count (RP))); Write_Info_Char ('r');
Write_Info_Nat (Nat (Main_Restrictions.Value (RP)));
else
Write_Info_Char ('n');
end if;
if not Main_Restrictions.Violated (RP)
or else RP not in Checked_Parameter_Restrictions
then
Write_Info_Char ('n');
else
Write_Info_Char ('v');
Write_Info_Nat (Nat (Main_Restrictions.Count (RP)));
if Main_Restrictions.Unknown (RP) then if Main_Restrictions.Unknown (RP) then
Write_Info_Char ('+'); Write_Info_Char ('+');
end if;
end if; end if;
end if; end loop;
end loop;
Write_Info_EOL; Write_Info_EOL;
-- Named case (if debug flag -gnatd.R is not set)
else
declare
C : Character;
begin
-- Write RN header line with preceding blank line
Write_Info_EOL;
Write_Info_Initiate ('R');
Write_Info_Char ('N');
Write_Info_EOL;
-- First the lines for the boolean restrictions
for R in All_Boolean_Restrictions loop
if Main_Restrictions.Set (R)
and then not Restriction_Warnings (R)
then
C := 'R';
elsif Main_Restrictions.Violated (R) then
C := 'V';
else
goto Continue;
end if;
Write_Info_Initiate ('R');
Write_Info_Char (C);
Write_Info_Char (' ');
Write_Info_Str (All_Boolean_Restrictions'Image (R));
Write_Info_EOL;
<<Continue>>
null;
end loop;
end;
-- And now the lines for the parameter restrictions
for RP in All_Parameter_Restrictions loop
if Main_Restrictions.Set (RP)
and then not Restriction_Warnings (RP)
then
Write_Info_Initiate ('R');
Write_Info_Str ("R ");
Write_Info_Str (All_Parameter_Restrictions'Image (RP));
Write_Info_Char ('=');
Write_Info_Nat (Nat (Main_Restrictions.Value (RP)));
Write_Info_EOL;
end if;
if not Main_Restrictions.Violated (RP)
or else RP not in Checked_Parameter_Restrictions
then
null;
else
Write_Info_Initiate ('R');
Write_Info_Str ("V ");
Write_Info_Str (All_Parameter_Restrictions'Image (RP));
Write_Info_Char ('=');
Write_Info_Nat (Nat (Main_Restrictions.Count (RP)));
if Main_Restrictions.Unknown (RP) then
Write_Info_Char ('+');
end if;
Write_Info_EOL;
end if;
end loop;
end if;
-- Output R lines for No_Dependence entries -- Output R lines for No_Dependence entries
......
...@@ -262,6 +262,28 @@ package Lib.Writ is ...@@ -262,6 +262,28 @@ package Lib.Writ is
-- -- R Restrictions -- -- -- R Restrictions --
-- --------------------- -- ---------------------
-- There are two forms for R lines, positional and named. The positional
-- notation is now considered obsolescent, it is not generated by the most
-- recent versions of the compiler except under control of the debug switch
-- -gnatdR, but is still recognized by the binder.
-- The recognition by the binder is to ease the transition, and better deal
-- with some cases of inconsistent builds using incompatible versions of
-- the compiler and binder. The named notation is the current preferred
-- approach.
-- Note that R lines are generated using the information in unit Rident,
-- and intepreted by the binder using the information in System.Rident.
-- Normally these two units should be effectively identical. However in
-- some cases of inconsistent builds, they may be different. This may lead
-- to binder diagnostics, which can be suppressed using the -C switch for
-- the binder, which results in ignoring unrecognized restrictions in the
-- ali files.
-- ---------------------------------------
-- -- R Restrictions (Positional Form) --
-- ---------------------------------------
-- The first R line records the status of restrictions generated by pragma -- The first R line records the status of restrictions generated by pragma
-- Restrictions encountered, as well as information on what the compiler -- Restrictions encountered, as well as information on what the compiler
-- has been able to determine with respect to restrictions violations. -- has been able to determine with respect to restrictions violations.
...@@ -348,6 +370,74 @@ package Lib.Writ is ...@@ -348,6 +370,74 @@ package Lib.Writ is
-- signal a fatal error if it is missing. This means that future -- signal a fatal error if it is missing. This means that future
-- changes to the ALI file format must retain the R line. -- changes to the ALI file format must retain the R line.
-- ----------------------------------
-- -- R Restrictions (Named Form) --
-- ----------------------------------
-- The first R line for named form announces that named notation will be
-- used, and also assures that there is at least one R line present, which
-- makes parsing of ali files simpler. A blank line preceds the RN line.
-- RN
-- In named notation, the restrictions are given as a series of lines, one
-- per retrictions that is specified or violated (no information is present
-- for restrictions that are not specified or violated). In the following
-- name is the name of the restriction in all upper case.
-- For boolean restrictions, we have only two possibilities. A restrictions
-- pragma is present, or a violation is detected:
-- RR name
-- A restriction pragma is present for the named boolean restriction.
-- No violations were detected by the compiler (or the unit in question
-- would have been found to be illegal).
-- RV name
-- No restriction pragma is present for the named boolean restriction.
-- However, the compiler did detect one or more violations of this
-- restriction, which may require a binder consistency check.
-- For the case of restrictions that take a parameter, we need both the
-- information from pragma if present, and the actual information about
-- what possible violations occur. For example, we can have a unit with
-- a pragma Restrictions (Max_Tasks => 4), where the compiler can detect
-- that there are exactly three tasks declared. Both of these pieces
-- of information must be passed to the binder. The parameter of 4 is
-- important in case the total number of tasks in the partition is greater
-- than 4. The parameter of 3 is important in case some other unit has a
-- restrictions pragma with Max_Tasks=>2.
-- RR name=N
-- A restriction pragma is present for the named restriction which is
-- one of the restrictions taking a parameter. The value N (a decimal
-- integer) is the value given in the restriction pragma.
-- RV name=N
-- A restriction pragma may or may not be present for the restriction
-- given by name (one of the restrictions taking a parameter). But in
-- either case, the compiler detected possible violations. N (a decimal
-- integer) is the maximum or total count of violations (depending
-- on the checking type) in all the units represented by the ali file).
-- The value here is known to be exact by the compiler and is in the
-- range of Natural. Note that if an RR line is present for the same
-- restriction, then the value in the RV line cannot exceed the value
-- in the RR line (since otherwise the compiler would have detected a
-- violation of the restriction).
-- RV name=N+
-- Similar to the above, but the compiler cannot determine the exact
-- count of violations, but it is at least N.
-- -------------------------------------------------
-- -- R Restrictions (No_Dependence Information) --
-- -------------------------------------------------
-- Subsequent R lines are present only if pragma Restriction No_Dependence -- Subsequent R lines are present only if pragma Restriction No_Dependence
-- is used. There is one such line for each such pragma appearing in the -- is used. There is one such line for each such pragma appearing in the
-- extended main unit. The format is: -- extended main unit. The format is:
......
...@@ -541,10 +541,10 @@ package body Restrict is ...@@ -541,10 +541,10 @@ package body Restrict is
then then
null; null;
-- Here if restriction set, check for violation (either this is a -- Here if restriction set, check for violation (this is a Boolean
-- Boolean restriction, or a parameter restriction with a value of -- restriction, or a parameter restriction with a value of zero and an
-- zero and an unknown count, or a parameter restriction with a -- unknown count, or a parameter restriction with a known value that
-- known value that exceeds the restriction count). -- exceeds the restriction count).
elsif R in All_Boolean_Restrictions elsif R in All_Boolean_Restrictions
or else (Restrictions.Unknown (R) or else (Restrictions.Unknown (R)
...@@ -768,7 +768,7 @@ package body Restrict is ...@@ -768,7 +768,7 @@ package body Restrict is
---------------------------------- ----------------------------------
-- Note: body of this function must be coordinated with list of -- Note: body of this function must be coordinated with list of
-- renaming declarations in Rident. -- renaming declarations in System.Rident.
function Process_Restriction_Synonyms (N : Node_Id) return Name_Id function Process_Restriction_Synonyms (N : Node_Id) return Name_Id
is is
......
...@@ -332,10 +332,10 @@ package Restrict is ...@@ -332,10 +332,10 @@ package Restrict is
-- exception propagation is activated. -- exception propagation is activated.
function Process_Restriction_Synonyms (N : Node_Id) return Name_Id; function Process_Restriction_Synonyms (N : Node_Id) return Name_Id;
-- Id is a node whose Chars field contains the name of a restriction. If it -- Id is a node whose Chars field contains the name of a restriction.
-- is one of synonyms that we allow for historical purposes (for list see -- If it is one of synonyms that we allow for historical purposes (for
-- Rident), then the proper official name is returned. Otherwise the Chars -- list see System.Rident), then the proper official name is returned.
-- field of the argument is returned unchanged. -- Otherwise the Chars field of the argument is returned unchanged.
function Restriction_Active (R : All_Restrictions) return Boolean; function Restriction_Active (R : All_Restrictions) return Boolean;
pragma Inline (Restriction_Active); pragma Inline (Restriction_Active);
......
...@@ -30,14 +30,15 @@ ...@@ -30,14 +30,15 @@
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
package body System.Atomic_Primitives is package body System.Atomic_Primitives is
--------------------------- ---------------------------
-- Lock_Free_Try_Write_8 -- -- Lock_Free_Try_Write_8 --
--------------------------- ---------------------------
function Lock_Free_Try_Write_8 function Lock_Free_Try_Write_8
(Ptr : Address; (Ptr : Address;
Expected : in out uint8; Expected : in out uint8;
Desired : uint8) return Boolean Desired : uint8) return Boolean
is is
Actual : uint8; Actual : uint8;
...@@ -59,9 +60,9 @@ package body System.Atomic_Primitives is ...@@ -59,9 +60,9 @@ package body System.Atomic_Primitives is
---------------------------- ----------------------------
function Lock_Free_Try_Write_16 function Lock_Free_Try_Write_16
(Ptr : Address; (Ptr : Address;
Expected : in out uint16; Expected : in out uint16;
Desired : uint16) return Boolean Desired : uint16) return Boolean
is is
Actual : uint16; Actual : uint16;
...@@ -83,9 +84,9 @@ package body System.Atomic_Primitives is ...@@ -83,9 +84,9 @@ package body System.Atomic_Primitives is
---------------------------- ----------------------------
function Lock_Free_Try_Write_32 function Lock_Free_Try_Write_32
(Ptr : Address; (Ptr : Address;
Expected : in out uint32; Expected : in out uint32;
Desired : uint32) return Boolean Desired : uint32) return Boolean
is is
Actual : uint32; Actual : uint32;
...@@ -107,9 +108,9 @@ package body System.Atomic_Primitives is ...@@ -107,9 +108,9 @@ package body System.Atomic_Primitives is
---------------------------- ----------------------------
function Lock_Free_Try_Write_64 function Lock_Free_Try_Write_64
(Ptr : Address; (Ptr : Address;
Expected : in out uint64; Expected : in out uint64;
Desired : uint64) return Boolean Desired : uint64) return Boolean
is is
Actual : uint64; Actual : uint64;
......
...@@ -152,24 +152,24 @@ package System.Atomic_Primitives is ...@@ -152,24 +152,24 @@ package System.Atomic_Primitives is
(Atomic_Load_64 (Ptr, Acquire)); (Atomic_Load_64 (Ptr, Acquire));
function Lock_Free_Try_Write_8 function Lock_Free_Try_Write_8
(Ptr : Address; (Ptr : Address;
Expected : in out uint8; Expected : in out uint8;
Desired : uint8) return Boolean; Desired : uint8) return Boolean;
function Lock_Free_Try_Write_16 function Lock_Free_Try_Write_16
(Ptr : Address; (Ptr : Address;
Expected : in out uint16; Expected : in out uint16;
Desired : uint16) return Boolean; Desired : uint16) return Boolean;
function Lock_Free_Try_Write_32 function Lock_Free_Try_Write_32
(Ptr : Address; (Ptr : Address;
Expected : in out uint32; Expected : in out uint32;
Desired : uint32) return Boolean; Desired : uint32) return Boolean;
function Lock_Free_Try_Write_64 function Lock_Free_Try_Write_64
(Ptr : Address; (Ptr : Address;
Expected : in out uint64; Expected : in out uint64;
Desired : uint64) return Boolean; Desired : uint64) return Boolean;
pragma Inline (Lock_Free_Read_8); pragma Inline (Lock_Free_Read_8);
pragma Inline (Lock_Free_Read_16); pragma Inline (Lock_Free_Read_16);
......
...@@ -30,17 +30,44 @@ ...@@ -30,17 +30,44 @@
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- This package defines the set of restriction identifiers. It is a generic -- This package defines the set of restriction identifiers. It is a generic
-- package that is instantiated by the binder for output of the restrictions -- package that is instantiated by the compiler/binder in package Rident, and
-- structure, and is instantiated in package System.Restrictions for use at -- is instantiated in package System.Restrictions for use at run-time.
-- run-time.
-- The reason that we make this a generic package is so that in the case of -- The reason that we make this a generic package is so that in the case of
-- the instantiation in the binder, we can generate normal image tables for -- the instantiation in Rident for use at compile time and bind time, we can
-- the enumeration types, which are needed for diagnostic and informational -- generate normal image tables for the enumeration types, which are needed
-- messages as well as for identification of restrictions. At run-time we -- for diagnostic and informational messages. At run-time we really do not
-- really do not want to waste the space for these image tables, and they are -- want to waste the space for these image tables, and they are not needed,
-- not needed, so we can do the instantiation under control of Discard_Names -- so we can do the instantiation under control of Discard_Names to remove
-- to remove the tables. -- the tables.
---------------------------------------------------
-- Note On Compile/Run-Time Consistency Checking --
---------------------------------------------------
-- This unit is with'ed by the run-time (to make System.Restrictions which is
-- used for run-time access to restriction information), by the compiler (to
-- determine what restrictions are implemented and what their category is) and
-- by the binder (in processing ali files, and generating the information used
-- at run-time to access restriction information).
-- Normally the version of System.Rident referenced in all three contexts
-- should be the same. However, problems could arise in certain inconsistent
-- builds that used inconsistent versions of the compiler and run-time. This
-- sort of thing is not strictly correct, but it does arise when short-cuts
-- are taken in build procedures.
-- Previously, this kind of inconsistency could cause a significant problem.
-- If versions of System.Rident accessed by the compiler and binder differed,
-- then the binder could fail to recognize the R (restrictions line) in the
-- ali file, leading to bind errors when restrictions were added or removed.
-- The latest implementation avoids both this problem by using a named
-- scheme for recording restrictions, rather than a positional scheme which
-- fails completely if restrictions are added or subtracted. Now the worst
-- that happens at bind time in incosistent builds is that unrecognized
-- restrictions are ignored, and the consistency checking for restrictions
-- might be incomplete, which is no big deal.
pragma Compiler_Unit; pragma Compiler_Unit;
......
...@@ -152,14 +152,16 @@ package SCOs is ...@@ -152,14 +152,16 @@ package SCOs is
-- o object declaration -- o object declaration
-- r renaming declaration -- r renaming declaration
-- i generic instantiation -- i generic instantiation
-- C CASE statement (from CASE through end of expression) -- A ACCEPT statement (from ACCEPT to end of parameter profile)
-- C CASE statement (from CASE to end of expression)
-- E EXIT statement -- E EXIT statement
-- F FOR loop (from FOR through end of iteration scheme) -- F FOR loop (from FOR to end of iteration scheme)
-- I IF statement (from IF through end of condition) -- I IF statement (from IF to end of condition)
-- P[name:] PRAGMA with the indicated name -- P[name:] PRAGMA with the indicated name
-- p[name:] disabled PRAGMA with the indicated name -- p[name:] disabled PRAGMA with the indicated name
-- R extended RETURN statement -- R extended RETURN statement
-- W WHILE loop statement (from WHILE through end of condition) -- S SELECT statement
-- W WHILE loop statement (from WHILE to end of condition)
-- Note: for I and W, condition above is in the RM syntax sense (this -- Note: for I and W, condition above is in the RM syntax sense (this
-- condition is a decision in SCO terminology). -- condition is a decision in SCO terminology).
......
...@@ -6254,7 +6254,7 @@ package body Sem_Prag is ...@@ -6254,7 +6254,7 @@ package body Sem_Prag is
-- Set Detect_Blocking mode -- Set Detect_Blocking mode
-- Set required restrictions (see Rident for detailed list) -- Set required restrictions (see System.Rident for detailed list)
-- Set the No_Dependence rules -- Set the No_Dependence rules
-- No_Dependence => Ada.Asynchronous_Task_Control -- No_Dependence => Ada.Asynchronous_Task_Control
......
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