Commit ef7c5692 by Arnaud Charlet

[multiple changes]

2009-04-08  Thomas Quinot  <quinot@adacore.com>

	* exp_util.adb: Minor comment fix

2009-04-08  Robert Dewar  <dewar@adacore.com>

	* g-socket.ads: Fix bad syntax in pragma Obsolescent

	* par-ch2.adb (Scan_Pragma_Argument_Association): Check for error of
	argument with no identifier following one that has an identifier. Was
	missed in some cases.

	* sem_prag.adb (Analyze_Pragma, case Check_Policy): Allow Policy
	identifier.
	(Analyze_Pragma, case Obsolescent): Allow Message, Version identifiers

	* snames.adb: Add Name_Policy

	* snames.ads: Add Name_Policy

From-SVN: r145744
parent 4da17013
2009-04-08 Thomas Quinot <quinot@adacore.com>
* exp_util.adb: Minor comment fix
2009-04-08 Robert Dewar <dewar@adacore.com>
* g-socket.ads: Fix bad syntax in pragma Obsolescent
* par-ch2.adb (Scan_Pragma_Argument_Association): Check for error of
argument with no identifier following one that has an identifier. Was
missed in some cases.
* sem_prag.adb (Analyze_Pragma, case Check_Policy): Allow Policy
identifier.
(Analyze_Pragma, case Obsolescent): Allow Message, Version identifiers
* snames.adb: Add Name_Policy
* snames.ads: Add Name_Policy
2009-04-08 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Minor reformatting
......@@ -4844,7 +4844,7 @@ package body Exp_Util is
-- If the expression has an access type (object or subprogram) we
-- assume that the conversion is safe, because the size of the target
-- is safe, even it is a record (which might be treated as having
-- is safe, even if it is a record (which might be treated as having
-- unknown size at this point).
elsif Is_Access_Type (Ityp) then
......
......@@ -386,8 +386,8 @@ package GNAT.Sockets is
procedure Initialize (Process_Blocking_IO : Boolean);
pragma Obsolescent
(Entity => Initialize,
"passing a parameter to Initialize is not supported anymore");
(Entity => Initialize,
Message => "passing a parameter to Initialize is not supported anymore");
-- Previous versions of GNAT.Sockets used to require the user to indicate
-- whether socket I/O was process- or thread-blocking on the platform.
-- This property is now determined automatically when the run-time library
......
......@@ -1171,7 +1171,9 @@ are mentioned in @code{with} clauses).
@noindent
Syntax:
@smallexample @c ada
pragma Check_Policy ([Name =>] Identifier, POLICY_IDENTIFIER);
pragma Check_Policy
([Name =>] Identifier,
[Policy =>] POLICY_IDENTIFIER);
POLICY_IDENTIFIER ::= On | Off | Check | Ignore
@end smallexample
......@@ -3462,7 +3464,9 @@ Syntax:
@smallexample @c ada
pragma Obsolescent
[(Entity => NAME [, static_string_EXPRESSION [,Ada_05]])];
[([Entity =>] NAME
[,[Message =>] static_string_EXPRESSION
[,[Version =>] Ada_05]])];
@end smallexample
@noindent
......@@ -3508,17 +3512,20 @@ The following examples show typical uses of this pragma:
@smallexample @c ada
package p is
pragma Obsolescent
(Entity => p, "use pp instead of p");
(Entity => p, Message => "use pp instead of p");
end p;
package q is
procedure q2;
pragma Obsolescent
(Entity => q2, "use q2new instead");
(Entity => q2,
Message => "use q2new instead");
type R is new integer;
pragma Obsolescent
(Entity => R, "use RR in Ada 2005", Ada_05);
(Entity => R,
Message => "use RR in Ada 2005",
Version => Ada_05);
type M is record
F1 : Integer;
......
......@@ -469,11 +469,14 @@ package body Ch2 is
is
Scan_State : Saved_Scan_State;
Identifier_Node : Node_Id;
Id_Present : Boolean;
begin
Association := New_Node (N_Pragma_Argument_Association, Token_Ptr);
Set_Chars (Association, No_Name);
-- Argument starts with identifier
if Token = Tok_Identifier then
Identifier_Node := Token_Node;
Save_Scan_State (Scan_State); -- at Identifier
......@@ -483,17 +486,24 @@ package body Ch2 is
Identifier_Seen := True;
Scan; -- past arrow
Set_Chars (Association, Chars (Identifier_Node));
Id_Present := True;
-- Case of argument with no identifier
else
Restore_Scan_State (Scan_State); -- to Identifier
if Identifier_Seen then
Error_Msg_SC
("|pragma argument identifier required here (RM 2.8(4))");
end if;
Id_Present := False;
end if;
-- Argument does not start with identifier
else
Id_Present := False;
end if;
if Identifier_Seen and not Id_Present then
Error_Msg_SC
("|pragma argument identifier required here (RM 2.8(4))");
end if;
Set_Expression (Association, P_Expression);
......
......@@ -5789,8 +5789,9 @@ package body Sem_Prag is
-- Check_Policy --
------------------
-- pragma Check_Policy ([Name =>] IDENTIFIER,
-- POLICY_IDENTIFIER;
-- pragma Check_Policy (
-- [Name =>] IDENTIFIER,
-- [Policy =>] POLICY_IDENTIFIER);
-- POLICY_IDENTIFIER ::= ON | OFF | CHECK | IGNORE
......@@ -5800,8 +5801,8 @@ package body Sem_Prag is
when Pragma_Check_Policy =>
GNAT_Pragma;
Check_Arg_Count (2);
Check_No_Identifier (Arg2);
Check_Optional_Identifier (Arg1, Name_Name);
Check_Optional_Identifier (Arg2, Name_Policy);
Check_Arg_Is_One_Of
(Arg2, Name_On, Name_Off, Name_Check, Name_Ignore);
......@@ -6627,12 +6628,11 @@ package body Sem_Prag is
---------------
-- pragma Eliminate (
-- [Unit_Name =>] IDENTIFIER |
-- SELECTED_COMPONENT
-- [,[Entity =>] IDENTIFIER |
-- SELECTED_COMPONENT |
-- STRING_LITERAL]
-- [,]OVERLOADING_RESOLUTION);
-- [Unit_Name =>] IDENTIFIER | SELECTED_COMPONENT,
-- [,[Entity =>] IDENTIFIER |
-- SELECTED_COMPONENT |
-- STRING_LITERAL]
-- [, OVERLOADING_RESOLUTION]);
-- OVERLOADING_RESOLUTION ::= PARAMETER_AND_RESULT_TYPE_PROFILE |
-- SOURCE_LOCATION
......@@ -9059,8 +9059,9 @@ package body Sem_Prag is
-----------------
-- pragma Obsolescent [(
-- [Entity => NAME,]
-- [(static_string_EXPRESSION [, Ada_05])];
-- [Entity => NAME,]
-- [Message => static_string_EXPRESSION
-- [,[Version => Ada_05]] )];
when Pragma_Obsolescent => Obsolescent : declare
Ename : Node_Id;
......@@ -9210,7 +9211,13 @@ package body Sem_Prag is
Ename := Empty;
end if;
Check_No_Identifiers;
if Arg_Count >= 1 then
Check_Optional_Identifier (Arg1, Name_Message);
if Arg_Count = 2 then
Check_Optional_Identifier (Arg2, Name_Version);
end if;
end if;
-- Get immediately preceding declaration
......
......@@ -403,6 +403,7 @@ package body Snames is
"no_task_attributes#" &
"no_task_attributes_package#" &
"on#" &
"policy#" &
"parameter_types#" &
"reference#" &
"restricted#" &
......
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