Commit 890f1954 by Robert Dewar Committed by Arnaud Charlet

exp_attr.adb, [...]: Minor reformatting.

2014-06-13  Robert Dewar  <dewar@adacore.com>

	* exp_attr.adb, exp_ch9.adb, lib-writ.adb, g-comlin.adb: Minor
	reformatting.
	* sem_attr.adb: Minor code reformatting and simplification.
	* checks.adb: Fix minor typo.

From-SVN: r211622
parent 4de10025
2014-06-13 Robert Dewar <dewar@adacore.com>
* exp_attr.adb, exp_ch9.adb, lib-writ.adb, g-comlin.adb: Minor
reformatting.
* sem_attr.adb: Minor code reformatting and simplification.
* checks.adb: Fix minor typo.
2014-06-13 Emmanuel Briot <briot@adacore.com> 2014-06-13 Emmanuel Briot <briot@adacore.com>
* g-comlin.adb (Get_Argument): fix expansion * g-comlin.adb (Get_Argument): fix expansion
......
...@@ -762,7 +762,7 @@ package body Checks is ...@@ -762,7 +762,7 @@ package body Checks is
Analyze (First (Actions (N)), Suppress => All_Checks); Analyze (First (Actions (N)), Suppress => All_Checks);
-- If the address clause generates an alignment check and we are -- If the address clause generates an alignment check and we are
-- in ZPF or some restricted run-time, add a warning to explain -- in ZFP or some restricted run-time, add a warning to explain
-- the propagation warning that is generated by the check. -- the propagation warning that is generated by the check.
if Nkind (First (Actions (N))) = N_Raise_Program_Error if Nkind (First (Actions (N))) = N_Raise_Program_Error
......
...@@ -3976,9 +3976,7 @@ package body Exp_Attr is ...@@ -3976,9 +3976,7 @@ package body Exp_Attr is
-- 'Old appears will be checked or disabled according to the -- 'Old appears will be checked or disabled according to the
-- current policy in effect. -- current policy in effect.
if Nkind (Subp) = N_Pragma if Nkind (Subp) = N_Pragma and then not Is_Checked (Subp) then
and then not Is_Checked (Subp)
then
return; return;
end if; end if;
...@@ -4183,10 +4181,9 @@ package body Exp_Attr is ...@@ -4183,10 +4181,9 @@ package body Exp_Attr is
Analyze (N); Analyze (N);
return; return;
-- For elementary types, we call the W_xxx routine directly. -- For elementary types, we call the W_xxx routine directly. Note
-- Note that the effect of Write and Output is identical for -- that the effect of Write and Output is identical for the case
-- the case of an elementary type, since there are no -- of an elementary type (there are no discriminants or bounds).
-- discriminants or bounds.
elsif Is_Elementary_Type (U_Type) then elsif Is_Elementary_Type (U_Type) then
......
...@@ -402,6 +402,7 @@ package body GNAT.Command_Line is ...@@ -402,6 +402,7 @@ package body GNAT.Command_Line is
end if; end if;
if Parser.Current_Argument > Parser.Arg_Count then if Parser.Current_Argument > Parser.Arg_Count then
-- If this is the first time this function is called -- If this is the first time this function is called
if Parser.Current_Index = 1 then if Parser.Current_Index = 1 then
......
...@@ -1445,7 +1445,7 @@ package body Lib.Writ is ...@@ -1445,7 +1445,7 @@ package body Lib.Writ is
Write_Info_Str (Name_Buffer (1 .. Name_Len - 2)); Write_Info_Str (Name_Buffer (1 .. Name_Len - 2));
end if; end if;
-- If Source_Reference pragma used output information -- If Source_Reference pragma used, output information
if Num_SRef_Pragmas (Sind) > 0 then if Num_SRef_Pragmas (Sind) > 0 then
Write_Info_Char (' '); Write_Info_Char (' ');
......
...@@ -2409,12 +2409,6 @@ package body Sem_Attr is ...@@ -2409,12 +2409,6 @@ package body Sem_Attr is
end if; end if;
end if; end if;
-- Ada 2005 (AI-345): Ensure that the compiler gives exactly the current
-- output compiling in Ada 95 mode for the case of ambiguous prefixes.
-- Is this comment right??? What is "the current output"??? If this
-- is only about Ada 95 mode, why no test for Ada 95 at this point???
if Is_Overloaded (P) if Is_Overloaded (P)
and then Aname /= Name_Access and then Aname /= Name_Access
and then Aname /= Name_Address and then Aname /= Name_Address
...@@ -2422,7 +2416,7 @@ package body Sem_Attr is ...@@ -2422,7 +2416,7 @@ package body Sem_Attr is
and then Aname /= Name_Result and then Aname /= Name_Result
and then Aname /= Name_Unchecked_Access and then Aname /= Name_Unchecked_Access
then then
-- The prefix must be resolvble by itself, without reference to the -- The prefix must be resolvable by itself, without reference to the
-- attribute. One case that requires special handling is a prefix -- attribute. One case that requires special handling is a prefix
-- that is a function name, where one interpretation may be a -- that is a function name, where one interpretation may be a
-- parameterless call. Entry attributes are handled specially below. -- parameterless call. Entry attributes are handled specially below.
...@@ -2433,44 +2427,40 @@ package body Sem_Attr is ...@@ -2433,44 +2427,40 @@ package body Sem_Attr is
Check_Parameterless_Call (P); Check_Parameterless_Call (P);
end if; end if;
if Ada_Version < Ada_2005 then if Is_Overloaded (P) then
if Is_Overloaded (P) then
-- Ada 2005 (AI-345): Since protected and task types have
-- primitive entry wrappers, the attributes Count, Caller and
-- AST_Entry require a context check
if Nam_In (Aname, Name_Count, Name_Caller, Name_AST_Entry) then -- Ada 2005 (AI-345): Since protected and task types have
declare -- primitive entry wrappers, the attributes Count, Caller and
Count : Natural := 0; -- AST_Entry require a context check
I : Interp_Index;
It : Interp;
begin if Nam_In (Aname, Name_Count, Name_Caller, Name_AST_Entry) then
Get_First_Interp (P, I, It); declare
while Present (It.Nam) loop Count : Natural := 0;
if Comes_From_Source (It.Nam) then I : Interp_Index;
Count := Count + 1; It : Interp;
else
Remove_Interp (I);
end if;
Get_Next_Interp (I, It);
end loop;
if Count > 1 then begin
Error_Attr ("ambiguous prefix for % attribute", P); Get_First_Interp (P, I, It);
while Present (It.Nam) loop
if Comes_From_Source (It.Nam) then
Count := Count + 1;
else else
Set_Is_Overloaded (P, False); Remove_Interp (I);
end if; end if;
end;
else
Error_Attr ("ambiguous prefix for % attribute", P);
end if;
end if;
elsif Is_Overloaded (P) then Get_Next_Interp (I, It);
Error_Attr ("ambiguous prefix for % attribute", P); end loop;
if Count > 1 then
Error_Attr ("ambiguous prefix for % attribute", P);
else
Set_Is_Overloaded (P, False);
end if;
end;
else
Error_Attr ("ambiguous prefix for % attribute", P);
end if;
end if; end if;
end if; 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