Commit c690a2ec by Robert Dewar Committed by Arnaud Charlet

opt.ads: Warning for non-local exception propagation now off by default New switch...

2007-08-14  Robert Dewar  <dewar@adacore.com>
	    Ed Schonberg  <schonberg@adacore.com>

	* opt.ads: Warning for non-local exception propagation now off by
	default
	New switch -gnatI to disable representation clauses
	Implement new pragma Implicit_Packing

	* usage.adb: 
	Warning for non-local exception propagation now off by default
	Add warning for unchecked conversion of pointers wi different
	conventions.
	New switch -gnatI to disable representation clauses

	* usage.adb: new switch -gnatyS

	* gnat_ugn.texi: For the gnatcheck Non_Qualified_Aggregates rule add a
	note that aggregates of anonymous array types are not flagged.
	-gnatwc now includes membership tests optimized away
	-gnatw.x warnings are now off by default
	Added conditional compilation Appendix
	Add documentation of -gnatI
	Add documentation for new -gnatyS style check
	Update documentation about SAL and auto-init on Windows.

	* gnat_rm.texi: 
	Add documentation for pragma Check_Name and 'Enabled attribute
	Document that Eliminate on dispatching operation is ignored
	Document IDE attributes VCS_Repository_Root and VCS_Patch_Root.
	Document pragma Main
	Document pragma Implicit_Packing

	* sem_ch13.adb: Add warning for unchecked conversion of pointers wi
	different conventions
	New switch -gnatI to disable representation clauses

	* switch-c.adb (Scan_Front_End_Switches): When a -gnat switch is not
	recognized, report the invalid characters including "-gnat" instead of
	just the first character in the switch.
	New switch -gnatI to disable representation clauses
	Set Warn_On_Object_Renames_Function true for -gnatg

	* vms_data.ads: Add doc for /IGNORE_REP_CLAUSES
	Add STATEMENTS_AFTER_THEN_ELSE as synonym for -gnatyS
	Add qualifier /ADD_PROJECT_SEARCH_DIR= for different tools, equivalent
	to switch -aP (add directory to project search dir).

	* par-prag.adb: Implement new pragma Implicit_Packing

	* sem_prag.adb (Analyze_Pragma, case Complex_Representation): Mark the
	type as having a non-standard representation, to force expansion on
	conversion to related types.
	(Analyze_Pragma): Warn on misspelled pragma
	(Analyze_Pragma, case Convention_Identifier): Fix checking of second arg
	Ensure consistent use of # in error messages
	Implement pragma Implicit_Packing

