diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-25 19:29:43 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-25 19:29:43 +0000 |
commit | 46dfcc3ee85a4a02abce4d45ee619f240c116af6 (patch) | |
tree | 6c3dc3d53cd17d62447673b81abbcfc69bacd2f3 /gcc/ada/par-prag.adb | |
parent | 2a8624373adc103f943e22e781c2d6fadb828eae (diff) | |
download | gcc-46dfcc3ee85a4a02abce4d45ee619f240c116af6.tar.gz |
2011-08-25 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 178073 using svnmerge.
2011-08-25 Basile Starynkevitch <basile@starynkevitch.net>
* gcc/melt-runtime.c (melt_linemap_compute_current_location): Use the
linemap_position_for_column function for GCC 4.7 when merging with
GCC trunk rev 178073.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@178087 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/par-prag.adb')
-rw-r--r-- | gcc/ada/par-prag.adb | 119 |
1 files changed, 58 insertions, 61 deletions
diff --git a/gcc/ada/par-prag.adb b/gcc/ada/par-prag.adb index 8ddd2209ad6..111dee19b7b 100644 --- a/gcc/ada/par-prag.adb +++ b/gcc/ada/par-prag.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2011, 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- -- @@ -89,11 +89,23 @@ function Prag (Pragma_Node : Node_Id; Semi : Source_Ptr) return Node_Id is procedure Process_Restrictions_Or_Restriction_Warnings; -- Common processing for Restrictions and Restriction_Warnings pragmas. - -- This routine only processes the case of No_Obsolescent_Features, - -- which is the only restriction that has syntactic effects. No general - -- error checking is done, since this will be done in Sem_Prag. The - -- other case processed is pragma Restrictions No_Dependence, since - -- otherwise this is done too late. + -- For the most part, restrictions need not be processed at parse time, + -- since they only affect semantic processing. This routine handles the + -- exceptions as follows + -- + -- No_Obsolescent_Features must be processed at parse time, since there + -- are some obsolescent features (e.g. character replacements) which are + -- handled at parse time. + -- + -- SPARK must be processed at parse time, since this restriction controls + -- whether the scanner recognizes a spark HIDE directive formatted as an + -- Ada comment (and generates a Tok_SPARK_Hide token for the directive). + -- + -- No_Dependence must be processed at parse time, since otherwise it gets + -- handled too late. + -- + -- Note that we don't need to do full error checking for badly formed cases + -- of restrictions, since these will be caught during semantic analysis. ---------- -- Arg1 -- @@ -224,11 +236,21 @@ function Prag (Pragma_Node : Node_Id; Semi : Source_Ptr) return Node_Id is if Id = No_Name and then Nkind (Expr) = N_Identifier - and then Get_Restriction_Id (Chars (Expr)) = No_Obsolescent_Features then - Set_Restriction (No_Obsolescent_Features, Pragma_Node); - Restriction_Warnings (No_Obsolescent_Features) := - Prag_Id = Pragma_Restriction_Warnings; + case Get_Restriction_Id (Chars (Expr)) is + when No_Obsolescent_Features => + Set_Restriction (No_Obsolescent_Features, Pragma_Node); + Restriction_Warnings (No_Obsolescent_Features) := + Prag_Id = Pragma_Restriction_Warnings; + + when SPARK => + Set_Restriction (SPARK, Pragma_Node); + Restriction_Warnings (SPARK) := + Prag_Id = Pragma_Restriction_Warnings; + + when others => + null; + end case; elsif Id = Name_No_Dependence then Set_Restriction_No_Dependence @@ -336,42 +358,16 @@ begin -- Debug -- ----------- - -- pragma Debug (PROCEDURE_CALL_STATEMENT); + -- pragma Debug ([boolean_EXPRESSION,] PROCEDURE_CALL_STATEMENT); - -- This has to be processed by the parser because of the very peculiar - -- form of the second parameter, which is syntactically from a formal - -- point of view a function call (since it must be an expression), but - -- semantically we treat it as a procedure call (which has exactly the - -- same syntactic form, so that's why we can get away with this!) - - when Pragma_Debug => Debug : declare - Expr : Node_Id; + when Pragma_Debug => + Check_No_Identifier (Arg1); - begin if Arg_Count = 2 then - Check_No_Identifier (Arg1); Check_No_Identifier (Arg2); - Expr := New_Copy (Expression (Arg2)); - else Check_Arg_Count (1); - Check_No_Identifier (Arg1); - Expr := New_Copy (Expression (Arg1)); - end if; - - if Nkind (Expr) /= N_Indexed_Component - and then Nkind (Expr) /= N_Function_Call - and then Nkind (Expr) /= N_Identifier - and then Nkind (Expr) /= N_Selected_Component - then - Error_Msg - ("argument of pragma% is not procedure call", Sloc (Expr)); - raise Error_Resync; - else - Set_Debug_Statement - (Pragma_Node, P_Statement_Name (Expr)); end if; - end Debug; ------------------------------- -- Extensions_Allowed (GNAT) -- @@ -439,37 +435,37 @@ begin List_Pragmas.Increment_Last; List_Pragmas.Table (List_Pragmas.Last) := (Page, Semi); - ------------------ - -- Restrictions -- - ------------------ + ------------------ + -- Restrictions -- + ------------------ - -- pragma Restrictions (RESTRICTION {, RESTRICTION}); + -- pragma Restrictions (RESTRICTION {, RESTRICTION}); - -- RESTRICTION ::= - -- restriction_IDENTIFIER - -- | restriction_parameter_IDENTIFIER => EXPRESSION + -- RESTRICTION ::= + -- restriction_IDENTIFIER + -- | restriction_parameter_IDENTIFIER => EXPRESSION - -- We process the case of No_Obsolescent_Features, since this has - -- a syntactic effect that we need to detect at parse time (the use - -- of replacement characters such as colon for pound sign). + -- We process the case of No_Obsolescent_Features, since this has + -- a syntactic effect that we need to detect at parse time (the use + -- of replacement characters such as colon for pound sign). - when Pragma_Restrictions => - Process_Restrictions_Or_Restriction_Warnings; + when Pragma_Restrictions => + Process_Restrictions_Or_Restriction_Warnings; - -------------------------- - -- Restriction_Warnings -- - -------------------------- + -------------------------- + -- Restriction_Warnings -- + -------------------------- - -- pragma Restriction_Warnings (RESTRICTION {, RESTRICTION}); + -- pragma Restriction_Warnings (RESTRICTION {, RESTRICTION}); - -- RESTRICTION ::= - -- restriction_IDENTIFIER - -- | restriction_parameter_IDENTIFIER => EXPRESSION + -- RESTRICTION ::= + -- restriction_IDENTIFIER + -- | restriction_parameter_IDENTIFIER => EXPRESSION - -- See above comment for pragma Restrictions + -- See above comment for pragma Restrictions - when Pragma_Restriction_Warnings => - Process_Restrictions_Or_Restriction_Warnings; + when Pragma_Restriction_Warnings => + Process_Restrictions_Or_Restriction_Warnings; ---------------------------------------------------------- -- Source_File_Name and Source_File_Name_Project (GNAT) -- @@ -1243,6 +1239,7 @@ begin Pragma_Task_Info | Pragma_Task_Name | Pragma_Task_Storage | + Pragma_Test_Case | Pragma_Thread_Local_Storage | Pragma_Time_Slice | Pragma_Title | |