aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/styleg.adb
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2007-08-14 10:36:48 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2007-08-14 10:36:48 +0200
commit835d23b2e08bb08e88163700eac0dc08442b2b0b (patch)
tree05b5ae79d8bf769dcfc728d032c9a64d115ddfeb /gcc/ada/styleg.adb
parent4a9b6b95df593226fd81c8d2a828e130b9d9a660 (diff)
downloadgcc-835d23b2e08bb08e88163700eac0dc08442b2b0b.zip
gcc-835d23b2e08bb08e88163700eac0dc08442b2b0b.tar.gz
gcc-835d23b2e08bb08e88163700eac0dc08442b2b0b.tar.bz2
uintp.adb, [...]: Minor reformatting.
2007-08-14 Robert Dewar <dewar@adacore.com> * uintp.adb, a-ztedit.adb, s-wchcon.adb, xnmake.adb, s-wchcon.adb, par-ch5.adb, par-ch10.adb, get_targ.adb, a-wtedit.adb, a-teioed.adb, s-osinte-solaris.adb, s-osinte-solaris.ads, s-osinte-freebsd.ads, s-osinte-freebsd.adb: Minor reformatting. * styleg.adb, styleg.ads, stylesw.adb, stylesw.ads: implement style switch -gnatyS. Enable -gnatyS in GNAT style check mode From-SVN: r127409
Diffstat (limited to 'gcc/ada/styleg.adb')
-rw-r--r--gcc/ada/styleg.adb82
1 files changed, 81 insertions, 1 deletions
diff --git a/gcc/ada/styleg.adb b/gcc/ada/styleg.adb
index 381b39d..fb8409b 100644
--- a/gcc/ada/styleg.adb
+++ b/gcc/ada/styleg.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2007, 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- --
@@ -63,7 +63,11 @@ package body Styleg is
-- Check that token is first token on line, or else is not preceded
-- by white space. Signal error of space not allowed if not.
+ procedure Check_Separate_Stmt_Lines_Cont;
+ -- Non-inlined continuation of Check_Separate_Stmt_Lines
+
function Determine_Token_Casing return Casing_Type;
+ -- Determine casing of current token
procedure Error_Space_Not_Allowed (S : Source_Ptr);
-- Posts an error message indicating that a space is not allowed
@@ -699,6 +703,82 @@ package body Styleg is
end if;
end Check_Semicolon;
+ -------------------------------
+ -- Check_Separate_Stmt_Lines --
+ -------------------------------
+
+ procedure Check_Separate_Stmt_Lines is
+ begin
+ if Style_Check_Separate_Stmt_Lines then
+ Check_Separate_Stmt_Lines_Cont;
+ end if;
+ end Check_Separate_Stmt_Lines;
+
+ ------------------------------------
+ -- Check_Separate_Stmt_Lines_Cont --
+ ------------------------------------
+
+ procedure Check_Separate_Stmt_Lines_Cont is
+ S : Source_Ptr;
+
+ begin
+ -- Skip past white space
+
+ S := Scan_Ptr;
+ while Is_White_Space (Source (S)) loop
+ S := S + 1;
+ end loop;
+
+ -- Line terminator is OK
+
+ if Source (S) in Line_Terminator then
+ return;
+
+ -- Comment is OK
+
+ elsif Source (S) = '-' and then Source (S + 1) = '-' then
+ return;
+
+ -- ABORT keyword is OK after THEN (THEN ABORT case)
+
+ elsif Token = Tok_Then
+ and then (Source (S + 0) = 'a' or else Source (S + 0) = 'A')
+ and then (Source (S + 1) = 'b' or else Source (S + 1) = 'B')
+ and then (Source (S + 2) = 'o' or else Source (S + 2) = 'O')
+ and then (Source (S + 3) = 'r' or else Source (S + 3) = 'R')
+ and then (Source (S + 4) = 't' or else Source (S + 4) = 'T')
+ and then (Source (S + 5) in Line_Terminator
+ or else Is_White_Space (Source (S + 5)))
+ then
+ return;
+
+ -- PRAGMA keyword is OK after ELSE
+
+ elsif Token = Tok_Else
+ and then (Source (S + 0) = 'p' or else Source (S + 0) = 'P')
+ and then (Source (S + 1) = 'r' or else Source (S + 1) = 'R')
+ and then (Source (S + 2) = 'a' or else Source (S + 2) = 'A')
+ and then (Source (S + 3) = 'g' or else Source (S + 3) = 'G')
+ and then (Source (S + 4) = 'm' or else Source (S + 4) = 'M')
+ and then (Source (S + 5) = 'a' or else Source (S + 5) = 'A')
+ and then (Source (S + 6) in Line_Terminator
+ or else Is_White_Space (Source (S + 6)))
+ then
+ return;
+
+ -- Otherwise we have the style violation we are looking for
+
+ else
+ if Token = Tok_Then then
+ Error_Msg
+ ("(style) no statements may follow THEN on same line", S);
+ else
+ Error_Msg
+ ("(style) no statements may follow ELSE on same line", S);
+ end if;
+ end if;
+ end Check_Separate_Stmt_Lines_Cont;
+
----------------
-- Check_Then --
----------------