summaryrefslogtreecommitdiff
path: root/gcc/ada/par-ch3.adb
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-21 22:01:24 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-21 22:01:24 +0000
commitffde65b31066f17eef243be882bb89a6e19370aa (patch)
treeea876d041c0a63eefccdac5416a8678e75da4cfc /gcc/ada/par-ch3.adb
parenta8c7acc4db08ce7c8ac3ddcb943f9219e2893792 (diff)
downloadgcc-ffde65b31066f17eef243be882bb89a6e19370aa.tar.gz
[.]
2015-01-21 Basile Starynkevitch <basile@starynkevitch.net> {{merged with trunk -i.e. GCC5.0 in stage4- using svn merge -r209216:219879 svn+ssh://bstarynk@gcc.gnu.org/svn/gcc/trunk but should probably have used svn merge -r209216:219879 ^/trunk we don't use svnmerge.py anymore since our svn is version 1.8.10 }} VERY UNSTABLE 2015-01-20 Basile Starynkevitch <basile@starynkevitch.net> Move previous topdir ChangeLog.MELT to ChangeLog.MELT.2008-2014 [contrib/] 2015-01-21 Basile Starynkevitch <basile@starynkevitch.net> * MELT-Plugin-Makefile: Able to make upgrade-melt as a plugin. Works for GCC 5.0. Remove GCC 4.7 old stuff. Move previous contrib/ChangeLog.MELT to ChangeLog.MELT.2008-2014 [gcc/] 2015-01-21 Basile Starynkevitch <basile@starynkevitch.net> {{merged with trunk -i.e. GCC5.0 in stage4- using svn merge -r209216:219879 svn+ssh://bstarynk@gcc.gnu.org/svn/gcc/trunk but should probably have used svn merge -r209216:219879 ^/trunk **@@@ UNSTABLE since libmelt-ana-gimple.melt not compiling, but translator painfully bootstrapping!!@@@@ }} * toplev.c: Merged manually by keeping MELT extra stuff. * toplev.h: Likewise. * gengtype.c: Add "melt-runtime.h" in list, but merged with trunk. * melt-runtime.h (MELT_VERSION_STRING): Bump to "1.2-pre-merged". (meltgc_walk_gimple_seq): Remove. (gt_ggc_mx_gimple_statement_d): Same for GCC 4.9 & 5.0 * melt-runtime.cc: Update copyright year. (ggc_alloc_cleared_melt_valuevector_st, melt_resize_scangcvect): Call ggc_internal_cleared_alloc. (melt_val2passflag): Skip TODO_verify_ssa, TODO_verify_flow, TODO_verify_stmts, TODO_verify_rtl_sharing for GCC 5.0. (meltgc_walkstmt_cb, meltgc_walktree_cb) (melt_tree_walk_frame_size, meltgc_walk_gimple_seq): Remove. (melt_gt_ggc_mx_gimple_seq_d): Call gt_ggc_mx_gimple_statement_base. * melt-build-script.tpl: Update copyright year. Don't symlink meltrunsup.h anymore. * melt-build-script.sh: Regenerate. * melt/warmelt-base.melt: Update copyright year. (valdesc_object, valdesc_mapobjects, valdesc_mapstrings) (valdesc_multiple, valdesc_closure, valdesc_routine, valdesc_hook) (valdesc_bucketlongs, valdesc_jsonobject, valdesc_string) (valdesc_strbuf, valdesc_pair, valdesc_list, valdesc_int) (valdesc_double, valdesc_mixint, valdesc_mixloc) (valdesc_mixbigint, valdesc_real, valdesc_special_data): Use ggc_internal_alloc & ggc_internal_cleared_alloc for GCC 5.0. (json_canonical_name): Use ISUPPER, ISALPHA, TOUPPER instead of their standard <ctype.h> lowercase macros. * melt/warmelt-modes.melt: Update copyright year. (generate_runtypesupport_forwcopy_fun): Emit both GCC 4.9 & 5.0 compatible code. * melt/libmelt-ana-base.melt: Update copyright year. * melt/libmelt-ana-gimple.melt: TO BE IMPROVED * melt/generated/*: Painfully regenerated several times thru GCC 4.9 MELT plugin. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@219975 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/par-ch3.adb')
-rw-r--r--gcc/ada/par-ch3.adb90
1 files changed, 76 insertions, 14 deletions
diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb
index e9524fa4de7..80c95a9c635 100644
--- a/gcc/ada/par-ch3.adb
+++ b/gcc/ada/par-ch3.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2014, 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- --
@@ -652,6 +652,10 @@ package body Ch3 is
Typedef_Node := P_Record_Definition;
Set_Limited_Present (Typedef_Node, True);
+ End_Labl := Make_Identifier (Token_Ptr, Chars (Ident_Node));
+ Set_Comes_From_Source (End_Labl, False);
+
+ Set_End_Label (Typedef_Node, End_Labl);
-- Ada 2005 (AI-251): LIMITED INTERFACE
@@ -1217,19 +1221,13 @@ package body Ch3 is
function P_Constraint_Opt return Node_Id is
begin
- if Token = Tok_Range
- or else Bad_Spelling_Of (Tok_Range)
- then
+ if Token = Tok_Range or else Bad_Spelling_Of (Tok_Range) then
return P_Range_Constraint;
- elsif Token = Tok_Digits
- or else Bad_Spelling_Of (Tok_Digits)
- then
+ elsif Token = Tok_Digits or else Bad_Spelling_Of (Tok_Digits) then
return P_Digits_Constraint;
- elsif Token = Tok_Delta
- or else Bad_Spelling_Of (Tok_Delta)
- then
+ elsif Token = Tok_Delta or else Bad_Spelling_Of (Tok_Delta) then
return P_Delta_Constraint;
elsif Token = Tok_Left_Paren then
@@ -1239,6 +1237,31 @@ package body Ch3 is
Ignore (Tok_In);
return P_Constraint_Opt;
+ -- One more possibility is e.g. 1 .. 10 (i.e. missing RANGE keyword)
+
+ elsif Token = Tok_Identifier or else
+ Token = Tok_Integer_Literal or else
+ Token = Tok_Real_Literal
+ then
+ declare
+ Scan_State : Saved_Scan_State;
+
+ begin
+ Save_Scan_State (Scan_State); -- at identifier or literal
+ Scan; -- past identifier or literal
+
+ if Token = Tok_Dot_Dot then
+ Restore_Scan_State (Scan_State);
+ Error_Msg_BC ("missing RANGE keyword");
+ return P_Range_Constraint;
+ else
+ Restore_Scan_State (Scan_State);
+ return Empty;
+ end if;
+ end;
+
+ -- Nothing worked, no constraint there
+
else
return Empty;
end if;
@@ -1835,7 +1858,26 @@ package body Ch3 is
end if;
Set_Defining_Identifier (Decl_Node, Idents (Ident));
- P_Aspect_Specifications (Decl_Node);
+ P_Aspect_Specifications (Decl_Node, Semicolon => False);
+
+ -- Allow initialization expression to follow aspects (note that in
+ -- this case P_Aspect_Specifications already issued an error msg).
+
+ if Token = Tok_Colon_Equal then
+ if Is_Non_Empty_List (Aspect_Specifications (Decl_Node)) then
+ Error_Msg
+ ("aspect specifications must come after initialization "
+ & "expression",
+ Sloc (First (Aspect_Specifications (Decl_Node))));
+ end if;
+
+ Set_Expression (Decl_Node, Init_Expr_Opt);
+ Set_Has_Init_Expression (Decl_Node);
+ end if;
+
+ -- Now scan out the semicolon, which we deferred above
+
+ T_Semicolon;
if List_OK then
if Ident < Num_Idents then
@@ -2033,7 +2075,9 @@ package body Ch3 is
-- RANGE_CONSTRAINT ::= range RANGE
- -- The caller has checked that the initial token is RANGE
+ -- The caller has checked that the initial token is RANGE or some
+ -- misspelling of it, or it may be absent completely (and a message
+ -- has already been issued).
-- Error recovery: cannot raise Error_Resync
@@ -2042,7 +2086,13 @@ package body Ch3 is
begin
Range_Node := New_Node (N_Range_Constraint, Token_Ptr);
- Scan; -- past RANGE
+
+ -- Skip range keyword if present
+
+ if Token = Tok_Range or else Bad_Spelling_Of (Tok_Range) then
+ Scan; -- past RANGE
+ end if;
+
Set_Range_Expression (Range_Node, P_Range);
return Range_Node;
end P_Range_Constraint;
@@ -3903,6 +3953,7 @@ package body Ch3 is
Access_Loc : constant Source_Ptr := Token_Ptr;
Prot_Flag : Boolean;
Not_Null_Present : Boolean := False;
+ Not_Null_Subtype : Boolean := False;
Type_Def_Node : Node_Id;
Result_Not_Null : Boolean;
Result_Node : Node_Id;
@@ -3937,8 +3988,18 @@ package body Ch3 is
begin
if not Header_Already_Parsed then
- Not_Null_Present := P_Null_Exclusion; -- Ada 2005 (AI-231)
+
+ -- NOT NULL ACCESS .. is a common form of access definition.
+ -- ACCESS NOT NULL .. is certainly rare, but syntactically legal.
+ -- NOT NULL ACCESS NOT NULL .. is rarer yet, and also legal.
+ -- The last two cases are only meaningful if the following subtype
+ -- indication denotes an access type (semantic check). The flag
+ -- Not_Null_Subtype indicates that this second null exclusion is
+ -- present in the access type definition.
+
+ Not_Null_Present := P_Null_Exclusion; -- Ada 2005 (AI-231)
Scan; -- past ACCESS
+ Not_Null_Subtype := P_Null_Exclusion; -- Might also appear
end if;
if Token_Name = Name_Protected then
@@ -4013,6 +4074,7 @@ package body Ch3 is
Type_Def_Node :=
New_Node (N_Access_To_Object_Definition, Access_Loc);
Set_Null_Exclusion_Present (Type_Def_Node, Not_Null_Present);
+ Set_Null_Excluding_Subtype (Type_Def_Node, Not_Null_Subtype);
if Token = Tok_All or else Token = Tok_Constant then
if Ada_Version = Ada_83 then