begin
pragma Assert (not Restriction_Active (No_Dispatching_Calls));
- -- Null body is generated for interface types and non-concurrent
+ -- Null body is generated for interface types and nonconcurrent
-- tagged types.
if Is_Interface (Typ)
Minsiz : constant Uint := UI_From_Int (Minimum_Size (Typ));
begin
- if Known_RM_Size (Typ)
- and then RM_Size (Typ) /= Uint_0
- then
+ if Known_RM_Size (Typ) then
if RM_Size (Typ) < Minsiz then
Error_Msg_Uint_1 := RM_Size (Typ);
Error_Msg_Uint_2 := Minsiz;
-- Gen_IL.Fields, and delete all occurrences from Gen_IL.Gen.Gen_Entities.
-- If a field is not set, it is initialized by default to whatever value is
- -- represented by all-zero bits, with two exceptions: Elist fields default
- -- to No_Elist, and Uint fields default to Uint_0. In retrospect, it would
- -- have been better to use No_Uint instead of Uint_0.
+ -- represented by all-zero bits, with some exceptions. This means Flags are
+ -- initialized to False, Node_Ids and List_Ids are initialized to Empty,
+ -- and enumeration fields are initialized to 'First of the type (assuming
+ -- there is no representation clause).
+ --
+ -- Elists default to No_Elist.
+ --
+ -- Fields of type Uint (but not its subtypes) are initialized to No_Uint.
+ -- Fields of subtypes Valid_Uint, Unat, Upos, Nonzero_Uint, and Ureal have
+ -- no default; it is an error to call a getter before calling the setter.
+ -- Likewise, other types whose range does not include zero have no default
+ -- (see package Types for the ranges).
+ --
+ -- If a node is created by a function in Nmake, then the defaults are
+ -- different from what is specified above. The parameters of Make_...
+ -- functions can have defaults specified; see Create_Syntactic_Field.
procedure Create_Node_Union_Type
(T : Abstract_Node; Children : Type_Array);
function Rep_Value (Val : Node_Ref_Or_Val; D : Discrim_List) return Uint is
- function B (Val : Boolean) return Uint;
+ function B (Val : Boolean) return Ubool;
-- Returns Uint_0 for False, Uint_1 for True
function T (Val : Node_Ref_Or_Val) return Boolean;
-- B --
-------
- function B (Val : Boolean) return Uint is
+ function B (Val : Boolean) return Ubool is
begin
if Val then
return Uint_1;
-- this field is done only in -gnatR3 mode, and in other modes, the value
-- is set to Uint_Minus_1.
- subtype Node_Ref is Uint;
+ subtype Node_Ref is Unegative;
-- Subtype used for negative Uint values used to represent nodes
subtype Node_Ref_Or_Val is Uint;
- -- Subtype used for values that can either be a Node_Ref (negative)
- -- or a value (non-negative)
+ -- Subtype used for values that can be a Node_Ref (negative) or a value
+ -- (non-negative) or No_Uint.
type TCode is range 0 .. 27;
-- Type used on Ada side to represent DEFTREECODE values defined in
-- In the case of components, if the location of the component is static,
-- then all four fields (Component_Bit_Offset, Normalized_Position, Esize,
-- and Normalized_First_Bit) are set to appropriate values. In the case of
- -- a non-static component location, Component_Bit_Offset is not used and
+ -- a nonstatic component location, Component_Bit_Offset is not used and
-- is left set to Unknown. Normalized_Position and Normalized_First_Bit
-- are set appropriately.
goto Leave;
end;
- -- For non-concurrent types, transfer explicit primitives, but
+ -- For nonconcurrent types, transfer explicit primitives, but
-- omit those inherited from the parent of the private view
-- since they will be re-inherited later on.
if Ekind (S) = E_Void then
null;
- -- Set scope depth if not a non-concurrent type, and we have not yet set
+ -- Set scope depth if not a nonconcurrent type, and we have not yet set
-- the scope depth. This means that we have the first occurrence of the
-- scope, and this is where the depth is set.
------------------
function End_Location (N : Node_Id) return Source_Ptr is
- L : constant Uint := End_Span (N);
+ L : constant Valid_Uint := End_Span (N);
begin
- if No (L) then
- return No_Location;
- else
- return Source_Ptr (Int (Sloc (N)) + UI_To_Int (L));
- end if;
+ return Source_Ptr (Int (Sloc (N)) + UI_To_Int (L));
end End_Location;
--------------------
procedure Image_String (S : String) is
begin
- for X in S'Range loop
- Image_Char (S (X));
+ for X of S loop
+ Image_Char (X);
end loop;
end Image_String;
subtype Unat is Valid_Uint with Predicate => Unat >= Uint_0; -- natural
subtype Upos is Valid_Uint with Predicate => Upos >= Uint_1; -- positive
subtype Nonzero_Uint is Valid_Uint with Predicate => Nonzero_Uint /= Uint_0;
+ subtype Unegative is Valid_Uint with Predicate => Unegative < Uint_0;
subtype Ubool is Valid_Uint with Predicate => Ubool in Uint_0 | Uint_1;
subtype Opt_Ubool is Uint with
Predicate => No (Opt_Ubool) or else Opt_Ubool in Ubool;