From 54bb89caeab2b2ce71f935e2f290fa1402942529 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 29 Jan 2013 15:17:44 +0100 Subject: [PATCH] [multiple changes] 2013-01-29 Robert Dewar * a-calend-vms.adb: Minor comment fix. 2013-01-29 Robert Dewar * mlib-utl.adb, gnatlink.adb: Avoid reference to ASCII.Back_Slash because of casing issues. * sem_util.ads: Minor comment fix. * style.adb (Check_Identifier): Set proper casing for entities in ASCII. * styleg.adb: Minor comment improvement. * stylesw.ads (Style_Check_Standard): Fix bad comments. 2013-01-29 Hristian Kirtchev * sem_prag.adb: Add the grammar for pragmas Abstract_State and Global. (Analyze_Pragma): Push the scope of the related subprogram and install its formals once before starting the analysis of the [moded] global list. 2013-01-29 Pascal Obry * prj-proc.adb (Process_Expression_Variable_Decl): Always handle relative paths in Project_Path as relative to the aggregate project location. Note that this was what was documented. 2013-01-29 Vincent Celier * gnatcmd.adb: For "gnat stub -P ...", do not check the naming scheme for Ada, when Ada is not a language for the project. From-SVN: r195539 --- gcc/ada/ChangeLog | 32 ++++++++++++++++++++++++++++++++ gcc/ada/a-calend-vms.adb | 2 +- gcc/ada/gnatcmd.adb | 6 ++++-- gcc/ada/gnatlink.adb | 7 ++++--- gcc/ada/mlib-utl.adb | 7 ++++--- gcc/ada/prj-proc.adb | 11 ++++++++--- gcc/ada/sem_prag.adb | 46 ++++++++++++++++++++++++++++++++++++---------- gcc/ada/sem_util.ads | 4 ++-- gcc/ada/style.adb | 30 ++++++++++++++++++++++++++---- gcc/ada/styleg.adb | 4 ++-- gcc/ada/stylesw.ads | 9 +++++---- 11 files changed, 124 insertions(+), 34 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 6985aad..c808420 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,35 @@ +2013-01-29 Robert Dewar + + * a-calend-vms.adb: Minor comment fix. + +2013-01-29 Robert Dewar + + * mlib-utl.adb, gnatlink.adb: Avoid reference to ASCII.Back_Slash + because of casing issues. + * sem_util.ads: Minor comment fix. + * style.adb (Check_Identifier): Set proper casing for entities + in ASCII. + * styleg.adb: Minor comment improvement. + * stylesw.ads (Style_Check_Standard): Fix bad comments. + +2013-01-29 Hristian Kirtchev + + * sem_prag.adb: Add the grammar for pragmas Abstract_State and Global. + (Analyze_Pragma): Push the scope of the related subprogram and install + its formals once before starting the analysis of the [moded] global + list. + +2013-01-29 Pascal Obry + + * prj-proc.adb (Process_Expression_Variable_Decl): Always handle + relative paths in Project_Path as relative to the aggregate + project location. Note that this was what was documented. + +2013-01-29 Vincent Celier + + * gnatcmd.adb: For "gnat stub -P ...", do not check the naming + scheme for Ada, when Ada is not a language for the project. + 2013-01-29 Ed Schonberg * sem_ch3.adb (Analyze_Subtype_Declaration): Inherit diff --git a/gcc/ada/a-calend-vms.adb b/gcc/ada/a-calend-vms.adb index 7c2b3a6..bb878cb 100644 --- a/gcc/ada/a-calend-vms.adb +++ b/gcc/ada/a-calend-vms.adb @@ -49,7 +49,7 @@ package body Ada.Calendar is -- on various targets, a system independent model is incorporated into -- Ada.Calendar. The idea behind the design is to encapsulate all target -- dependent machinery in a single package, thus providing a uniform - -- pragma Import to all existing and any potential children. + -- interface to all existing and potential children. -- package Ada.Calendar -- procedure Split (5 parameters) -------+ diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb index ce690e5..4581b2c 100644 --- a/gcc/ada/gnatcmd.adb +++ b/gcc/ada/gnatcmd.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1996-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2013, 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- -- @@ -2477,7 +2477,9 @@ begin -- the file name ends with the spec suffix, then indicate to -- gnatstub the name of the body file with a -o switch. - if not Is_Standard_GNAT_Naming (Lang.Config.Naming_Data) then + if Lang /= No_Language_Index + and then not Is_Standard_GNAT_Naming (Lang.Config.Naming_Data) + then if File_Index /= 0 then declare Spec : constant String := diff --git a/gcc/ada/gnatlink.adb b/gcc/ada/gnatlink.adb index f83a03e..87ad072 100644 --- a/gcc/ada/gnatlink.adb +++ b/gcc/ada/gnatlink.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1996-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2013, 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- -- @@ -903,7 +903,8 @@ procedure Gnatlink is -------------- procedure Write_RF (S : String) is - Success : Boolean := True; + Success : Boolean := True; + Back_Slash : constant Character := '\'; begin -- If a GNU response file is used, space and backslash need to be @@ -915,7 +916,7 @@ procedure Gnatlink is if Using_GNU_response_file then for J in S'Range loop if S (J) = ' ' or else S (J) = '\' then - if Write (Tname_FD, ASCII.BACK_SLASH'Address, 1) /= 1 then + if Write (Tname_FD, Back_Slash'Address, 1) /= 1 then Success := False; end if; end if; diff --git a/gcc/ada/mlib-utl.adb b/gcc/ada/mlib-utl.adb index edd6749..756add1 100644 --- a/gcc/ada/mlib-utl.adb +++ b/gcc/ada/mlib-utl.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2002-2012, AdaCore -- +-- Copyright (C) 2002-2013, AdaCore -- -- -- -- 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- -- @@ -396,7 +396,8 @@ package body MLib.Utl is -------------- procedure Write_RF (S : String) is - Success : Boolean := True; + Success : Boolean := True; + Back_Slash : constant Character := '\'; begin -- If a GNU response file is used, space and backslash need to be @@ -408,7 +409,7 @@ package body MLib.Utl is if Using_GNU_response_file then for J in S'Range loop if S (J) = ' ' or else S (J) = '\' then - if Write (Tname_FD, ASCII.BACK_SLASH'Address, 1) /= 1 then + if Write (Tname_FD, Back_Slash'Address, 1) /= 1 then Success := False; end if; end if; diff --git a/gcc/ada/prj-proc.adb b/gcc/ada/prj-proc.adb index dc745fe..e997d17 100644 --- a/gcc/ada/prj-proc.adb +++ b/gcc/ada/prj-proc.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2013, 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- -- @@ -2067,8 +2067,13 @@ package body Prj.Proc is while Val /= Nil_String loop Prj.Env.Add_Directories (Child_Env.Project_Path, - Get_Name_String - (Shared.String_Elements.Table (Val).Value)); + Normalize_Pathname + (Name => + Get_Name_String + (Shared.String_Elements.Table (Val).Value), + Directory => + Get_Name_String + (Project.Directory.Display_Name))); Val := Shared.String_Elements.Table (Val).Next; end loop; end; diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index d0c9661..5a935a5 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2013, 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- -- @@ -6646,7 +6646,22 @@ package body Sem_Prag is -- Abstract_State -- -------------------- - -- ??? no formal grammar available yet + -- pragma Abstract_State (ABSTRACT_STATE_LIST) + + -- ABSTRACT_STATE_LIST ::= + -- null + -- | STATE_NAME_WITH_PROPERTIES {, STATE_NAME_WITH_PROPERTIES} + + -- STATE_NAME_WITH_PROPERTIES ::= + -- STATE_NAME + -- | (STATE_NAME with PROPERTY_LIST) + + -- PROPERTY_LIST ::= PROPERTY {, PROPERTY} + -- PROPERTY ::= SIMPLE_PROPERTY + -- | NAME_VALUE_PROPERTY + -- SIMPLE_PROPERTY ::= IDENTIFIER + -- NAME_VALUE_PROPERTY ::= IDENTIFIER => EXPRESSION + -- STATE_NAME ::= DEFINING_IDENTIFIER when Pragma_Abstract_State => Abstract_State : declare Pack_Id : Entity_Id; @@ -9954,7 +9969,16 @@ package body Sem_Prag is -- Global -- ------------ - -- ??? no formal grammar pragma available yet + -- pragma Global (GLOBAL_SPECIFICATION) + + -- GLOBAL_SPECIFICATION ::= MODED_GLOBAL_LIST {, MODED_GLOBAL_LIST} + -- | GLOBAL_LIST + -- | null + -- MODED_GLOBAL_LIST ::= MODE_SELECTOR => GLOBAL_LIST + -- MODE_SELECTOR ::= Input | Output | In_Out | Contract_In + -- GLOBAL_LIST ::= GLOBAL_ITEM + -- | (GLOBAL_ITEM {, GLOBAL_ITEM}) + -- GLOBAL_ITEM ::= NAME when Pragma_Global => Global : declare Subp_Id : Entity_Id; @@ -10054,14 +10078,7 @@ package body Sem_Prag is return; end if; - -- Ensure that the formal parameters are visible when - -- processing an item. This falls out of the general rule - -- of aspects pertaining to subprogram declarations. - - Push_Scope (Subp_Id); - Install_Formals (Subp_Id); Analyze (Item); - Pop_Scope; if Is_Entity_Name (Item) then Id := Entity (Item); @@ -10302,7 +10319,16 @@ package body Sem_Prag is -- error messages. else + -- Ensure that the formal parameters are visible when + -- processing an item. This falls out of the general rule of + -- aspects pertaining to subprogram declarations. + + Push_Scope (Subp_Id); + Install_Formals (Subp_Id); + Analyze_Global_List (List); + + Pop_Scope; end if; end Global; diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index 7c8d803..d85e574 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2013, 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- -- @@ -1079,7 +1079,7 @@ package Sem_Util is -- scope that is not a block or a package). This is used when the -- sequential flow-of-control assumption is violated (occurrence of a -- label, head of a loop, or start of an exception handler). The effect of - -- the call is to clear the Constant_Value field (but we do not need to + -- the call is to clear the Current_Value field (but we do not need to -- clear the Is_True_Constant flag, since that only gets reset if there -- really is an assignment somewhere in the entity scope). This procedure -- also calls Kill_All_Checks, since this is a special case of needing to diff --git a/gcc/ada/style.adb b/gcc/ada/style.adb index fd86659..b07e223 100644 --- a/gcc/ada/style.adb +++ b/gcc/ada/style.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2013, 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- -- @@ -94,7 +94,9 @@ package body Style is ---------------------- -- In check references mode (-gnatyr), identifier uses must be cased - -- the same way as the corresponding identifier declaration. + -- the same way as the corresponding identifier declaration. If standard + -- references are checked (-gnatyn), then identifiers from Standard must + -- be cased as in the Reference Manual. procedure Check_Identifier (Ref : Node_Or_Entity_Id; @@ -197,10 +199,30 @@ package body Style is if Entity (Ref) = Standard_ASCII then Cas := All_Upper_Case; - -- Special names in ASCII are also all upper case + -- Special handling for names in package ASCII elsif Sdef = Standard_ASCII_Location then - Cas := All_Upper_Case; + declare + Nam : constant String := Get_Name_String (Chars (Def)); + + begin + -- Bar is mixed case + + if Nam = "bar" then + Cas := Mixed_Case; + + -- All names longer than 4 characters are mixed case + + elsif Nam'Length > 4 then + Cas := Mixed_Case; + + -- All names shorter than 4 characters (other than Bar, + -- which we already tested for specially) are Upper case. + + else + Cas := All_Upper_Case; + end if; + end; -- All other entities are in mixed case diff --git a/gcc/ada/styleg.adb b/gcc/ada/styleg.adb index b24c1c0..04634d1 100644 --- a/gcc/ada/styleg.adb +++ b/gcc/ada/styleg.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2013, 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- -- @@ -611,7 +611,7 @@ package body Styleg is -- Check_Indentation -- ----------------------- - -- In check indentation mode (-gnatyn for n a digit), a new statement or + -- In check indentation mode (-gnaty? for ? a digit), a new statement or -- declaration is required to start in a column that is a multiple of the -- indentation amount. diff --git a/gcc/ada/stylesw.ads b/gcc/ada/stylesw.ads index 26fa480..6de2064 100644 --- a/gcc/ada/stylesw.ads +++ b/gcc/ada/stylesw.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2013, 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- -- @@ -149,7 +149,7 @@ package Stylesw is -- is not allowed. Style_Check_Indentation : Column_Number range 0 .. 9 := 0; - -- This can be set non-zero by using the -gnatyn (n a digit) switch. If + -- This can be set non-zero by using the -gnaty? (? a digit) switch. If -- it is non-zero it activates indentation checking with the indicated -- indentation value. A value of zero turns off checking. The requirement -- is that any new statement, line comment, declaration or keyword such @@ -217,8 +217,9 @@ package Stylesw is Style_Check_Standard : Boolean := False; -- This can be set True by using the -gnatyn switch. If it is True, then - -- any references to names in Standard have to be in mixed case mode (e.g. - -- Integer, Boolean). + -- any references to names in Standard have to be cased in a manner that + -- is consistent with the Ada RM (usually Mixed case, as in Long_Integer) + -- but there are some exceptions (e.g. NUL, ASCII). Style_Check_Tokens : Boolean := False; -- This can be set True by using the -gnatyt switch. If it is True, then -- 2.7.4