Commit 3ccedacc by Arnaud Charlet

[multiple changes]

2014-08-04  Robert Dewar  <dewar@adacore.com>

	* sem_ch6.adb: Minor reformatting.

2014-08-04  Ed Schonberg  <schonberg@adacore.com>

	* sem_prag.adb (Analyze_Pragma, case Assert and related pragmas):
	Before normalizing these pragmas into a pragma Check, preanalyze
	the optional Message argument, (which is subsequently copied)
	so that it has the proper semantic information for ASIS use.
	* sem_case.adb: Initialize flag earlier.
	* osint.adb, osint.ads (Find_File): Add parameter Full_Name, used when
	the full source path of a configuration file is requested.
	(Read_Source_File): Use Full_Name parameter..

From-SVN: r213571
parent f3124d8f
2014-08-04 Robert Dewar <dewar@adacore.com>
* sem_ch6.adb: Minor reformatting.
2014-08-04 Ed Schonberg <schonberg@adacore.com>
* sem_prag.adb (Analyze_Pragma, case Assert and related pragmas):
Before normalizing these pragmas into a pragma Check, preanalyze
the optional Message argument, (which is subsequently copied)
so that it has the proper semantic information for ASIS use.
* sem_case.adb: Initialize flag earlier.
* osint.adb, osint.ads (Find_File): Add parameter Full_Name, used when
the full source path of a configuration file is requested.
(Read_Source_File): Use Full_Name parameter..
2014-08-04 Hristian Kirtchev <kirtchev@adacore.com>
* opt.ads Alphabetize various global flags. New flag
......
......@@ -122,7 +122,8 @@ package body Osint is
(N : File_Name_Type;
T : File_Type;
Found : out File_Name_Type;
Attr : access File_Attributes);
Attr : access File_Attributes;
Full_Name : Boolean := False);
-- A version of Find_File that also returns a cache of the file attributes
-- for later reuse
......@@ -1154,12 +1155,13 @@ package body Osint is
function Find_File
(N : File_Name_Type;
T : File_Type) return File_Name_Type
T : File_Type;
Full_Name : Boolean := False) return File_Name_Type
is
Attr : aliased File_Attributes;
Found : File_Name_Type;
begin
Find_File (N, T, Found, Attr'Access);
Find_File (N, T, Found, Attr'Access, Full_Name);
return Found;
end Find_File;
......@@ -1171,7 +1173,8 @@ package body Osint is
(N : File_Name_Type;
T : File_Type;
Found : out File_Name_Type;
Attr : access File_Attributes) is
Attr : access File_Attributes;
Full_Name : Boolean := False) is
begin
Get_Name_String (N);
......@@ -1193,6 +1196,20 @@ package body Osint is
then
Found := N;
Attr.all := Unknown_Attributes;
if T = Config and then Full_Name then
declare
Full_Path : constant String :=
Normalize_Pathname (Get_Name_String (N));
Full_Size : constant Natural := Full_Path'Length;
begin
Name_Buffer (1 .. Full_Size) := Full_Path;
Name_Len := Full_Size;
Found := Name_Find;
end;
end if;
return;
-- If we are trying to find the current main file just look in the
......@@ -2591,7 +2608,7 @@ package body Osint is
-- For the call to Close
begin
Current_Full_Source_Name := Find_File (N, T);
Current_Full_Source_Name := Find_File (N, T, Full_Name => True);
Current_Full_Source_Stamp := File_Stamp (Current_Full_Source_Name);
if Current_Full_Source_Name = No_File then
......
......@@ -64,7 +64,8 @@ package Osint is
function Find_File
(N : File_Name_Type;
T : File_Type) return File_Name_Type;
T : File_Type;
Full_Name : Boolean := False) return File_Name_Type;
-- Finds a source, library or config file depending on the value of T
-- following the directory search order rules unless N is the name of the
-- file just read with Next_Main_File and already contains directory
......@@ -76,6 +77,9 @@ package Osint is
-- set and the file name ends in ".dg", in which case we look for the
-- generated file only in the current directory, since that is where it is
-- always built.
-- In the case of configuration files, full path names are needed for some
-- ASIS queries. The flag Full_Name indicates that the name of the file
-- should be normalized to include a full path.
function Get_File_Names_Case_Sensitive return Int;
pragma Import (C, Get_File_Names_Case_Sensitive,
......
......@@ -735,6 +735,8 @@ package body Sem_Case is
return;
end if;
Predicate_Error := False;
-- Choice_Table must start at 0 which is an unused location used by the
-- sorting algorithm. However the first valid position for a discrete
-- choice is 1.
......@@ -762,8 +764,6 @@ package body Sem_Case is
-- expression is static, independently of whether the aspect mentions
-- Static explicitly.
Predicate_Error := False;
if Has_Predicate then
Pred := First (Static_Discrete_Predicate (Bounds_Type));
Prev_Lo := Uint_Minus_1;
......
......@@ -11010,6 +11010,11 @@ package body Sem_Prag is
if Arg_Count > 1 then
Check_Optional_Identifier (Arg2, Name_Message);
-- Provide semantic annnotations for optional argument, for
-- ASIS use, before rewriting.
Preanalyze_And_Resolve (Expression (Arg2), Standard_String);
Append_To (Newa, New_Copy_Tree (Arg2));
end if;
......@@ -19319,7 +19324,6 @@ package body Sem_Prag is
else
Spec_Id := Defining_Entity (Unit (Context));
Inst_Id := Related_Instance (Spec_Id);
Check_Library_Level_Entity (Spec_Id);
Check_Pragma_Conformance
(Context_Pragma => SPARK_Mode_Pragma,
......@@ -19329,7 +19333,10 @@ package body Sem_Prag is
Set_SPARK_Pragma (Spec_Id, N);
Set_SPARK_Pragma_Inherited (Spec_Id, False);
if Present (Inst_Id) then
if Ekind (Spec_Id) = E_Package
and then Present (Related_Instance (Spec_Id))
then
Inst_Id := Related_Instance (Spec_Id);
Set_SPARK_Pragma (Inst_Id, N);
Set_SPARK_Pragma_Inherited (Inst_Id, False);
end if;
......
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