Commit 0247964d by Arnaud Charlet

[multiple changes]

2013-10-14  Robert Dewar  <dewar@adacore.com>

	* exp_prag.adb, exp_ch11.adb, s-exctab.adb: Minor reformatting.
	* usage.adb: Add line for -gnateu switch.

2013-10-14  Vincent Celier  <celier@adacore.com>

	* lib-writ.ads: Add comments to indicate that a path name in
	D lines may be quoted if the path name includes directories
	with spaces.

2013-10-14  Robert Dewar  <dewar@adacore.com>

	* debug.adb: Document -gnatd.E.
	* gnat1drv.adb (Adjust_Global_Switches): Set Error_To_Warning
	if -gnatd.E set.
	* opt.ads (Error_To_Warning): New switch.
	* osint.adb: Minor reformatting.
	* sem_warn.adb (Warn_On_Overlapping_Actuals): Overlap is error
	in some cases in Ada 2012 mode (unless Error_To_Warning) is set.
	* sem_warn.ads (Warn_On_Overlapping_Actuals): Document error
	in Ada 2012 mode.

2013-10-14  Tristan Gingold  <gingold@adacore.com>

	* cstand.adb: Add a comment for Standard_Exception_Type.

2013-10-14  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch4.adb (Process_Transient_Object): If a transient scope
	has already been created, use the corresponding Node_To_Be_Wrapped
	as the insertion point for the controlled actions.

