aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/styleg.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2014-07-31 12:02:13 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2014-07-31 12:02:13 +0200
commitaa3efecdfbd42f3ec8dce3a3d85a0cc8f60e01ce (patch)
tree98d8ea606ed1b3f97b7d68b09f7679409a6515c0 /gcc/ada/styleg.adb
parentb7c874a77cff436d8730223b80ffa53d3dba05c3 (diff)
downloadgcc-aa3efecdfbd42f3ec8dce3a3d85a0cc8f60e01ce.zip
gcc-aa3efecdfbd42f3ec8dce3a3d85a0cc8f60e01ce.tar.gz
gcc-aa3efecdfbd42f3ec8dce3a3d85a0cc8f60e01ce.tar.bz2
[multiple changes]
2014-07-31 Robert Dewar <dewar@adacore.com> * 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 <miranda@adacore.com> * 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 <duff@adacore.com> * 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
Diffstat (limited to 'gcc/ada/styleg.adb')
-rw-r--r--gcc/ada/styleg.adb36
1 files changed, 31 insertions, 5 deletions
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;