+2017-04-25 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sem_aggr.adb, inline.adb, einfo.adb, einfo.ads, scng.adb,
+ sem_prag.adb: Minor reformatting.
+
+2017-04-25 Bob Duff <duff@adacore.com>
+
+ * sem_attr.adb (Type_Key): Add code in the
+ recursive Compute_Type_Key to protect against fetching the source
+ code for Standard, in case a component of the type is declared
+ in Standard. There was already code to do this for the original
+ type, but not for its components.
+
2017-04-25 Javier Miranda <miranda@adacore.com>
* exp_ch3.adb (Build_Initialization_Call): Handle
end if;
W ("Address_Taken", Flag104 (Id));
- W ("Body_Needed_For_SAL", Flag40 (Id));
W ("Body_Needed_For_Inlining", Flag299 (Id));
+ W ("Body_Needed_For_SAL", Flag40 (Id));
W ("C_Pass_By_Copy", Flag125 (Id));
W ("Can_Never_Be_Null", Flag38 (Id));
W ("Checks_May_Be_Suppressed", Flag31 (Id));
-- Contract (Node34)
-- SPARK_Pragma (Node40)
-- SPARK_Aux_Pragma (Node41)
- -- Delay_Subprogram_Descriptors (Flag50)
-- Body_Needed_For_Inlining (Flag299)
-- Body_Needed_For_SAL (Flag40)
-- Contains_Ignored_Ghost_Code (Flag279)
+ -- Delay_Subprogram_Descriptors (Flag50)
-- Discard_Names (Flag88)
- -- Elaboration_Entity_Required (Flag174)
-- Elaborate_Body_Desirable (Flag210) (non-generic case only)
+ -- Elaboration_Entity_Required (Flag174)
-- From_Limited_With (Flag159)
-- Has_All_Calls_Remote (Flag79)
-- Has_Completion (Flag26)
if Present (Comp_Unit)
and then Comp_Unit /= Cunit (Main_Unit)
and then Body_Required (Comp_Unit)
- and then (Nkind (Unit (Comp_Unit)) /= N_Package_Declaration
- or else
- (No (Corresponding_Body (Unit (Comp_Unit)))
- and then Body_Needed_For_Inlining
- (Defining_Entity (Unit (Comp_Unit)))))
+ and then
+ (Nkind (Unit (Comp_Unit)) /= N_Package_Declaration
+ or else
+ (No (Corresponding_Body (Unit (Comp_Unit)))
+ and then Body_Needed_For_Inlining
+ (Defining_Entity (Unit (Comp_Unit)))))
then
declare
Bname : constant Unit_Name_Type :=
-- In Ada 2020, a target name (i.e. @) is a valid prefix of an
-- attribute, and functions like a name.
- if Prev_Token = Tok_Identifier
- or else Prev_Token = Tok_Right_Paren
- or else Prev_Token = Tok_All
- or else Prev_Token = Tok_Delta
- or else Prev_Token = Tok_Digits
- or else Prev_Token = Tok_Project
- or else Prev_Token = Tok_At_Sign
- or else Prev_Token in Token_Class_Literal
+ if Prev_Token = Tok_All
+ or else Prev_Token = Tok_At_Sign
+ or else Prev_Token = Tok_Delta
+ or else Prev_Token = Tok_Digits
+ or else Prev_Token = Tok_Identifier
+ or else Prev_Token = Tok_Project
+ or else Prev_Token = Tok_Right_Paren
+ or else Prev_Token in Token_Class_Literal
then
Token := Tok_Apostrophe;
else
Analyze (Choice);
- -- Choice can be a subtype name, a range, or an expression.
+ -- Choice can be a subtype name, a range, or an expression
if Is_Entity_Name (Choice)
and then Is_Type (Entity (Choice))
return;
end if;
+ -- If the type is declared in Standard, there is no source, so
+ -- just use its name.
+
+ if Scope (T) = Standard_Standard then
+ declare
+ Name : constant String := Get_Name_String (Chars (T));
+ begin
+ for J in Name'Range loop
+ System.CRC32.Update (CRC, Name (J));
+ end loop;
+ end;
+
+ return;
+ end if;
+
Sloc_Range (Enclosing_Declaration (T), P_Min, P_Max);
SFI := Get_Source_File_Index (P_Min);
Buffer := Source_Text (SFI);
Store_String_Char (Get_String_Char (Full_Name, Pos (J)));
end loop;
- -- For standard types return the name of the type, as there is no
- -- explicit source declaration to use. Otherwise compute CRC and
- -- convert it to string one character at a time, so as not to use
- -- Image within the compiler.
+ -- Compute CRC and convert it to string one character at a time, so
+ -- as not to use Image within the compiler.
- if Scope (Entity (P)) /= Standard_Standard then
- Initialize (CRC);
- Compute_Type_Key (Entity (P));
-
- if not Is_Frozen (Entity (P)) then
- Error_Msg_N ("premature usage of Type_Key?", N);
- end if;
+ Initialize (CRC);
+ Compute_Type_Key (Entity (P));
- while CRC > 0 loop
- Store_String_Char (Character'Val (48 + (CRC rem 10)));
- CRC := CRC / 10;
- end loop;
+ if not Is_Frozen (Entity (P)) then
+ Error_Msg_N ("premature usage of Type_Key?", N);
end if;
+ while CRC > 0 loop
+ Store_String_Char (Character'Val (48 + (CRC rem 10)));
+ CRC := CRC / 10;
+ end loop;
+
Rewrite (N, Make_String_Literal (Loc, End_String));
Analyze_And_Resolve (N, Standard_String);
end Type_Key;
-- body. (this may be further refined).
if not In_Instance
- and then Nkind (Unit (Cunit (Current_Sem_Unit)))
- = N_Package_Declaration
+ and then Nkind (Unit (Cunit (Current_Sem_Unit))) =
+ N_Package_Declaration
then
Set_Body_Needed_For_Inlining (Cunit_Entity (Current_Sem_Unit));
end if;