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] Make sure No_Direct_Boolean_Operators checked properly


No_Direct_Boolean_Operators was checking logical operators as
documented, but not comparison operators, this patch fixes
that defect. The following program:

    pragma Restrictions (No_Direct_Boolean_Operators);

    procedure BOPS (A, B : Boolean) is
       X : Boolean;
    begin
       X := A or B;
       X := A and B;
       X := A xor B;

       X := A = B;
       X := A /= B;
       X := A < B;
       X := A > B;
    end;

should yield errors on all 7 assignments (-gnatj50)

bops.adb:6:15: violation of restriction
               "NO_DIRECT_BOOLEAN_OPERATORS" at
               line 1
bops.adb:7:15: violation of restriction
               "NO_DIRECT_BOOLEAN_OPERATORS" at
               line 1
bops.adb:8:15: violation of restriction
               "NO_DIRECT_BOOLEAN_OPERATORS" at
               line 1
bops.adb:10:15: violation of restriction
                "NO_DIRECT_BOOLEAN_OPERATORS" at
                line 1
bops.adb:11:15: violation of restriction
                "NO_DIRECT_BOOLEAN_OPERATORS" at
                line 1
bops.adb:12:15: violation of restriction
                "NO_DIRECT_BOOLEAN_OPERATORS" at
                line 1
bops.adb:13:15: violation of restriction
                "NO_DIRECT_BOOLEAN_OPERATORS" at
                line 1

Before this patch the last four messages did not appear

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

2009-06-22  Robert Dewar  <dewar@adacore.com>

	* sem_res.adb (Check_No_Direct_Boolean_Operators): New procedure

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]