From 029b67bac325590fb9557b5964aea6bb2aac0cba Mon Sep 17 00:00:00 2001 From: Yannick Moy Date: Fri, 2 Sep 2011 09:29:53 +0000 Subject: [PATCH] usage.adb, [...]: Disable by default warnings on suspicious contracts, and enable them with -gnatwa. 2011-09-02 Yannick Moy * usage.adb, warnsw.adb, sem_ch6.adb, opt.ads: Disable by default warnings on suspicious contracts, and enable them with -gnatwa. From-SVN: r178452 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/opt.ads | 4 ++-- gcc/ada/sem_ch6.adb | 8 +++++--- gcc/ada/usage.adb | 4 ++-- gcc/ada/warnsw.adb | 3 +++ 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e5539734efc..b2165b8b742 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2011-09-02 Yannick Moy + + * usage.adb, warnsw.adb, sem_ch6.adb, opt.ads: Disable by default + warnings on suspicious contracts, and enable them with -gnatwa. + 2011-09-02 Robert Dewar * exp_util.adb, exp_ch9.adb, sem_attr.adb, sem_ch6.adb: Minor diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads index 9e4ee4a7f11..b84e4ec1adb 100644 --- a/gcc/ada/opt.ads +++ b/gcc/ada/opt.ads @@ -1550,11 +1550,11 @@ package Opt is -- clauses that are affected by non-standard bit-order. The default is -- that this warning is enabled. - Warn_On_Suspicious_Contract : Boolean := True; + Warn_On_Suspicious_Contract : Boolean := False; -- GNAT -- Set to True to generate warnings for suspicious contracts expressed as -- pragmas or aspects precondition and postcondition. The default is that - -- this warning is enabled. + -- this warning is disabled. Warn_On_Suspicious_Modulus_Value : Boolean := True; -- GNAT diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 9133046523b..59194050600 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -5460,12 +5460,14 @@ package body Sem_Ch6 is procedure Check_Subprogram_Contract (Spec_Id : Entity_Id) is + -- Code is currently commented out as, in some cases, it causes crashes + -- because Direct_Primitive_Operations is not available for a private + -- type. This may cause more warnings to be issued than necessary. See + -- below for the intended use of this variable. ??? + -- Inherited : constant Subprogram_List := -- Inherited_Subprograms (Spec_Id); -- -- List of subprograms inherited by this subprogram - -- Code is currently commented out as, in some cases, it causes crashes - -- because Direct_Primitive_Operations is not available for a private - -- type??? Last_Postcondition : Node_Id := Empty; -- Last postcondition on the subprogram, or else Empty if either no diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb index 1d79f66a0a7..146b0c043f3 100644 --- a/gcc/ada/usage.adb +++ b/gcc/ada/usage.adb @@ -484,8 +484,8 @@ begin Write_Line (" .S* turn off warnings for overridden size clause"); Write_Line (" t turn on warnings for tracking deleted code"); Write_Line (" T* turn off warnings for tracking deleted code"); - Write_Line (" .t* turn on warnings for suspicious contract"); - Write_Line (" .T turn off warnings for suspicious contract"); + Write_Line (" .t+ turn on warnings for suspicious contract"); + Write_Line (" .T* turn off warnings for suspicious contract"); Write_Line (" u+ turn on warnings for unused entity"); Write_Line (" U* turn off warnings for unused entity"); Write_Line (" .u turn on warnings for unordered enumeration"); diff --git a/gcc/ada/warnsw.adb b/gcc/ada/warnsw.adb index 96a8e8f5df6..711b9438dbd 100644 --- a/gcc/ada/warnsw.adb +++ b/gcc/ada/warnsw.adb @@ -86,6 +86,7 @@ package body Warnsw is Warn_On_Record_Holes := True; Warn_On_Redundant_Constructs := True; Warn_On_Reverse_Bit_Order := True; + Warn_On_Suspicious_Contract := True; Warn_On_Unchecked_Conversion := True; Warn_On_Unordered_Enumeration_Type := True; Warn_On_Unrecognized_Pragma := True; @@ -256,6 +257,7 @@ package body Warnsw is Warn_On_Questionable_Missing_Parens := True; Warn_On_Redundant_Constructs := True; Warn_On_Reverse_Bit_Order := True; + Warn_On_Suspicious_Contract := True; Warn_On_Unchecked_Conversion := True; Warn_On_Unrecognized_Pragma := True; Warn_On_Unrepped_Components := True; @@ -294,6 +296,7 @@ package body Warnsw is Warn_On_Questionable_Missing_Parens := False; Warn_On_Redundant_Constructs := False; Warn_On_Reverse_Bit_Order := False; + Warn_On_Suspicious_Contract := False; Warn_On_Unchecked_Conversion := False; Warn_On_Unordered_Enumeration_Type := False; Warn_On_Unrecognized_Pragma := False; -- 2.30.2