This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] More liberal rules for style check comment alignment


Tested on i686-linux, committed on trunk

If comment columns are checked, the current rules require that a
whole line comment start on a multiple of the specified indentation.
This patch relaxes this rule to say that either it must start on a
multiple of the specified indentation, or it must have the same
indentation as the following non-blank line.

The following test program shows the improvement. Before
this patch, all four comments would have been flagged.
This test was compiled with -gnats -gnaty -gnatld7

Checking: comments.adb

     1. procedure comments is
     2.    procedure A (My : Integer;
     3.                 --  comment GNAT and GPS disagrees on (OK now)
     4.                 No : Integer);
     5.
     6. begin
     7.    if X > 3
     8.
     9.      --  Also test for 42 (OK now)
    10.
    11.      and then X > 42
    12.    then
    13.       null;
    14.    end if;
    15.
    16.      --  This commment is bad
             |
        >>> (style) bad column

    17. end comments;
    18.
    19.  -- and so is this one
         |
        >>> (style) bad column

2007-12-19  Robert Dewar  <dewar@adacore.com>

	* styleg.adb (Check_Comment): More liberal rules for comment placement

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]