-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2006, 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- --
if Token = Tok_In then
Scan; -- past IN
Set_In_Present (Node, True);
+
+ if Style.Mode_In_Check and then Token /= Tok_Out then
+ Error_Msg_SP ("(style) IN should be omitted");
+ end if;
end if;
if Token = Tok_Out then
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2006, 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- --
------------------------------------------------------------------------------
-- This package collects all the routines used for style checking, as
--- activated by the relevant command line option. These are gathered in
--- a separate package so that they can more easily be customized. Calls
--- to these subprograms are only made if Opt.Style_Check is set True.
+-- activated by the relevant command line option. These are gathered in a
+-- separate package so that they can more easily be customized. Calls to
+-- these subprograms are only made if Opt.Style_Check is set True.
with Errout;
with Styleg;
with Styleg.C;
-with Types; use Types;
+with Types; use Types;
package Style is
procedure Check_Attribute_Name (Reserved : Boolean)
renames Style_Inst.Check_Attribute_Name;
- -- The current token is an attribute designator. Check that it
- -- is capitalized in an appropriate manner. Reserved is set if
- -- the attribute designator is a reserved word (access, digits,
- -- delta or range) to allow differing rules for the two cases.
+ -- The current token is an attribute designator. Check that it is
+ -- capitalized in an appropriate manner. Reserved is set if the attribute
+ -- designator is a reserved word (access, digits, delta or range) to allow
+ -- differing rules for the two cases.
procedure Check_Box
renames Style_Inst.Check_Box;
procedure Check_Left_Paren
renames Style_Inst.Check_Left_Paren;
- -- Called after scanning out a left parenthesis to check spacing.
+ -- Called after scanning out a left parenthesis to check spacing
procedure Check_Line_Terminator (Len : Int)
renames Style_Inst.Check_Line_Terminator;
-- Called with Scan_Ptr pointing to the first line terminator terminating
- -- the current line, used to check for appropriate line terminator and
- -- to check the line length (Len is the length of the current line).
- -- Note that the terminator may be the EOF character.
+ -- the current line, used to check for appropriate line terminator and to
+ -- check the line length (Len is the length of the current line). Note that
+ -- the terminator may be the EOF character.
procedure Check_Pragma_Name
renames Style_Inst.Check_Pragma_Name;
procedure Check_Right_Paren
renames Style_Inst.Check_Right_Paren;
- -- Called after scanning out a right parenthesis to check spacing.
+ -- Called after scanning out a right parenthesis to check spacing
procedure Check_Semicolon
renames Style_Inst.Check_Semicolon;
-- Called after scanning a conditional expression that has at least one
-- level of parentheses around the entire expression.
+ function Mode_In_Check return Boolean
+ renames Style_Inst.Mode_In_Check;
+ -- Determines whether style checking is active and the Mode_In_Check is
+ -- set, forbidding the explicit use of mode IN.
+
procedure No_End_Name (Name : Node_Id)
renames Style_Inst.No_End_Name;
-- Called if an END is encountered where a name is allowed but not present.
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2006, 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- --
return C = ' ' or else C = HT;
end Is_White_Space;
+ -------------------
+ -- Mode_In_Check --
+ -------------------
+
+ function Mode_In_Check return Boolean is
+ begin
+ return Style_Check and Style_Check_Mode_In;
+ end Mode_In_Check;
+
-----------------
-- No_End_Name --
-----------------
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2006, 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- --
-- Called after scanning a conditional expression that has at least one
-- level of parentheses around the entire expression.
+ function Mode_In_Check return Boolean;
+ pragma Inline (Mode_In_Check);
+ -- Determines whether style checking is active and the Mode_In_Check is
+ -- set, forbidding the explicit use of mode IN.
+
procedure No_End_Name (Name : Node_Id);
-- Called if an END is encountered where a name is allowed but not present.
-- The parameter is the node whose name is the name that is permitted in
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2006, 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- --
Style_Check_Layout := False;
Style_Check_Max_Line_Length := False;
Style_Check_Max_Nesting_Level := False;
+ Style_Check_Mode_In := False;
Style_Check_Order_Subprograms := False;
Style_Check_Pragma_Casing := False;
Style_Check_References := False;
Add ('f', Style_Check_Form_Feeds);
Add ('h', Style_Check_Horizontal_Tabs);
Add ('i', Style_Check_If_Then_Layout);
+ Add ('I', Style_Check_Mode_In);
Add ('k', Style_Check_Keyword_Casing);
Add ('l', Style_Check_Layout);
Add ('n', Style_Check_Standard);
when 'i' =>
Style_Check_If_Then_Layout := True;
+ when 'I' =>
+ Style_Check_Mode_In := True;
+
when 'k' =>
Style_Check_Keyword_Casing := True;
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2006, 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- --
-- zero (a value of zero resets it to False). If True, it activates
-- checking the maximum nesting level against Style_Max_Nesting_Level.
+ Style_Check_Mode_In : Boolean := False;
+ -- This can be set True by using -gnatyI. If True, it activates checking
+ -- that mode IN is not used on its own (since it is the default).
+
Style_Check_Order_Subprograms : Boolean := False;
-- This can be set True by using the -gnatg or -gnatyo switch. If it
-- is True, then names of subprogram bodies must be in alphabetical
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2006, 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- --
Write_Line (" f check no form feeds/vertical tabs in source");
Write_Line (" h check no horizontal tabs in source");
Write_Line (" i check if-then layout");
+ Write_Line (" I check mode in");
Write_Line (" k check casing rules for keywords");
Write_Line (" l check reference manual layout");
Write_Line (" Lnn check max nest level < nn ");
-- --
-- S p e c --
-- --
--- Copyright (C) 1996-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2006, 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- --
"-gnatyl " &
"LINE_LENGTH " &
"-gnatym " &
+ "MODE_IN " &
+ "-gnatyI " &
"NONE " &
"-gnatyN " &
"STANDARD_CASING " &