[multiple changes]

2012-10-03  Yannick Moy  <moy@adacore.com>

	* checks.adb, sem_prag.adb, s-bignum.ads: Minor typo fixes.

2012-10-03  Thomas Quinot  <quinot@adacore.com>

	* g-socket.adb (Connect_Socket, version with timeout): When the
	newly-connected socket is reported as available for writing, check
	whether it has a pending asynchronous error prior to returning.

2012-10-03  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch6.adb (Check_Conformance): Additional info when subtype
	conformance fails, due to a missing null exclusion indicatar in
	a formal that must match a controlling access formal.

From-SVN: r192026
This commit is contained in:
Arnaud Charlet 2012-10-03 10:04:27 +02:00
parent bd2e46c825
commit 3ada950b10
6 changed files with 77 additions and 14 deletions

View File

@ -1,3 +1,19 @@
2012-10-03 Yannick Moy <moy@adacore.com>
* checks.adb, sem_prag.adb, s-bignum.ads: Minor typo fixes.
2012-10-03 Thomas Quinot <quinot@adacore.com>
* g-socket.adb (Connect_Socket, version with timeout): When the
newly-connected socket is reported as available for writing, check
whether it has a pending asynchronous error prior to returning.
2012-10-03 Ed Schonberg <schonberg@adacore.com>
* sem_ch6.adb (Check_Conformance): Additional info when subtype
conformance fails, due to a missing null exclusion indicatar in
a formal that must match a controlling access formal.
2012-10-02 Ben Brosgol <brosgol@adacore.com>
* gnat_rm.texi: Minor editing.

View File

