aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/stylesw.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/stylesw.adb')
-rw-r--r--gcc/ada/stylesw.adb111
1 files changed, 82 insertions, 29 deletions
diff --git a/gcc/ada/stylesw.adb b/gcc/ada/stylesw.adb
index 30d5d43..8c2aa58 100644
--- a/gcc/ada/stylesw.adb
+++ b/gcc/ada/stylesw.adb
@@ -34,23 +34,24 @@ package body Stylesw is
procedure Reset_Style_Check_Options is
begin
- Style_Check_Indentation := 0;
- Style_Check_Attribute_Casing := False;
- Style_Check_Blanks_At_End := False;
- Style_Check_Comments := False;
- Style_Check_End_Labels := False;
- Style_Check_Form_Feeds := False;
- Style_Check_Horizontal_Tabs := False;
- Style_Check_If_Then_Layout := False;
- Style_Check_Keyword_Casing := False;
- Style_Check_Layout := False;
- Style_Check_Max_Line_Length := False;
- Style_Check_Pragma_Casing := False;
- Style_Check_References := False;
- Style_Check_Specs := False;
- Style_Check_Standard := False;
- Style_Check_Subprogram_Order := False;
- Style_Check_Tokens := False;
+ Style_Check_Indentation := 0;
+ Style_Check_Attribute_Casing := False;
+ Style_Check_Blanks_At_End := False;
+ Style_Check_Comments := False;
+ Style_Check_End_Labels := False;
+ Style_Check_Form_Feeds := False;
+ Style_Check_Horizontal_Tabs := False;
+ Style_Check_If_Then_Layout := False;
+ Style_Check_Keyword_Casing := False;
+ Style_Check_Layout := False;
+ Style_Check_Max_Line_Length := False;
+ Style_Check_Max_Nesting_Level := False;
+ Style_Check_Pragma_Casing := False;
+ Style_Check_References := False;
+ Style_Check_Specs := False;
+ Style_Check_Standard := False;
+ Style_Check_Subprogram_Order := False;
+ Style_Check_Tokens := False;
end Reset_Style_Check_Options;
------------------------------
@@ -59,11 +60,17 @@ package body Stylesw is
procedure Save_Style_Check_Options (Options : out Style_Check_Options) is
P : Natural := 0;
- J : Natural;
procedure Add (C : Character; S : Boolean);
-- Add given character C to string if switch S is true
+ procedure Add_Nat (N : Nat);
+ -- Add given natural number to string
+
+ ---------
+ -- Add --
+ ---------
+
procedure Add (C : Character; S : Boolean) is
begin
if S then
@@ -72,6 +79,20 @@ package body Stylesw is
end if;
end Add;
+ -------------
+ -- Add_Nat --
+ -------------
+
+ procedure Add_Nat (N : Nat) is
+ begin
+ if N > 9 then
+ Add_Nat (N / 10);
+ end if;
+
+ P := P + 1;
+ Options (P) := Character'Val (Character'Pos ('0') + N mod 10);
+ end Add_Nat;
+
-- Start of processing for Save_Style_Check_Options
begin
@@ -91,7 +112,6 @@ package body Stylesw is
Add ('i', Style_Check_If_Then_Layout);
Add ('k', Style_Check_Keyword_Casing);
Add ('l', Style_Check_Layout);
- Add ('m', Style_Check_Max_Line_Length);
Add ('n', Style_Check_Standard);
Add ('o', Style_Check_Subprogram_Order);
Add ('p', Style_Check_Pragma_Casing);
@@ -100,19 +120,23 @@ package body Stylesw is
Add ('t', Style_Check_Tokens);
if Style_Check_Max_Line_Length then
- P := Options'Last;
- J := Natural (Style_Max_Line_Length);
-
- loop
- Options (P) := Character'Val (J mod 10 + Character'Pos ('0'));
- P := P - 1;
- J := J / 10;
- exit when J = 0;
- end loop;
-
+ P := P + 1;
Options (P) := 'M';
+ Add_Nat (Style_Max_Line_Length);
end if;
+ if Style_Check_Max_Nesting_Level then
+ P := P + 1;
+ Options (P) := 'L';
+ Add_Nat (Style_Max_Nesting_Level);
+ end if;
+
+ pragma Assert (P <= Options'Last);
+
+ while P < Options'Last loop
+ P := P + 1;
+ Options (P) := ' ';
+ end loop;
end Save_Style_Check_Options;
-------------------------------------
@@ -186,6 +210,35 @@ package body Stylesw is
when 'l' =>
Style_Check_Layout := True;
+ when 'L' =>
+ Style_Max_Nesting_Level := 0;
+
+ if J > Options'Last
+ or else Options (J) not in '0' .. '9'
+ then
+ OK := False;
+ Err_Col := J;
+ return;
+ end if;
+
+ loop
+ Style_Max_Nesting_Level :=
+ Style_Max_Nesting_Level * 10 +
+ Character'Pos (Options (J)) - Character'Pos ('0');
+
+ if Style_Max_Nesting_Level > 999 then
+ OK := False;
+ Err_Col := J;
+ return;
+ end if;
+
+ J := J + 1;
+ exit when J > Options'Last
+ or else Options (J) not in '0' .. '9';
+ end loop;
+
+ Style_Check_Max_Nesting_Level := Style_Max_Nesting_Level /= 0;
+
when 'm' =>
Style_Check_Max_Line_Length := True;
Style_Max_Line_Length := 79;