From 691fe9e05d8bf6d4eb82cf3766205f05d9d8df56 Mon Sep 17 00:00:00 2001 From: charlet Date: Wed, 3 Oct 2012 08:04:27 +0000 Subject: [PATCH] 2012-10-03 Yannick Moy * checks.adb, sem_prag.adb, s-bignum.ads: Minor typo fixes. 2012-10-03 Thomas Quinot * 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 * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192026 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 16 ++++++++++++++++ gcc/ada/checks.adb | 12 ++++++------ gcc/ada/g-socket.adb | 31 ++++++++++++++++++++++++++++++- gcc/ada/s-bignum.ads | 9 +++++---- gcc/ada/sem_ch6.adb | 21 +++++++++++++++++++-- gcc/ada/sem_prag.adb | 2 +- 6 files changed, 77 insertions(+), 14 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index fa3673d..1722033 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,19 @@ +2012-10-03 Yannick Moy + + * checks.adb, sem_prag.adb, s-bignum.ads: Minor typo fixes. + +2012-10-03 Thomas Quinot + + * 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 + + * 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 * gnat_rm.texi: Minor editing. diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index 53be1a6..a70deeb 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -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 diff --git a/gcc/ada/g-socket.adb b/gcc/ada/g-socket.adb index ac03f42..731919b 100644 --- a/gcc/ada/g-socket.adb +++ b/gcc/ada/g-socket.adb @@ -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; -------------------- diff --git a/gcc/ada/s-bignum.ads b/gcc/ada/s-bignum.ads index 7236774..7cc7526 100644 --- a/gcc/ada/s-bignum.ads +++ b/gcc/ada/s-bignum.ads @@ -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. diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 098f943..4990f43 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -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; diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index f7e32a5..029b94b 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -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 -- 2.7.4