From-SVN: r203539
parent e443f142
2013-10-14 Robert Dewar <dewar@adacore.com>
* exp_prag.adb, exp_ch11.adb, s-exctab.adb: Minor reformatting.
* usage.adb: Add line for -gnateu switch.
2013-10-14 Vincent Celier <celier@adacore.com>
* lib-writ.ads: Add comments to indicate that a path name in
D lines may be quoted if the path name includes directories
with spaces.
2013-10-14 Robert Dewar <dewar@adacore.com>
* debug.adb: Document -gnatd.E.
* gnat1drv.adb (Adjust_Global_Switches): Set Error_To_Warning
if -gnatd.E set.
* opt.ads (Error_To_Warning): New switch.
* osint.adb: Minor reformatting.
* sem_warn.adb (Warn_On_Overlapping_Actuals): Overlap is error
in some cases in Ada 2012 mode (unless Error_To_Warning) is set.
* sem_warn.ads (Warn_On_Overlapping_Actuals): Document error
in Ada 2012 mode.
2013-10-14 Tristan Gingold <gingold@adacore.com>
* cstand.adb: Add a comment for Standard_Exception_Type.
2013-10-14 Ed Schonberg <schonberg@adacore.com>
* exp_ch4.adb (Process_Transient_Object): If a transient scope
has already been created, use the corresponding Node_To_Be_Wrapped
as the insertion point for the controlled actions.
2013-10-14 Tristan Gingold <gingold@adacore.com> 2013-10-14 Tristan Gingold <gingold@adacore.com>
* cstand.adb (Create_Standard): Change Import_Code component * cstand.adb (Create_Standard): Change Import_Code component
......
...@@ -1448,9 +1448,9 @@ package body CStand is ...@@ -1448,9 +1448,9 @@ package body CStand is
(Type_Definition (Parent (Standard_Duration)))); (Type_Definition (Parent (Standard_Duration))));
-- Normally it does not matter that nodes in package Standard are -- Normally it does not matter that nodes in package Standard are
-- not marked as analyzed. The Scalar_Range of the fixed-point -- not marked as analyzed. The Scalar_Range of the fixed-point type
-- type Standard_Duration is an exception, because of the special -- Standard_Duration is an exception, because of the special test
-- test made in Freeze.Freeze_Fixed_Point_Type. -- made in Freeze.Freeze_Fixed_Point_Type.
Set_Analyzed (Scalar_Range (Standard_Duration)); Set_Analyzed (Scalar_Range (Standard_Duration));
...@@ -1471,6 +1471,10 @@ package body CStand is ...@@ -1471,6 +1471,10 @@ package body CStand is
-- Build standard exception type. Note that the type name here is -- Build standard exception type. Note that the type name here is
-- actually used in the generated code, so it must be set correctly. -- actually used in the generated code, so it must be set correctly.
-- The type Standard_Exception_Type must be consistent with the type
-- System.Standard_Library.Exception_Data, as the latter is what is
-- known by the run-time. Components of the record are documented in
-- the declaration in System.Standard_Library.
Standard_Exception_Type := New_Standard_Entity; Standard_Exception_Type := New_Standard_Entity;
Set_Ekind (Standard_Exception_Type, E_Record_Type); Set_Ekind (Standard_Exception_Type, E_Record_Type);
......
...@@ -122,7 +122,7 @@ package body Debug is ...@@ -122,7 +122,7 @@ package body Debug is
-- d.B -- d.B
-- d.C Generate concatenation call, do not generate inline code -- d.C Generate concatenation call, do not generate inline code
-- d.D SPARK strict mode -- d.D SPARK strict mode
-- d.E -- d.E Turn selected errors into warnings
-- d.F SPARK mode -- d.F SPARK mode
-- d.G Frame condition mode for gnat2why -- d.G Frame condition mode for gnat2why
-- d.H -- d.H
...@@ -581,22 +581,26 @@ package body Debug is ...@@ -581,22 +581,26 @@ package body Debug is
-- d.w This flag turns off the scanning of loops to detect possible -- d.w This flag turns off the scanning of loops to detect possible
-- infinite loops. -- infinite loops.
-- d.A There seems to be a problem with ASIS if we activate the circuit
-- for reading and writing the aspect specification hash table, so
-- for now, this is controlled by the debug flag d.A. The hash table
-- is only written and read if this flag is set.
-- d.x No exception handlers in generated code. This causes exception -- d.x No exception handlers in generated code. This causes exception
-- handlers to be eliminated from the generated code. They are still -- handlers to be eliminated from the generated code. They are still
-- fully compiled and analyzed, they just get eliminated from the -- fully compiled and analyzed, they just get eliminated from the
-- code generation step. -- code generation step.
-- d.A There seems to be a problem with ASIS if we activate the circuit
-- for reading and writing the aspect specification hash table, so
-- for now, this is controlled by the debug flag d.A. The hash table
-- is only written and read if this flag is set.
-- d.C Generate call to System.Concat_n.Str_Concat_n routines in cases -- d.C Generate call to System.Concat_n.Str_Concat_n routines in cases
-- where we would normally generate inline concatenation code. -- where we would normally generate inline concatenation code.
-- d.D SPARK strict mode. Interpret compiler permissions as strictly as -- d.D SPARK strict mode. Interpret compiler permissions as strictly as
-- possible in SPARK mode. -- possible in SPARK mode.
--
-- d.E Turn selected errors into warnings. This debug switch causes a
-- specific set of error messages into warnings. Setting this switch
-- causes Opt.Error_To_Warning to be set to True.
-- d.F SPARK mode. Generate AST in a form suitable for formal -- d.F SPARK mode. Generate AST in a form suitable for formal
-- verification, as well as additional cross reference information in -- verification, as well as additional cross reference information in
-- ALI files to compute effects of subprograms. Note that ALI files -- ALI files to compute effects of subprograms. Note that ALI files
......
...@@ -1166,18 +1166,17 @@ package body Exp_Ch11 is ...@@ -1166,18 +1166,17 @@ package body Exp_Ch11 is
-- Generates: -- Generates:
-- exceptE : constant String := "A.B.EXCEP"; -- static data -- exceptE : constant String := "A.B.EXCEP"; -- static data
-- except : exception_data := ( -- except : exception_data :=
-- Handled_By_Other => False, -- (Handled_By_Other => False,
-- Lang => 'A', -- Lang => 'A',
-- Name_Length => exceptE'Length, -- Name_Length => exceptE'Length,
-- Full_Name => exceptE'Address, -- Full_Name => exceptE'Address,
-- HTable_Ptr => null, -- HTable_Ptr => null,
-- Foreign_Data => null, -- Foreign_Data => null,
-- Raise_Hook => null, -- Raise_Hook => null);
-- );
-- (protecting test only needed if not at library level) -- (protecting test only needed if not at library level)
--
-- exceptF : Boolean := True -- static data -- exceptF : Boolean := True -- static data
-- if exceptF then -- if exceptF then
-- exceptF := False; -- exceptF := False;
......
...@@ -12159,11 +12159,22 @@ package body Exp_Ch4 is ...@@ -12159,11 +12159,22 @@ package body Exp_Ch4 is
Top : Node_Id; Top : Node_Id;
begin begin
-- In most cases an expression that creates a controlled object
-- generates a transient scope around it. If this is the case then
-- other controlled values can reuse it.
if Scope_Is_Transient then
return Node_To_Be_Wrapped;
-- In some cases, such as return statements, no transient scope is
-- generated, in which case we have to look up in the tree to find
-- the proper list on which to place the transient.
-- When the node is inside a case/if expression, the lifetime of any -- When the node is inside a case/if expression, the lifetime of any
-- temporary controlled object is extended. Find a suitable insertion -- temporary controlled object is extended. Find a suitable insertion
-- node by locating the topmost case or if expressions. -- node by locating the topmost case or if expressions.
if Within_Case_Or_If_Expression (N) then elsif Within_Case_Or_If_Expression (N) then
Par := N; Par := N;
Top := N; Top := N;
while Present (Par) loop while Present (Par) loop
......
...@@ -713,7 +713,7 @@ package body Exp_Prag is ...@@ -713,7 +713,7 @@ package body Exp_Prag is
else else
Code := Code :=
Make_Function_Call (Loc, Make_Function_Call (Loc,
Name => Name =>
New_Reference_To (RTE (RE_Import_Address), Loc), New_Reference_To (RTE (RE_Import_Address), Loc),
Parameter_Associations => New_List Parameter_Associations => New_List
(Make_String_Literal (Loc, (Make_String_Literal (Loc,
......
...@@ -117,6 +117,13 @@ procedure Gnat1drv is ...@@ -117,6 +117,13 @@ procedure Gnat1drv is
Relaxed_RM_Semantics := True; Relaxed_RM_Semantics := True;
end if; end if;
-- -gnatd.E sets Error_To_Warning mode, causing selected error messages
-- to be treated as warnings instead of errors.
if Debug_Flag_Dot_EE then
Error_To_Warning := True;
end if;
-- Disable CodePeer_Mode in Check_Syntax, since we need front-end -- Disable CodePeer_Mode in Check_Syntax, since we need front-end
-- expansion. -- expansion.
......
...@@ -777,6 +777,13 @@ package Lib.Writ is ...@@ -777,6 +777,13 @@ package Lib.Writ is
-- D source-name time-stamp checksum [subunit-name] line:file-name -- D source-name time-stamp checksum [subunit-name] line:file-name
-- source-name also includes preprocessing data file and preprocessing
-- definition file. These preprocessing files may be given as full
-- path names instead of simple file names. If a full path name
-- includes a directory with spaces, the path name is quoted (quote
-- characters (") added at start and end, and any internal quotes are
-- doubled).
-- The time-stamp field contains the time stamp of the corresponding -- The time-stamp field contains the time stamp of the corresponding
-- source file. See types.ads for details on time stamp representation. -- source file. See types.ads for details on time stamp representation.
......
...@@ -516,6 +516,13 @@ package Opt is ...@@ -516,6 +516,13 @@ package Opt is
-- to make a single long message, and then this message is split up into -- to make a single long message, and then this message is split up into
-- multiple lines not exceeding the specified length. Set by -gnatj=nn. -- multiple lines not exceeding the specified length. Set by -gnatj=nn.
Error_To_Warning : Boolean := False;
-- GNAT
-- If True, then certain error messages (e.g. parameter overlap messages
-- for procedure calls in Ada 2012 mode) are treated as warnings instead
-- of errors. Set by debug flag -gnatd.E. A search for Error_To_Warning
-- will identify affected messages.
Exception_Handler_Encountered : Boolean := False; Exception_Handler_Encountered : Boolean := False;
-- GNAT -- GNAT
-- This flag is set true if the parser encounters an exception handler. -- This flag is set true if the parser encounters an exception handler.
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -1044,8 +1044,8 @@ package body Osint is ...@@ -1044,8 +1044,8 @@ package body Osint is
procedure Fail (S : String) is procedure Fail (S : String) is
begin begin
-- We use Output in case there is a special output set up. -- We use Output in case there is a special output set up. In this case
-- In this case Set_Standard_Error will have no immediate effect. -- Set_Standard_Error will have no immediate effect.
Set_Standard_Error; Set_Standard_Error;
Osint.Write_Program_Name; Osint.Write_Program_Name;
......
...@@ -67,15 +67,12 @@ package body System.Exception_Table is ...@@ -67,15 +67,12 @@ package body System.Exception_Table is
S1 : constant Big_String_Ptr := To_Ptr (A); S1 : constant Big_String_Ptr := To_Ptr (A);
S2 : constant Big_String_Ptr := To_Ptr (B); S2 : constant Big_String_Ptr := To_Ptr (B);
J : Integer := 1; J : Integer := 1;
begin begin
loop loop
if S1 (J) /= S2 (J) then if S1 (J) /= S2 (J) then
return False; return False;
elsif S1 (J) = ASCII.NUL then elsif S1 (J) = ASCII.NUL then
return True; return True;
else else
J := J + 1; J := J + 1;
end if; end if;
......
...@@ -3410,12 +3410,26 @@ package body Sem_Warn is ...@@ -3410,12 +3410,26 @@ package body Sem_Warn is
then then
null; null;
-- Here we may need to issue message -- Here we may need to issue overlap message
else else
Error_Msg_Warn := Error_Msg_Warn :=
-- Overlap checking is an error only in Ada 2012. For
-- earlier versions of Ada, this is a warning.
Ada_Version < Ada_2012 Ada_Version < Ada_2012
or else not Is_Elementary_Type (Etype (Form1));
-- Overlap is only illegal in Ada 2012 in the case of
-- elementary types (passed by copy). For other types,
-- we always have a warning in all Ada versions.
or else not Is_Elementary_Type (Etype (Form1))
-- Finally, debug flag -gnatd.E changes the error to a
-- warning even in Ada 2012 mode.
or else Error_To_Warning;
declare declare
Act : Node_Id; Act : Node_Id;
...@@ -3457,23 +3471,28 @@ package body Sem_Warn is ...@@ -3457,23 +3471,28 @@ package body Sem_Warn is
then then
if Act1 = First_Actual (N) then if Act1 = First_Actual (N) then
Error_Msg_FE Error_Msg_FE
("`IN OUT` prefix overlaps with " ("<`IN OUT` prefix overlaps with "
& "actual for&?I?", Act1, Form); & "actual for&", Act1, Form);
else else
-- For greater clarity, give name of formal -- For greater clarity, give name of formal
Error_Msg_Node_2 := Form; Error_Msg_Node_2 := Form;
Error_Msg_FE Error_Msg_FE
("writable actual for & overlaps with " ("<writable actual for & overlaps with "
& "actual for&?I?", Act1, Form); & "actual for&", Act1, Form);
end if; end if;
else else
-- For greater clarity, give name of formal
Error_Msg_Node_2 := Form; Error_Msg_Node_2 := Form;
-- This is one of the messages
Error_Msg_FE Error_Msg_FE
("writable actual for & overlaps with " ("<writable actual for & overlaps with "
& "actual for&?I?", Act1, Form1); & "actual for&", Act1, Form1);
end if; end if;
end; end;
end if; end if;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 1999-2011, Free Software Foundation, Inc. -- -- Copyright (C) 1999-2013, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -198,7 +198,9 @@ package Sem_Warn is ...@@ -198,7 +198,9 @@ package Sem_Warn is
procedure Warn_On_Overlapping_Actuals (Subp : Entity_Id; N : Node_Id); procedure Warn_On_Overlapping_Actuals (Subp : Entity_Id; N : Node_Id);
-- Called on a subprogram call. Checks whether an IN OUT actual that is -- Called on a subprogram call. Checks whether an IN OUT actual that is
-- not by-copy may overlap with another actual, thus leading to aliasing -- not by-copy may overlap with another actual, thus leading to aliasing
-- in the body of the called subprogram. -- in the body of the called subprogram. This is indeed a warning in Ada
-- versions prior to Ada 2012, but, unless Opt.Error_To_Warning is set by
-- use of debug flag -gnatd.E, this is illegal and generates an error.
procedure Warn_On_Suspicious_Index (Name : Entity_Id; X : Node_Id); procedure Warn_On_Suspicious_Index (Name : Entity_Id; X : Node_Id);
-- This is called after resolving an indexed component or a slice. Name -- This is called after resolving an indexed component or a slice. Name
......
...@@ -251,6 +251,11 @@ begin ...@@ -251,6 +251,11 @@ begin
Write_Switch_Char ("eT=?"); Write_Switch_Char ("eT=?");
Write_Line ("Read target dependent information file ?, e.g. gnateT=tdf"); Write_Line ("Read target dependent information file ?, e.g. gnateT=tdf");
-- Line for -gnateu switch
Write_Switch_Char ("eu");
Write_Line ("Ignore unrecognized style/validity/warning switches");
-- Line for -gnateV switch -- Line for -gnateV switch
Write_Switch_Char ("eV"); Write_Switch_Char ("eV");
......
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