Commit 6b3fc735 by Robert Dewar Committed by Arnaud Charlet

switch-c.adb, [...]: Implement new switch -gnatw.g.

2009-07-15  Robert Dewar  <dewar@adacore.com>

	* 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
parent 124e3829
2009-07-15 Robert Dewar <dewar@adacore.com>
* 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 <dewar@adacore.com>
* exp_aggr.adb, tbuild.ads, tbuild.adb: Minor reformatting
Minor code reorganization
......
......@@ -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
......
......@@ -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 :=
......
......@@ -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 --
------------------------
......
......@@ -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 --
------------------------------------------
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment