From: Robert Dewar Date: Wed, 15 Jul 2009 09:38:34 +0000 (+0000) Subject: switch-c.adb, [...]: Implement new switch -gnatw.g. X-Git-Tag: releases/gcc-4.5.0~4572 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6b3fc735ace5b970fb82227c89c96eff5aeee91e;p=thirdparty%2Fgcc.git switch-c.adb, [...]: Implement new switch -gnatw.g. 2009-07-15 Robert Dewar * switch-c.adb, sem_ch10.adb, sem_warn.adb, sem_warn.ads: Implement new switch -gnatw.g. (Set_GNAT_Mode_Warnings): New procedure. * lib-xref.adb: Minor reformatting From-SVN: r149666 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ddcd42c92ac1..c50487b53775 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2009-07-15 Robert Dewar + + * switch-c.adb, sem_ch10.adb, sem_warn.adb, sem_warn.ads: Implement + new switch -gnatw.g. + (Set_GNAT_Mode_Warnings): New procedure. + + * lib-xref.adb: Minor reformatting + 2009-07-15 Robert Dewar * exp_aggr.adb, tbuild.ads, tbuild.adb: Minor reformatting diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb index 0e45e2e2bf60..2f0c9ae44ee6 100644 --- a/gcc/ada/lib-xref.adb +++ b/gcc/ada/lib-xref.adb @@ -1464,7 +1464,6 @@ package body Lib.Xref is if Name_Len /= Curlen then return True; - else return Name_Buffer (1 .. Curlen) /= Curnam (1 .. Curlen); end if; @@ -1543,7 +1542,7 @@ package body Lib.Xref is -- Used for {} or <> or () for type reference procedure Check_Type_Reference - (Ent : Entity_Id; + (Ent : Entity_Id; List_Interface : Boolean); -- Find whether there is a meaningful type reference for -- Ent, and display it accordingly. If List_Interface is @@ -1565,7 +1564,7 @@ package body Lib.Xref is -------------------------- procedure Check_Type_Reference - (Ent : Entity_Id; + (Ent : Entity_Id; List_Interface : Boolean) is begin diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb index 970d3679224a..a21cd5be34f9 100644 --- a/gcc/ada/sem_ch10.adb +++ b/gcc/ada/sem_ch10.adb @@ -2328,7 +2328,6 @@ package body Sem_Ch10 is and then Current_Sem_Unit = Main_Unit and then not Intunit and then not Implicit_With (N) - and then not GNAT_Mode then declare U_Kind : constant Kind_Of_Unit := diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index e483d0515044..610baee29905 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -2997,6 +2997,9 @@ package body Sem_Warn is Warn_On_Unrepped_Components := True; Warn_On_Warnings_Off := True; + when 'g' => + Set_GNAT_Mode_Warnings; + when 'm' => Warn_On_Suspicious_Modulus_Value := True; @@ -3041,6 +3044,45 @@ package body Sem_Warn is return True; end Set_Dot_Warning_Switch; + ---------------------------- + -- Set_GNAT_Mode_Warnings -- + ---------------------------- + + procedure Set_GNAT_Mode_Warnings is + begin + Address_Clause_Overlay_Warnings := True; + Check_Unreferenced := True; + Check_Unreferenced_Formals := True; + Check_Withs := True; + Constant_Condition_Warnings := True; + Elab_Warnings := False; + Implementation_Unit_Warnings := False; + Ineffective_Inline_Warnings := True; + Warn_On_Ada_2005_Compatibility := True; + Warn_On_All_Unread_Out_Parameters := False; + Warn_On_Assertion_Failure := True; + Warn_On_Assumed_Low_Bound := True; + Warn_On_Bad_Fixed_Value := True; + Warn_On_Biased_Representation := True; + Warn_On_Constant := True; + Warn_On_Deleted_Code := False; + Warn_On_Dereference := False; + Warn_On_Export_Import := True; + Warn_On_Hiding := False; + Warn_On_Modified_Unread := True; + Warn_On_No_Value_Assigned := True; + Warn_On_Non_Local_Exception := False; + Warn_On_Object_Renames_Function := False; + Warn_On_Obsolescent_Feature := True; + Warn_On_Questionable_Missing_Parens := True; + Warn_On_Redundant_Constructs := True; + Warn_On_Object_Renames_Function := True; + Warn_On_Unchecked_Conversion := True; + Warn_On_Unrecognized_Pragma := True; + Warn_On_Unrepped_Components := False; + Warn_On_Warnings_Off := False; + end Set_GNAT_Mode_Warnings; + ------------------------ -- Set_Warning_Switch -- ------------------------ diff --git a/gcc/ada/sem_warn.ads b/gcc/ada/sem_warn.ads index 3acb6873915f..1e0f96814bdc 100644 --- a/gcc/ada/sem_warn.ads +++ b/gcc/ada/sem_warn.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1999-2008, Free Software Foundation, Inc. -- +-- Copyright (C) 1999-2009, 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- -- @@ -77,6 +77,10 @@ package Sem_Warn is -- the command line or .C in a string literal in pragma Warnings. Returns -- True for valid warning character C, False for invalid character. + procedure Set_GNAT_Mode_Warnings; + -- This is called in -gnatg mode to set the warnings for gnat mode. It is + -- also used to set the proper warning statuses for -gnatw.g. + ------------------------------------------ -- Routines to Handle Unused References -- ------------------------------------------ diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb index f0acc45c7669..b391ce3913fa 100644 --- a/gcc/ada/switch-c.adb +++ b/gcc/ada/switch-c.adb @@ -508,28 +508,9 @@ package body Switch.C is Ada_Version := Ada_05; Ada_Version_Explicit := Ada_Version; - -- Set default warnings for -gnatg - - Check_Unreferenced := True; - Check_Unreferenced_Formals := True; - Check_Withs := True; - Constant_Condition_Warnings := True; - Implementation_Unit_Warnings := True; - Ineffective_Inline_Warnings := True; - Warn_On_Assertion_Failure := True; - Warn_On_Assumed_Low_Bound := True; - Warn_On_Bad_Fixed_Value := True; - Warn_On_Constant := True; - Warn_On_Export_Import := True; - Warn_On_Modified_Unread := True; - Warn_On_No_Value_Assigned := True; - Warn_On_Non_Local_Exception := False; - Warn_On_Obsolescent_Feature := True; - Warn_On_Redundant_Constructs := True; - Warn_On_Object_Renames_Function := True; - Warn_On_Unchecked_Conversion := True; - Warn_On_Unrecognized_Pragma := True; + -- Set default warnings and style checks for -gnatg + Set_GNAT_Mode_Warnings; Set_GNAT_Style_Check_Options; -- Processing for G switch