diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-02-15 09:42:14 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-02-15 09:42:14 +0000 |
commit | 6027d4d3b80705b1f62796c6c4700727d97219df (patch) | |
tree | c0f35748ab8bd75b10c0580a6d26f4e1d3b5743f /gcc/ada | |
parent | 46a6512843d081c846154b512ecd3a67e2b29204 (diff) | |
download | gcc-6027d4d3b80705b1f62796c6c4700727d97219df.tar.gz |
2006-02-13 Javier Miranda <miranda@adacore.com>
PR ada/23973
* par-ch3.adb (P_Derived_Type_Def_Or_Private_Ext_Decl): Reorganize the
code to improve the error message reported when the program has
declarations of abstract interface types and it is not compiled with
the -gnat05 switch.
(P_Access_Definition): Reorganize the code to improve the error
message reported when the new Ada 2005 syntax for anonymous
access types is used and the program is not compiled with the
-gnat05 switch.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111080 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/par-ch3.adb | 71 |
1 files changed, 42 insertions, 29 deletions
diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb index 037b4e6439d..14432ac1b01 100644 --- a/gcc/ada/par-ch3.adb +++ b/gcc/ada/par-ch3.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2006, 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- -- @@ -1788,7 +1788,17 @@ package body Ch3 is begin Typedef_Node := New_Node (N_Derived_Type_Definition, Token_Ptr); - T_New; + + if Ada_Version < Ada_05 + and then Token = Tok_Identifier + and then Token_Name = Name_Interface + then + Error_Msg_SP + ("abstract interface is an Ada 2005 extension"); + Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); + else + T_New; + end if; if Token = Tok_Abstract then Error_Msg_SC ("ABSTRACT must come before NEW, not after"); @@ -3779,44 +3789,47 @@ package body Ch3 is Def_Node := New_Node (N_Access_Definition, Token_Ptr); Scan; -- past ACCESS - -- Ada 2005 (AI-254/AI-231) + -- Ada 2005 (AI-254): Access_To_Subprogram_Definition - if Ada_Version >= Ada_05 then + if Token = Tok_Protected + or else Token = Tok_Procedure + or else Token = Tok_Function + then + if Ada_Version < Ada_05 then + Error_Msg_SP ("access-to-subprogram is an Ada 2005 extension"); + Error_Msg_SP ("\unit should be compiled with -gnat05 switch"); + end if; - -- Ada 2005 (AI-254): Access_To_Subprogram_Definition + Subp_Node := P_Access_Type_Definition (Header_Already_Parsed => True); + Set_Null_Exclusion_Present (Subp_Node, Null_Exclusion_Present); + Set_Access_To_Subprogram_Definition (Def_Node, Subp_Node); - if Token = Tok_Protected - or else Token = Tok_Procedure - or else Token = Tok_Function - then - Subp_Node := - P_Access_Type_Definition (Header_Already_Parsed => True); - Set_Null_Exclusion_Present (Subp_Node, Null_Exclusion_Present); - Set_Access_To_Subprogram_Definition (Def_Node, Subp_Node); + -- Ada 2005 (AI-231) + -- [NULL_EXCLUSION] access [GENERAL_ACCESS_MODIFIER] SUBTYPE_MARK - -- Ada 2005 (AI-231) - -- [NULL_EXCLUSION] access [GENERAL_ACCESS_MODIFIER] SUBTYPE_MARK + else + Set_Null_Exclusion_Present (Def_Node, Null_Exclusion_Present); - else - Set_Null_Exclusion_Present (Def_Node, Null_Exclusion_Present); + if Token = Tok_All then + if Ada_Version < Ada_05 then + Error_Msg_SP + ("access-all in this context is an Ada 2005 extension"); + Error_Msg_SP ("\unit should be compiled with -gnat05 switch"); + end if; - if Token = Tok_All then - Scan; -- past ALL - Set_All_Present (Def_Node); + Scan; -- past ALL + Set_All_Present (Def_Node); - elsif Token = Tok_Constant then - Scan; -- past CONSTANT - Set_Constant_Present (Def_Node); + elsif Token = Tok_Constant then + if Ada_Version < Ada_05 then + Error_Msg_SP ("access-to-constant is an Ada 2005 extension"); + Error_Msg_SP ("\unit should be compiled with -gnat05 switch"); end if; - Set_Subtype_Mark (Def_Node, P_Subtype_Mark); - No_Constraint; + Scan; -- past CONSTANT + Set_Constant_Present (Def_Node); end if; - -- Ada 95 - - else - Set_Null_Exclusion_Present (Def_Node, False); Set_Subtype_Mark (Def_Node, P_Subtype_Mark); No_Constraint; end if; |