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] Require space after right paren in -gnatyt mode


This patch adds a check in -gnatyt mode to require a space after
right paren, if the next token starts with a digit or letter. This
is analagous to the existing rule requiring a space before a left
paren if the previous token ends with a digit or letter.

The following example, compiled with -gnatyt shows the new check

     1. procedure RightParenStyle is
     2.    function F (X : Integer) return Boolean;
     3.    function F (X : Integer) return Boolean is
     4.    begin
     5.       return True;
     6.    end F;
     7. begin
     8.    if F(1) then
               |
        >>> (style) space required

     9.       null;
    10.    elsif F (2)then
                      |
        >>> (style) space required

    11.       null;
    12.    end if;
    13. end RightParenStyle;

Tested on x86_64-pc-linux-gnu, committed on trunk

2009-10-28  Robert Dewar  <dewar@adacore.com>

	* gnat_ugn.texi: Document new -gnatyt requirement for space after right
	paren if next token starts with digit or letter.
	* styleg.adb (Check_Right_Paren): New rule for space after if next
	character is a letter or digit.

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]