@ -195,15 +195,15 @@ package body Checks is
procedure Apply_Arithmetic_Overflow_Checked_Suppressed (N : Node_Id);
-- Used to apply arithmetic overflow checks for all cases except operators
-- on signed arithmetic types in Minimized/Eliminate case (for which we
-- on signed arithmetic types in MINIMIZED/ELIMINATED case (for which we
-- call Apply_Arithmetic_Overflow_Minimized_Eliminated below). N is always
-- a signed integer arithmetic operator (if and case expressions are not
-- included for this case).
procedure Apply_Arithmetic_Overflow_Minimized_Eliminated (Op : Node_Id);
-- Used to apply arithmetic overflow checks for the case where the overflow
-- checking mode is Minimized or Eliminated (and the Do_Overflow_Check flag
-- is known to be set) and we have an signed integer arithmetic op (which
-- checking mode is MINIMIZED or ELIMINATED (and the Do_Overflow_Check flag
-- is known to be set) and we have a signed integer arithmetic op (which
-- includes the case of if and case expressions).
procedure Apply_Division_Check
@ -317,7 +317,7 @@ package body Checks is
-- integer operands. This includes unary and binary operators, and also
-- if and case expression nodes where the dependent expressions are of
-- a signed integer type. These are the kinds of nodes for which special
-- handling applies in MINIMIZED or EXTENDED overflow checking mode.
-- handling applies in MINIMIZED or ELIMINATED overflow checking mode.
function Range_Or_Validity_Checks_Suppressed
(Expr : Node_Id) return Boolean;
@ -774,7 +774,7 @@ package body Checks is
then
Apply_Arithmetic_Overflow_Checked_Suppressed (N);
-- Otherwise use the new routine for Minimized/Eliminated modes for
-- Otherwise use the new routine for MINIMIZED/ELIMINATED modes for
-- the case of a signed integer arithmetic op, with Do_Overflow_Check
-- set True, and the checking mode is Minimized_Or_Eliminated.
@ -4468,7 +4468,7 @@ package body Checks is
end if;
-- Remainder of processing is for Checked case, and is unchanged from
-- earlier versions preceding the addition of Minimized/Eliminated.
-- earlier versions preceding the addition of MINIMIZED/ELIMINATED.
-- Nothing to do if the range of the result is known OK. We skip this
-- for conversions, since the caller already did the check, and in any

View File

@ -123,7 +123,7 @@ package body GNAT.Sockets is
function Resolve_Error
(Error_Value : Integer;
From_Errno : Boolean := True) return Error_Type;
-- Associate an enumeration value (error_type) to en error value (errno).
-- Associate an enumeration value (error_type) to an error value (errno).
-- From_Errno prevents from mixing h_errno with errno.
function To_Name (N : String) return Name_Type;
@ -702,6 +702,13 @@ package body GNAT.Sockets is
Req : Request_Type;
-- Used to set Socket to non-blocking I/O
Conn_Err : aliased Integer;
-- Error status of the socket after completion of select(2)
Res : C.int;
Conn_Err_Size : aliased C.int := Conn_Err'Size / 8;
-- For getsockopt(2) call
begin
if Selector /= null and then not Is_Open (Selector.all) then
raise Program_Error with "closed selector";
@ -735,10 +742,32 @@ package body GNAT.Sockets is
Selector => Selector,
Status => Status);
-- Check error condition (the asynchronous connect may have terminated
-- with an error, e.g. ECONNREFUSED) if select(2) completed.
if Status = Completed then
Res := C_Getsockopt
(C.int (Socket), SOSC.SOL_SOCKET, SOSC.SO_ERROR,
Conn_Err'Address, Conn_Err_Size'Access);
if Res /= 0 then
Conn_Err := Socket_Errno;
end if;
else
Conn_Err := 0;
end if;
-- Reset the socket to blocking I/O
Req := (Name => Non_Blocking_IO, Enabled => False);
Control_Socket (Socket, Request => Req);
-- Report error condition if any
if Conn_Err /= 0 then
Raise_Socket_Error (Conn_Err);
end if;
end Connect_Socket;
--------------------

View File

@ -70,10 +70,11 @@ package System.Bignums is
end record;
type Bignum is access all Bignum_Data;
-- This the type that is used externally. Possibly this could be a private
-- type, but we leave the structure exposed for now. For one thing it helps
-- with debugging. Note that this package never shares an allocated Bignum
-- value, so for example for X + 0, a copy of X is returned, not X itself.
-- This is the type that is used externally. Possibly this could be a
-- private type, but we leave the structure exposed for now. For one
-- thing it helps with debugging. Note that this package never shares
-- an allocated Bignum value, so for example for X + 0, a copy of X is
-- returned, not X itself.
-- Note: none of the subprograms in this package modify the Bignum_Data
-- records referenced by Bignum arguments of mode IN.

View File

@ -5756,14 +5756,31 @@ package body Sem_Ch6 is
declare
TSS_Name : constant TSS_Name_Type := Get_TSS_Name (New_Id);
begin
if TSS_Name /= TSS_Stream_Read
and then TSS_Name /= TSS_Stream_Write
and then TSS_Name /= TSS_Stream_Input
and then TSS_Name /= TSS_Stream_Output
then
Conformance_Error
("\type of & does not match!", New_Formal);
-- Here we have a definite conformance error. It is worth
-- special casesing the error message for the case of a
-- controlling formal (which excludes null).
if Is_Controlling_Formal (New_Formal) then
Error_Msg_Node_2 := Scope (New_Formal);
Conformance_Error
("\controlling formal& of& excludes null, "
& "declaration must exclude null as well",
New_Formal);
-- Normal case (couldn't we give more detail here???)
else
Conformance_Error
("\type of & does not match!", New_Formal);
end if;
return;
end if;
end;

View File

@ -11773,7 +11773,7 @@ package body Sem_Prag is
-- MODE := SUPPRESSED | CHECKED | MINIMIZED | ELIMINATED
-- Note: MINIMIZED is allowed only if Long_Long_Integer'Size is 64
-- Note: ELIMINATED is allowed only if Long_Long_Integer'Size is 64
-- since System.Bignums makes this assumption.
when Pragma_Overflow_Checks => Overflow_Checks : declare