Commit edb740aa by Arnaud Charlet

[multiple changes]

2010-09-09  Robert Dewar  <dewar@adacore.com>

	* par-ch4.adb (Box_Error): New procedure.

2010-09-09  Thomas Quinot  <quinot@adacore.com>

	* sem.adb: Minor reformatting.

2010-09-09  Pascal Obry  <obry@adacore.com>

	* prj-env.adb: Style fix, use /and then/ and /or else/.
	* gnat_ugn.texi: Fix typos.

From-SVN: r164053
parent 1a14a58c
2010-09-09 Robert Dewar <dewar@adacore.com>
* par-ch4.adb (Box_Error): New procedure.
2010-09-09 Thomas Quinot <quinot@adacore.com>
* sem.adb: Minor reformatting.
2010-09-09 Pascal Obry <obry@adacore.com>
* prj-env.adb: Style fix, use /and then/ and /or else/.
* gnat_ugn.texi: Fix typos.
2010-09-03 Joseph Myers <joseph@codesourcery.com> 2010-09-03 Joseph Myers <joseph@codesourcery.com>
PR ada/45499 PR ada/45499
......
...@@ -27456,7 +27456,7 @@ end API; ...@@ -27456,7 +27456,7 @@ end API;
@noindent @noindent
Note that a variable is Note that a variable is
@strong{always imported with a Stdcall convention}. A function @strong{always imported with a DLL convention}. A function
can have @code{C} or @code{Stdcall} convention. can have @code{C} or @code{Stdcall} convention.
(@pxref{Windows Calling Conventions}). (@pxref{Windows Calling Conventions}).
...@@ -28474,7 +28474,6 @@ The program is built with foreign tools and the DLL is built with ...@@ -28474,7 +28474,6 @@ The program is built with foreign tools and the DLL is built with
@item @item
The program is built with @code{GCC/GNAT} and the DLL is built with The program is built with @code{GCC/GNAT} and the DLL is built with
foreign tools. foreign tools.
@item
@end enumerate @end enumerate
@noindent @noindent
......
...@@ -1153,6 +1153,33 @@ package body Ch4 is ...@@ -1153,6 +1153,33 @@ package body Ch4 is
Lparen_Sloc : Source_Ptr; Lparen_Sloc : Source_Ptr;
Scan_State : Saved_Scan_State; Scan_State : Saved_Scan_State;
procedure Box_Error;
-- Called if <> is encountered as positional aggregate element. Issues
-- error message and sets Expr_Node to Error.
---------------
-- Box_Error --
---------------
procedure Box_Error is
begin
if Ada_Version < Ada_2005 then
Error_Msg_SC ("box in aggregate is an Ada 2005 extension");
end if;
-- Ada 2005 (AI-287): The box notation is allowed only with named
-- notation because positional notation might be error prone. For
-- example, in "(X, <>, Y, <>)", there is no type associated with
-- the boxes, so you might not be leaving out the components you
-- thought you were leaving out.
Error_Msg_SC ("(Ada 2005) box only allowed with named notation");
Scan; -- past box
Expr_Node := Error;
end Box_Error;
-- Start of processsing for P_Aggregate_Or_Paren_Expr
begin begin
Lparen_Sloc := Token_Ptr; Lparen_Sloc := Token_Ptr;
T_Left_Paren; T_Left_Paren;
...@@ -1196,26 +1223,17 @@ package body Ch4 is ...@@ -1196,26 +1223,17 @@ package body Ch4 is
end if; end if;
end if; end if;
-- Ada 2005 (AI-287): The box notation is allowed only with named -- Scan expression, handling box appearing as positional argument
-- notation because positional notation might be error prone. For
-- example, in "(X, <>, Y, <>)", there is no type associated with
-- the boxes, so you might not be leaving out the components you
-- thought you were leaving out.
if Ada_Version >= Ada_05 and then Token = Tok_Box then if Token = Tok_Box then
Error_Msg_SC ("(Ada 2005) box notation only allowed with " Box_Error;
& "named notation"); else
Scan; -- past BOX Expr_Node := P_Expression_Or_Range_Attribute_If_OK;
Aggregate_Node := New_Node (N_Aggregate, Lparen_Sloc);
return Aggregate_Node;
end if; end if;
Expr_Node := P_Expression_Or_Range_Attribute_If_OK;
-- Extension aggregate case -- Extension aggregate case
if Token = Tok_With then if Token = Tok_With then
if Nkind (Expr_Node) = N_Attribute_Reference if Nkind (Expr_Node) = N_Attribute_Reference
and then Attribute_Name (Expr_Node) = Name_Range and then Attribute_Name (Expr_Node) = Name_Range
then then
...@@ -1316,8 +1334,7 @@ package body Ch4 is ...@@ -1316,8 +1334,7 @@ package body Ch4 is
"extension aggregate"); "extension aggregate");
raise Error_Resync; raise Error_Resync;
-- A range attribute can only appear as part of a discrete choice -- Range attribute can only appear as part of a discrete choice list
-- list.
elsif Nkind (Expr_Node) = N_Attribute_Reference elsif Nkind (Expr_Node) = N_Attribute_Reference
and then Attribute_Name (Expr_Node) = Name_Range and then Attribute_Name (Expr_Node) = Name_Range
...@@ -1386,11 +1403,17 @@ package body Ch4 is ...@@ -1386,11 +1403,17 @@ package body Ch4 is
exit; exit;
end if; end if;
-- Deal with misused box
if Token = Tok_Box then
Box_Error;
-- Otherwise initiate for reentry to top of loop by scanning an -- Otherwise initiate for reentry to top of loop by scanning an
-- initial expression, unless the first token is OTHERS. -- initial expression, unless the first token is OTHERS.
if Token = Tok_Others then elsif Token = Tok_Others then
Expr_Node := Empty; Expr_Node := Empty;
else else
Save_Scan_State (Scan_State); -- at start of expression Save_Scan_State (Scan_State); -- at start of expression
Expr_Node := P_Expression_Or_Range_Attribute_If_OK; Expr_Node := P_Expression_Or_Range_Attribute_If_OK;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2001-2009, Free Software Foundation, Inc. -- -- Copyright (C) 2001-2010, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -1582,7 +1582,7 @@ package body Prj.Env is ...@@ -1582,7 +1582,7 @@ package body Prj.Env is
-- For the object path, we make a distinction depending on -- For the object path, we make a distinction depending on
-- Including_Libraries. -- Including_Libraries.
if Objects_Path and Including_Libraries then if Objects_Path and then Including_Libraries then
if Project.Objects_Path_File_With_Libs = No_Path then if Project.Objects_Path_File_With_Libs = No_Path then
Object_Path_Table.Init (Object_Paths); Object_Path_Table.Init (Object_Paths);
Process_Object_Dirs := True; Process_Object_Dirs := True;
...@@ -1602,7 +1602,7 @@ package body Prj.Env is ...@@ -1602,7 +1602,7 @@ package body Prj.Env is
-- If there is something to do, set Seen to False for all projects, -- If there is something to do, set Seen to False for all projects,
-- then call the recursive procedure Add for Project. -- then call the recursive procedure Add for Project.
if Process_Source_Dirs or Process_Object_Dirs then if Process_Source_Dirs or else Process_Object_Dirs then
For_All_Projects (Project, Dummy); For_All_Projects (Project, Dummy);
end if; end if;
......
...@@ -67,7 +67,7 @@ package body Sem is ...@@ -67,7 +67,7 @@ package body Sem is
-- Controls debugging printouts for Walk_Library_Items -- Controls debugging printouts for Walk_Library_Items
Outer_Generic_Scope : Entity_Id := Empty; Outer_Generic_Scope : Entity_Id := Empty;
-- Global reference to the outer scope that is generic. In a non- generic -- Global reference to the outer scope that is generic. In a non-generic
-- context, it is empty. At the moment, it is only used for avoiding -- context, it is empty. At the moment, it is only used for avoiding
-- freezing of external references in generics. -- freezing of external references in generics.
......
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