From edb740aa72b882e6899897d454a5855b3155089a Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Thu, 9 Sep 2010 10:51:08 +0200 Subject: [PATCH] [multiple changes] 2010-09-09 Robert Dewar * par-ch4.adb (Box_Error): New procedure. 2010-09-09 Thomas Quinot * sem.adb: Minor reformatting. 2010-09-09 Pascal Obry * prj-env.adb: Style fix, use /and then/ and /or else/. * gnat_ugn.texi: Fix typos. From-SVN: r164053 --- gcc/ada/ChangeLog | 13 ++++++++++ gcc/ada/gnat_ugn.texi | 3 +-- gcc/ada/par-ch4.adb | 57 ++++++++++++++++++++++++++++++------------- gcc/ada/prj-env.adb | 6 ++--- gcc/ada/sem.adb | 2 +- 5 files changed, 58 insertions(+), 23 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 020746bf613..ae8b006d6ae 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,16 @@ +2010-09-09 Robert Dewar + + * par-ch4.adb (Box_Error): New procedure. + +2010-09-09 Thomas Quinot + + * sem.adb: Minor reformatting. + +2010-09-09 Pascal Obry + + * prj-env.adb: Style fix, use /and then/ and /or else/. + * gnat_ugn.texi: Fix typos. + 2010-09-03 Joseph Myers PR ada/45499 diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index e18baef53d5..480f391a4ef 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -27456,7 +27456,7 @@ end API; @noindent 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. (@pxref{Windows Calling Conventions}). @@ -28474,7 +28474,6 @@ The program is built with foreign tools and the DLL is built with @item The program is built with @code{GCC/GNAT} and the DLL is built with foreign tools. -@item @end enumerate @noindent diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb index 2b4e6215562..6de5e84aed9 100644 --- a/gcc/ada/par-ch4.adb +++ b/gcc/ada/par-ch4.adb @@ -1153,6 +1153,33 @@ package body Ch4 is Lparen_Sloc : Source_Ptr; 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 Lparen_Sloc := Token_Ptr; T_Left_Paren; @@ -1196,26 +1223,17 @@ package body Ch4 is end if; 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. + -- Scan expression, handling box appearing as positional argument - if Ada_Version >= Ada_05 and then Token = Tok_Box then - Error_Msg_SC ("(Ada 2005) box notation only allowed with " - & "named notation"); - Scan; -- past BOX - Aggregate_Node := New_Node (N_Aggregate, Lparen_Sloc); - return Aggregate_Node; + if Token = Tok_Box then + Box_Error; + else + Expr_Node := P_Expression_Or_Range_Attribute_If_OK; end if; - Expr_Node := P_Expression_Or_Range_Attribute_If_OK; - -- Extension aggregate case if Token = Tok_With then - if Nkind (Expr_Node) = N_Attribute_Reference and then Attribute_Name (Expr_Node) = Name_Range then @@ -1316,8 +1334,7 @@ package body Ch4 is "extension aggregate"); raise Error_Resync; - -- A range attribute can only appear as part of a discrete choice - -- list. + -- Range attribute can only appear as part of a discrete choice list elsif Nkind (Expr_Node) = N_Attribute_Reference and then Attribute_Name (Expr_Node) = Name_Range @@ -1386,11 +1403,17 @@ package body Ch4 is exit; end if; + -- Deal with misused box + + if Token = Tok_Box then + Box_Error; + -- Otherwise initiate for reentry to top of loop by scanning an -- initial expression, unless the first token is OTHERS. - if Token = Tok_Others then + elsif Token = Tok_Others then Expr_Node := Empty; + else Save_Scan_State (Scan_State); -- at start of expression Expr_Node := P_Expression_Or_Range_Attribute_If_OK; diff --git a/gcc/ada/prj-env.adb b/gcc/ada/prj-env.adb index 39bda01987e..7af52e8451a 100644 --- a/gcc/ada/prj-env.adb +++ b/gcc/ada/prj-env.adb @@ -6,7 +6,7 @@ -- -- -- 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 -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -1582,7 +1582,7 @@ package body Prj.Env is -- For the object path, we make a distinction depending on -- 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 Object_Path_Table.Init (Object_Paths); Process_Object_Dirs := True; @@ -1602,7 +1602,7 @@ package body Prj.Env is -- If there is something to do, set Seen to False for all projects, -- 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); end if; diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb index f18e5e68785..f5c7629b401 100644 --- a/gcc/ada/sem.adb +++ b/gcc/ada/sem.adb @@ -67,7 +67,7 @@ package body Sem is -- Controls debugging printouts for Walk_Library_Items 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 -- freezing of external references in generics. -- 2.30.2