===================================================================
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
+-- Copyright (C) 1992-2011, 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- --
@@ -548,7 +548,8 @@
Write_Line (" A check array attribute indexes");
Write_Line (" b check no blanks at end of lines");
Write_Line (" B check no use of AND/OR for boolean expressions");
- Write_Line (" c check comment format");
+ Write_Line (" c check comment format (two spaces)");
+ Write_Line (" C check comment format (one space)");
Write_Line (" d check no DOS line terminators");
Write_Line (" e check end/exit labels present");
Write_Line (" f check no form feeds/vertical tabs in source");
===================================================================
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
+-- Copyright (C) 1992-2011, 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- --
@@ -160,7 +160,13 @@
Add ('A', Style_Check_Array_Attribute_Index);
Add ('b', Style_Check_Blanks_At_End);
Add ('B', Style_Check_Boolean_And_Or);
- Add ('c', Style_Check_Comments);
+
+ if Style_Check_Comments_Spacing = 2 then
+ Add ('c', Style_Check_Comments);
+ elsif Style_Check_Comments_Spacing = 1 then
+ Add ('C', Style_Check_Comments);
+ end if;
+
Add ('d', Style_Check_DOS_Line_Terminator);
Add ('e', Style_Check_End_Labels);
Add ('f', Style_Check_Form_Feeds);
@@ -322,7 +328,12 @@
when 'c' =>
Style_Check_Comments := True;
+ Style_Check_Comments_Spacing := 2;
+ when 'C' =>
+ Style_Check_Comments := True;
+ Style_Check_Comments_Spacing := 1;
+
when 'd' =>
Style_Check_DOS_Line_Terminator := True;
@@ -484,7 +495,7 @@
when 'B' =>
Style_Check_Boolean_And_Or := False;
- when 'c' =>
+ when 'c' | 'C' =>
Style_Check_Comments := False;
when 'd' =>
===================================================================
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
+-- Copyright (C) 1992-2011, 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- --
@@ -94,7 +94,8 @@
-- The comment characters are followed by an exclamation point (the
-- sequence --! is used by gnatprep for marking deleted lines).
--
- -- The comment characters are followed by two space characters
+ -- The comment characters are followed by two space characters if
+ -- Comment_Spacing = 2, else by one character if Comment_Spacing = 1.
--
-- The line consists entirely of minus signs
--
@@ -104,6 +105,9 @@
-- Note: the reason for the last two conditions is to allow "boxed"
-- comments where only a single space separates the comment characters.
+ Style_Check_Comments_Spacing : Nat range 1 .. 2;
+ -- Spacing required for comments, valid only if Style_Check_Comments true.
+
Style_Check_DOS_Line_Terminator : Boolean := False;
-- This can be set true by using the -gnatyd switch. If it is True, then
-- the line terminator must be a single LF, without an associated CR (e.g.
===================================================================
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
+-- Copyright (C) 1992-2011, 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- --
@@ -507,7 +507,9 @@
S := Scan_Ptr + 2;
while Source (S) >= ' ' loop
if Source (S) /= '-' then
- if Is_Box_Comment then
+ if Is_Box_Comment
+ or else Style_Check_Comments_Spacing = 1
+ then
Error_Space_Required (Scan_Ptr + 2);
else
Error_Msg -- CODEFIX
@@ -522,14 +524,17 @@
-- If we are followed by a blank, then the comment is OK if the
-- character following this blank is another blank or a format
- -- effector.
+ -- effector, or if the required comment spacing is 1.
- elsif Source (Scan_Ptr + 3) <= ' ' then
+ elsif Source (Scan_Ptr + 3) <= ' '
+ or else Style_Check_Comments_Spacing = 1
+ then
return;
- -- Here is the case where we only have one blank after the two
- -- minus signs, which is an error unless the line ends with two
- -- minus signs, the case of a box comment.
+ -- Here is the case where we only have one blank after the two minus
+ -- signs, with Style_Check_Comments_Spacing set to 2, which is an
+ -- error unless the line ends with two minus signs, the case of a
+ -- box comment.
elsif not Is_Box_Comment then
Error_Space_Required (Scan_Ptr + 3);