From aa3efecdfbd42f3ec8dce3a3d85a0cc8f60e01ce Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Thu, 31 Jul 2014 12:02:13 +0200 Subject: [multiple changes] 2014-07-31 Robert Dewar * par-ch13.adb (Get_Aspect_Specifications): Set Inside_Depends. * par-ch2.adb (P_Pragma): Set Inside_Depends. * par-ch4.adb (P_Simple_Expression): Pass Inside_Depends to Check_Unary_Plus_Or_Minus. * scans.ads (Inside_Depends): New flag. * scng.adb (Scan): Pass Inside_Depends to Check_Arrow. * style.ads: Add Inside_Depends parameter to Check_Arrow Add Inside_Depends parameter to Check_Unary_Plus_Or_Minus. * styleg.adb (Check_Arrow): Handle Inside_Depends case. (Check_Unary_Plus_Or_Minus): Handle Inside_Depends case. * styleg.ads: Add Inside_Depends parameter to Check_Arrow Add. Inside_Depends parameter to Check_Unary_Plus_Or_Minus. 2014-07-31 Javier Miranda * s-vaflop.adb Move the body of function T_To_G before T_To_D. Required for frontend inlining. * inline.adb (Has_Excluded_Contract): New subprogram used to check if a subprogram inlined by the frontend has contracts which cannot be inlined. 2014-07-31 Bob Duff * s-traceb.adb, s-traceb-hpux.adb, s-traceb-mastop.adb: (Call_Chain): Add 1 to number of frames to skip, to account for the fact that there's one more frame on the stack. From-SVN: r213336 --- gcc/ada/styleg.adb | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'gcc/ada/styleg.adb') diff --git a/gcc/ada/styleg.adb b/gcc/ada/styleg.adb index c94759c..a421f25 100644 --- a/gcc/ada/styleg.adb +++ b/gcc/ada/styleg.adb @@ -126,13 +126,32 @@ package body Styleg is -- Check_Arrow -- ----------------- - -- In check tokens mode (-gnatys), arrow must be surrounded by spaces + -- In check tokens mode (-gnatys), arrow must be surrounded by spaces, + -- except that within the argument of a Depends macro the required format + -- is =>+ rather than => +). - procedure Check_Arrow is + procedure Check_Arrow (Inside_Depends : Boolean := False) is begin if Style_Check_Tokens then Require_Preceding_Space; - Require_Following_Space; + + if not Inside_Depends then + Require_Following_Space; + + -- Special handling for Inside_Depends + + else + if Source (Scan_Ptr) = ' ' + and then Source (Scan_Ptr + 1) = '+' + then + Error_Space_Not_Allowed (Scan_Ptr); + + elsif Source (Scan_Ptr) /= ' ' + and then Source (Scan_Ptr) /= '+' + then + Require_Following_Space; + end if; + end if; end if; end Check_Arrow; @@ -1032,10 +1051,17 @@ package body Styleg is -- In check token mode (-gnatyt), unary plus or minus must not be -- followed by a space. - procedure Check_Unary_Plus_Or_Minus is + -- Annoying exception: if we have the sequence =>+ within a Depends pragma + -- or aspect, then we insist on a space rather than forbidding it. + + procedure Check_Unary_Plus_Or_Minus (Inside_Depends : Boolean := False) is begin if Style_Check_Tokens then - Check_No_Space_After; + if not Inside_Depends then + Check_No_Space_After; + else + Require_Following_Space; + end if; end if; end Check_Unary_Plus_Or_Minus; -- cgit v1.1