summaryrefslogtreecommitdiff
path: root/gcc/ada/styleg.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-02-19 11:12:05 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-02-19 11:12:05 +0000
commitde178ec5ce5b5415a4cf538f7951e21c21fc4bda (patch)
tree4b251dd34ac027c2b9fc4f1c8b26a9994b34fbe3 /gcc/ada/styleg.adb
parent7491b41bd8c2cdf96ac251af9dd5b67f687f01eb (diff)
downloadgcc-de178ec5ce5b5415a4cf538f7951e21c21fc4bda.tar.gz
2014-02-19 Robert Dewar <dewar@adacore.com>
* par-ch6.adb (P_Return): For extended return, end column lines up with RETURN. * par.adb: Minor documentation clarification. 2014-02-19 Yannick Moy <moy@adacore.com> * sem_prag.adb (Check_Loop_Pragma_Placement): Add check that Loop_Invariant and Loop_Variant appear consecutively. * gnat_rm.texi Update documentation of Loop_Invariant and Loop_Variant pragmas. 2014-02-19 Robert Dewar <dewar@adacore.com> * debug.adb: Document -gnatd.X. * par-ch5.adb (P_If_Statement): Always check THEN, even if not first token (Check_Then_Column): Ditto. * styleg.adb (Check_Then): Allow THEN on line after IF. (Check_Then): Check THEN placement under control of -gnatd.X * styleg.ads (Check_Then): Now called even if THEN is not first token on line. * stylesw.ads (Style_Check_If_Then_Layout): Document new relaxed rules. * gnat_ugn.texi: For -gnatyi, THEN can now be on line after IF. 2014-02-19 Robert Dewar <dewar@adacore.com> * a-cfhama.adb, a-cfhase.adb, a-cforse.adb, a-cofove.adb, a-ngcefu.adb, a-teioed.adb, a-wtedit.adb, a-ztedit.adb, exp_ch5.adb, inline.adb, prj-pp.adb, prj-tree.adb, sem_ch12.adb, sem_ch8.adb, vms_conv.adb: Fix bad layout of IF statements git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207893 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/styleg.adb')
-rw-r--r--gcc/ada/styleg.adb23
1 files changed, 16 insertions, 7 deletions
diff --git a/gcc/ada/styleg.adb b/gcc/ada/styleg.adb
index 6e4a44207e6..67af2fcc58a 100644
--- a/gcc/ada/styleg.adb
+++ b/gcc/ada/styleg.adb
@@ -30,6 +30,7 @@
with Atree; use Atree;
with Casing; use Casing;
with Csets; use Csets;
+with Debug; use Debug;
with Einfo; use Einfo;
with Err_Vars; use Err_Vars;
with Opt; use Opt;
@@ -1005,17 +1006,25 @@ package body Styleg is
-- In check if then layout mode (-gnatyi), we expect a THEN keyword
-- to appear either on the same line as the IF, or on a separate line
- -- after multiple conditions. In any case, it may not appear on the
- -- line immediately following the line with the IF.
+ -- if the IF statement extends for more than one line.
procedure Check_Then (If_Loc : Source_Ptr) is
begin
if Style_Check_If_Then_Layout then
- if Get_Physical_Line_Number (Token_Ptr) =
- Get_Physical_Line_Number (If_Loc) + 1
- then
- Error_Msg_SC ("(style) misplaced THEN");
- end if;
+ declare
+ If_Line : constant Physical_Line_Number :=
+ Get_Physical_Line_Number (If_Loc);
+ Then_Line : constant Physical_Line_Number :=
+ Get_Physical_Line_Number (Token_Ptr);
+ begin
+ if If_Line = Then_Line then
+ null;
+ elsif Debug_Flag_Dot_XX
+ and then Token_Ptr /= First_Non_Blank_Location
+ then
+ Error_Msg_SC ("(style) misplaced THEN");
+ end if;
+ end;
end if;
end Check_Then;