+2017-10-09 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sem_elab.adb (Is_Suitable_Access): This scenario is now only relevant
+ in the static model.
+ (Is_Suitable_Variable_Assignment): This scenario is now only relevant
+ in the static model.
+ (Is_Suitable_Variable_Reference): This scenario is now only relevant in
+ the static model.
+
+2017-10-09 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Analyze_Declarations): In ASIS mode, resolve aspect
+ expressions when the enclosing scope is a subprogram body and the next
+ declaration is a body that freezes entities previously declared in the
+ scope.
+
+2017-10-09 Justin Squirek <squirek@adacore.com>
+
+ * sem_ch8.adb (Analyze_Use_Package): Remove checking of mixture between
+ ghost packages and living packages in use clauses.
+ (Use_One_Type, Note_Redundant_Use): Correct warning messages
+
+2017-10-09 Justin Squirek <squirek@adacore.com>
+
+ * osint.ads: Document new parameter FD for Read_Source_File.
+
2017-10-09 Ed Schonberg <schonberg@adacore.com>
* exp_util.adb (Make_Predicate_Call): If the type of the expression to
T : File_Type := Source);
-- Allocates a Source_Buffer of appropriate length and then reads the
-- entire contents of the source file N into the buffer. The address of
- -- the allocated buffer is returned in Src.
+ -- the allocated buffer is returned in Src. FD is used for extended error
+ -- information in the case the read fails.
--
-- Each line of text is terminated by one of the sequences:
--
-- failure to find the file is a fatal error, an error message is output,
-- and program execution is terminated. Otherwise (for the case of a
-- subsidiary source loaded directly or indirectly using with), a file
- -- not found condition causes null to be set as the result value.
+ -- not found condition causes null to be set as the result value and a
+ -- value of No_Source_File (0) to be set as the FD value. In the related
+ -- case of a file with no read permissions the result is the same except FD
+ -- is set to No_Access_To_Source_File (-1). Upon success FD is set to a
+ -- positive Source_File_Index.
--
-- Note that the name passed to this function is the simple file name,
-- without any directory information. The implementation is responsible
procedure Resolve_Aspects;
-- Utility to resolve the expressions of aspects at the end of a list of
- -- declarations.
+ -- declarations, or before a declaration that freezes previous entities,
+ -- such as in a subprogram body.
function Uses_Unseen_Priv (Pkg : Entity_Id) return Boolean;
-- Check if a nested package has entities within it that rely on library
if Nkind (Next_Decl) = N_Subprogram_Body then
Handle_Late_Controlled_Primitive (Next_Decl);
end if;
+
+ else
+ -- In ASIS mode, if the next declaration is a body, complete
+ -- the analysis of declarations so far.
+
+ Resolve_Aspects;
end if;
Adjust_Decl;
end if;
end if;
end if;
-
- -- Detect a mixture of Ghost packages and living packages within the
- -- same use_package_clause. Ideally one would split a use_package_clause
- -- with multiple names into multiple use_package_clauses with a single
- -- name, however clients of the front end would have to adapt to this
- -- change.
-
- if Present (Ghost_Id) and then Present (Living_Id) then
- Error_Msg_N
- ("use clause cannot mention ghost and non-ghost ghost units", N);
-
- Error_Msg_Sloc := Sloc (Ghost_Id);
- Error_Msg_NE ("\& # declared as ghost", N, Ghost_Id);
-
- Error_Msg_Sloc := Sloc (Living_Id);
- Error_Msg_NE ("\& # declared as non-ghost", N, Living_Id);
- end if;
-
- Mark_Ghost_Clause (N);
end Analyze_Use_Package;
----------------------
Error_Msg_Sloc := Sloc (Prev_Use);
Error_Msg_NE -- CODEFIX
- ("& is already use-visible through previous use clause #??",
+ ("& is already use-visible through previous use_clause #??",
Redundant, Pack_Name);
end if;
end Note_Redundant_Use;
else
Error_Msg_NE -- CODEFIX
("& is already use-visible through previous "
- & "use type clause??", Id, T);
+ & "use_type_clause??", Id, T);
end if;
end Use_Clause_Known;
else
Error_Msg_NE -- CODEFIX
("& is already use-visible through previous "
- & "use type clause??", Id, T);
+ & "use_type_clause??", Id, T);
end if;
-- The package where T is declared is already used
Subp_Id : Entity_Id;
begin
- if Nkind (N) /= N_Attribute_Reference then
+ -- This scenario is relevant only when the static model is in effect
+ -- because it is graph-dependent and does not involve any run-time
+ -- checks. Allowing it in the dynamic model would create confusing
+ -- noise.
+
+ if not Static_Elaboration_Checks then
+ return False;
+
+ -- Nothing to do when switch -gnatd.U (ignore 'Access) is in effect
+
+ elsif Debug_Flag_Dot_UU then
return False;
- -- Internally-generated attributes are assumed to be ABE safe
+ -- Nothing to do when the scenario is not an attribute reference
+
+ elsif Nkind (N) /= N_Attribute_Reference then
+ return False;
+
+ -- Nothing to do for internally-generated attributes because they are
+ -- assumed to be ABE safe.
elsif not Comes_From_Source (N) then
return False;
return
- -- This particular scenario is relevant only in the static model when
- -- switch -gnatd.U (ignore 'Access) is not in effect.
-
- Static_Elaboration_Checks
- and then not Debug_Flag_Dot_UU
+ -- The prefix must denote a source entry, operator, or subprogram
+ -- which is not imported.
- -- The prefix must denote an entry, operator, or subprogram which is
- -- not imported.
-
- and then Comes_From_Source (Subp_Id)
+ Comes_From_Source (Subp_Id)
and then Is_Subprogram_Or_Entry (Subp_Id)
and then not Is_Bodiless_Subprogram (Subp_Id)
Var_Unit_Id : Entity_Id;
begin
- if Nkind (N) /= N_Assignment_Statement then
+ -- This scenario is relevant only when the static model is in effect
+ -- because it is graph-dependent and does not involve any run-time
+ -- checks. Allowing it in the dynamic model would create confusing
+ -- noise.
+
+ if not Static_Elaboration_Checks then
return False;
- -- Internally-generated assigments are assumed to be ABE safe
+ -- Nothing to do when the scenario is not an assignment
+
+ elsif Nkind (N) /= N_Assignment_Statement then
+ return False;
+
+ -- Nothing to do for internally-generated assignments because they are
+ -- assumed to be ABE safe.
elsif not Comes_From_Source (N) then
return False;
-- To qualify, the assignment must meet the following prerequisites:
return
- Comes_From_Source (Var_Id)
- -- The variable must be susceptible to warnings
+ -- The variable must be a source entity and susceptible to warnings
+ Comes_From_Source (Var_Id)
and then not Has_Warnings_Off (Var_Id)
-- The variable must be declared in the spec of compilation unit U
-- Start of processing for Is_Suitable_Variable_Reference
begin
+ -- This scenario is relevant only when the static model is in effect
+ -- because it is graph-dependent and does not involve any run-time
+ -- checks. Allowing it in the dynamic model would create confusing
+ -- noise.
+
+ if not Static_Elaboration_Checks then
+ return False;
+
-- Attributes and operator sumbols are not considered to be suitable
-- references to variables even though they are part of predicate
-- Is_Entity_Name.
- if not Nkind_In (N, N_Expanded_Name, N_Identifier) then
+ elsif not Nkind_In (N, N_Expanded_Name, N_Identifier) then
return False;
- -- Internally generated references are assumed to be ABE safe
+ -- Nothing to do for internally-generated references because they are
+ -- assumed to be ABE safe.
elsif not Comes_From_Source (N) then
return False;