From-SVN: r127421
parent ede007da
......@@ -386,11 +386,6 @@ package Opt is
-- Set to True if -gnato (enable overflow checks) switch is set,
-- but not -gnatp.
Overflow_Checks_Unsuppressed : Boolean := False;
-- GNAT
-- Set to True if at least one pragma Unsuppress
-- (All_Checks|Overflow_Checks) has been processed.
Error_Msg_Line_Length : Nat := 0;
-- GNAT
-- Records the error message line length limit. If this is set to zero,
......@@ -533,11 +528,6 @@ package Opt is
-- GNAT
-- True if High Level Optimizer is activated (-gnatH switch)
Implementation_Unit_Warnings : Boolean := True;
-- GNAT
-- Set True to active warnings for use of implementation internal units.
-- Can be controlled by use of -gnatwi/-gnatwI.
Identifier_Character_Set : Character;
-- GNAT
-- This variable indicates the character set to be used for identifiers.
......@@ -561,6 +551,23 @@ package Opt is
-- default value appropriate to the system (in Osint.Initialize), and then
-- reset if a command line switch is used to change the setting.
Ignore_Rep_Clauses : Boolean := False;
-- GNAT
-- Set True to ignore all representation clauses. Useful when compiling
-- code from foreign compilers for checking or ASIS purposes. Can be
-- set True by use of -gnatI.
Implementation_Unit_Warnings : Boolean := True;
-- GNAT
-- Set True to active warnings for use of implementation internal units.
-- Can be controlled by use of -gnatwi/-gnatwI.
Implicit_Packing : Boolean := False;
-- GNAT
-- If set True, then a Size attribute clause on an array is allowed to
-- cause implicit packing instead of generating an error message. Set by
-- use of pragma Implicit_Packing.
Ineffective_Inline_Warnings : Boolean := False;
-- GNAT
-- Set True to activate warnings if front-end inlining (-gnatN) is not
......@@ -842,6 +849,11 @@ package Opt is
-- GNATBIND
-- True if output of list of objects is requested (-O switch set)
Overflow_Checks_Unsuppressed : Boolean := False;
-- GNAT
-- Set to True if at least one pragma Unsuppress
-- (All_Checks|Overflow_Checks) has been processed.
Persistent_BSS_Mode : Boolean := False;
-- GNAT
-- True if a Persistent_BSS configuration pragma is in effect, causing
......@@ -1178,12 +1190,12 @@ package Opt is
-- variable that is at least partially uninitialized. Set to false to
-- suppress such warnings. The default is that such warnings are enabled.
Warn_On_Non_Local_Exception : Boolean := True;
Warn_On_Non_Local_Exception : Boolean := False;
-- GNAT
-- Set to True to generate warnings for non-local exception raises and also
-- handlers that can never handle a local raise. This warning is only ever
-- generated if pragma Restrictions (No_Exception_Propagation) is set. The
-- default is to generate the warnings if the restriction is set.
-- default is not to generate the warnings even if the restriction is set.
Warn_On_Obsolescent_Feature : Boolean := False;
-- GNAT
......@@ -1375,9 +1387,9 @@ package Opt is
-- parameter Internal_Unit is True for an internal or predefined unit, and
-- affects the way the switches are set (see above). Main_Unit is true if
-- switches are being set for the main unit (this affects setting of the
-- assert/debug pragm switches, which are normally set false by default for
-- an internal unit, except when the internal unit is the main unit, in
-- which case we use the command line settings).
-- assert/debug pragma switches, which are normally set false by default
-- for an internal unit, except when the internal unit is the main unit,
-- in which case we use the command line settings).
procedure Restore_Opt_Config_Switches (Save : Config_Switches_Type);
-- This procedure restores a set of switch values previously saved by a
......@@ -1392,15 +1404,6 @@ package Opt is
-- Other Global Flags --
------------------------
Static_Dispatch_Tables : constant Boolean;
-- This flag indicates if the backend supports generation of statically
-- allocated dispatch tables. If it is True, then the front end will
-- generate static aggregates for dispatch tables that contain forward
-- references to addresses of subprograms not seen yet, and the back end
-- must be prepared to handle this case. If it is False, then the front
-- end generates assignments to initialize the dispatch table, and there
-- are no such forward references.
Expander_Active : Boolean := False;
-- A flag that indicates if expansion is active (True) or deactivated
-- (False). When expansion is deactivated all calls to expander routines
......@@ -1411,6 +1414,18 @@ package Opt is
-- be in the spec of Expander, but it is referenced by Errout, and it
-- really seems wrong for Errout to depend on Expander.
Static_Dispatch_Tables : Boolean := True;
-- This flag indicates if the backend supports generation of statically
-- allocated dispatch tables. If it is True, then the front end will
-- generate static aggregates for dispatch tables that contain forward
-- references to addresses of subprograms not seen yet, and the back end
-- must be prepared to handle this case. If it is False, then the front
-- end generates assignments to initialize the dispatch table, and there
-- are no such forward references. By default we build statically allocated
-- dispatch tables for all library level tagged types in all platforms.This
-- behavior can be disabled using switch -gnatd.t which will set this flag
-- to False and revert to the previous dynamic behavior.
-----------------------
-- Tree I/O Routines --
-----------------------
......@@ -1474,6 +1489,10 @@ private
-- not let client code in the compiler test GCC_Version directly, but
-- instead use deferred constants for relevant feature tags.
-- Note: there currently are no such constants defined in this section,
-- since the compiler front end is currently entirely independent of the
-- GCC version, which is a desirable state of affairs.
function get_gcc_version return Int;
pragma Import (C, get_gcc_version, "get_gcc_version");
......@@ -1482,8 +1501,4 @@ private
-- Indicates which version of gcc is in use (3 = 3.x, 4 = 4.x). Note that
-- gcc 2.8.1 (which used to be a value of 2) is no longer supported.
Static_Dispatch_Tables : constant Boolean := GCC_Version >= 4;
-- GCC version 4 can handle the static dispatch tables, but not version 3.
-- Also we need -funit-at-a-time, which should also be tested here ???
end Opt;
......@@ -1054,6 +1054,7 @@ begin
Pragma_Atomic |
Pragma_Atomic_Components |
Pragma_Attach_Handler |
Pragma_Check_Name |
Pragma_CIL_Constructor |
Pragma_Compile_Time_Error |
Pragma_Compile_Time_Warning |
......@@ -1091,6 +1092,7 @@ begin
Pragma_Finalize_Storage_Only |
Pragma_Float_Representation |
Pragma_Ident |
Pragma_Implicit_Packing |
Pragma_Import |
Pragma_Import_Exception |
Pragma_Import_Function |
......
......@@ -178,7 +178,7 @@ package body Switch.C is
-- There are no other switches not starting with -gnat
else
Bad_Switch (C);
Bad_Switch (Switch_Chars);
end if;
-- Case of switch starting with -gnat
......@@ -260,8 +260,10 @@ package body Switch.C is
elsif C = '.' then
Dot := True;
elsif Dot then
Bad_Switch ("-gnatd." & Switch_Chars (Ptr .. Max));
else
Bad_Switch (C);
Bad_Switch ("-gnatd" & Switch_Chars (Ptr .. Max));
end if;
end loop;
......@@ -289,7 +291,7 @@ package body Switch.C is
-- so we must always have a character after the e.
if Ptr > Max then
Bad_Switch (C);
Bad_Switch ("-gnate");
end if;
case Switch_Chars (Ptr) is
......@@ -308,7 +310,7 @@ package body Switch.C is
end if;
if Ptr > Max then
Bad_Switch (C);
Bad_Switch ("-gnatec");
end if;
declare
......@@ -351,7 +353,7 @@ package body Switch.C is
Ptr := Ptr + 1;
if Ptr > Max then
Bad_Switch (C);
Bad_Switch ("-gnateD");
end if;
Add_Symbol_Definition (Switch_Chars (Ptr .. Max));
......@@ -390,7 +392,7 @@ package body Switch.C is
end if;
if Ptr > Max then
Bad_Switch (C);
Bad_Switch ("-gnatem");
end if;
Mapping_File_Name :=
......@@ -411,7 +413,7 @@ package body Switch.C is
end if;
if Ptr > Max then
Bad_Switch (C);
Bad_Switch ("-gnatep");
end if;
Preprocessing_Data_File :=
......@@ -432,7 +434,7 @@ package body Switch.C is
-- All other -gnate? switches are unassigned
when others =>
Bad_Switch (C);
Bad_Switch ("-gnate" & Switch_Chars (Ptr .. Max));
end case;
-- -gnatE (dynamic elaboration checks)
......@@ -472,23 +474,24 @@ package body Switch.C is
-- 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_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_Unchecked_Conversion := True;
Warn_On_Unrecognized_Pragma := True;
Check_Unreferenced := True;
Check_Unreferenced_Formals := True;
Check_Withs := True;
Constant_Condition_Warnings := True;
Implementation_Unit_Warnings := True;
Ineffective_Inline_Warnings := 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_GNAT_Style_Check_Options;
......@@ -514,7 +517,7 @@ package body Switch.C is
when 'i' =>
if Ptr = Max then
Bad_Switch (C);
Bad_Switch ("-gnati");
end if;
Ptr := Ptr + 1;
......@@ -532,9 +535,15 @@ package body Switch.C is
Ptr := Ptr + 1;
else
Bad_Switch (C);
Bad_Switch ("-gnati" & Switch_Chars (Ptr .. Max));
end if;
-- Processing for I switch
when 'I' =>
Ptr := Ptr + 1;
Ignore_Rep_Clauses := True;
-- Processing for j switch
when 'j' =>
......@@ -679,7 +688,7 @@ package body Switch.C is
List_Representation_Info_Mechanisms := True;
else
Bad_Switch (C);
Bad_Switch ("-gnatR" & Switch_Chars (Ptr .. Max));
end if;
Ptr := Ptr + 1;
......@@ -745,7 +754,7 @@ package body Switch.C is
Ptr := Ptr + 1;
if Ptr > Max then
Bad_Switch (C);
Bad_Switch ("-gnatV");
else
declare
......@@ -756,7 +765,7 @@ package body Switch.C is
(Switch_Chars (Ptr .. Max), OK, Ptr);
if not OK then
Bad_Switch (C);
Bad_Switch ("-gnatV" & Switch_Chars (Ptr .. Max));
end if;
for Index in First_Char + 1 .. Max loop
......@@ -775,7 +784,7 @@ package body Switch.C is
Ptr := Ptr + 1;
if Ptr > Max then
Bad_Switch (C);
Bad_Switch ("-gnatw");
end if;
while Ptr <= Max loop
......@@ -790,7 +799,7 @@ package body Switch.C is
if Set_Dot_Warning_Switch (C) then
Store_Compilation_Switch ("-gnatw." & C);
else
Bad_Switch (C);
Bad_Switch ("-gnatw." & Switch_Chars (Ptr .. Max));
end if;
-- Normal case, no dot
......@@ -799,7 +808,7 @@ package body Switch.C is
if Set_Warning_Switch (C) then
Store_Compilation_Switch ("-gnatw" & C);
else
Bad_Switch (C);
Bad_Switch ("-gnatw" & Switch_Chars (Ptr .. Max));
end if;
end if;
......@@ -814,7 +823,7 @@ package body Switch.C is
Ptr := Ptr + 1;
if Ptr > Max then
Bad_Switch (C);
Bad_Switch ("-gnatW");
end if;
begin
......@@ -822,7 +831,7 @@ package body Switch.C is
Get_WC_Encoding_Method (Switch_Chars (Ptr));
exception
when Constraint_Error =>
Bad_Switch (C);
Bad_Switch ("-gnatW" & Switch_Chars (Ptr .. Max));
end;
Upper_Half_Encoding :=
......@@ -906,7 +915,7 @@ package body Switch.C is
Distribution_Stub_Mode := Generate_Caller_Stub_Body;
when others =>
Bad_Switch (C);
Bad_Switch ("-gnatz" & Switch_Chars (Ptr .. Max));
end case;
Ptr := Ptr + 1;
......@@ -923,13 +932,13 @@ package body Switch.C is
when '8' =>
if Ptr = Max then
Bad_Switch (C);
Bad_Switch ("-gnat8");
end if;
Ptr := Ptr + 1;
if Switch_Chars (Ptr) /= '3' then
Bad_Switch (C);
Bad_Switch ("-gnat8" & Switch_Chars (Ptr .. Max));
else
Ptr := Ptr + 1;
Ada_Version := Ada_83;
......@@ -940,13 +949,13 @@ package body Switch.C is
when '9' =>
if Ptr = Max then
Bad_Switch (C);
Bad_Switch ("-gnat9");
end if;
Ptr := Ptr + 1;
if Switch_Chars (Ptr) /= '5' then
Bad_Switch (C);
Bad_Switch ("-gnat9" & Switch_Chars (Ptr .. Max));
else
Ptr := Ptr + 1;
Ada_Version := Ada_95;
......@@ -957,13 +966,13 @@ package body Switch.C is
when '0' =>
if Ptr = Max then
Bad_Switch (C);
Bad_Switch ("-gnat0");
end if;
Ptr := Ptr + 1;
if Switch_Chars (Ptr) /= '5' then
Bad_Switch (C);
Bad_Switch ("-gnat0" & Switch_Chars (Ptr .. Max));
else
Ptr := Ptr + 1;
Ada_Version := Ada_05;
......@@ -978,7 +987,7 @@ package body Switch.C is
-- Anything else is an error (illegal switch character)
when others =>
Bad_Switch (C);
Bad_Switch ("-gnat" & Switch_Chars (Ptr .. Max));
end case;
if Store_Switch then
......
......@@ -215,6 +215,11 @@ begin
Write_Switch_Char ("i?");
Write_Line ("Identifier char set (?=1/2/3/4/5/8/9/p/f/n/w)");
-- Line for -gnatI switch
Write_Switch_Char ("I");
Write_Line ("Ignore all representation clauses");
-- Line for -gnatj switch
Write_Switch_Char ("jnn");
......@@ -420,13 +425,13 @@ begin
"assumption");
Write_Line (" x* turn on warnings for export/import");
Write_Line (" X turn off warnings for export/import");
Write_Line (" .x* turn on warnings for non-local exceptions");
Write_Line (" .X turn off warnings for non-local exceptions");
Write_Line (" .x turn on warnings for non-local exceptions");
Write_Line (" .X* turn off warnings for non-local exceptions");
Write_Line (" y* turn on warnings for Ada 2005 incompatibility");
Write_Line (" Y turn off warnings for Ada 2005 incompatibility");
Write_Line (" z* turn on size/align warnings for " &
Write_Line (" z* turn on convention/size/align warnings for " &
"unchecked conversion");
Write_Line (" Z turn off size/align warnings for " &
Write_Line (" Z turn off convention/size/align warnings for " &
"unchecked conversion");
Write_Line (" * indicates default in above list");
......@@ -480,11 +485,12 @@ begin
Write_Line (" Lnn check max nest level < nn ");
Write_Line (" m check line length <= 79 characters");
Write_Line (" n check casing of package Standard identifiers");
Write_Line (" Mnn check line length <= nn characters");
Write_Line (" Mnn check line length <= nn characters");
Write_Line (" o check subprogram bodies in alphabetical order");
Write_Line (" p check pragma casing");
Write_Line (" r check casing for identifier references");
Write_Line (" s check separate subprogram specs present");
Write_Line (" S check separate lines after THEN or ELSE");
Write_Line (" t check token separation rules");
Write_Line (" u check no unnecessary blank lines");
Write_Line (" x check extra parentheses around conditionals");
......
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