From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36179 invoked by alias); 20 Sep 2019 13:02:49 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 36171 invoked by uid 89); 20 Sep 2019 13:02:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,KAM_NUMSUBJECT autolearn=ham version=3.3.1 spammy=stolen, H*i:sk:FC61E83, Inline, libgnarl X-HELO: smtp.CeBiTec.Uni-Bielefeld.DE Received: from smtp.CeBiTec.Uni-Bielefeld.DE (HELO smtp.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 20 Sep 2019 13:02:48 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 53E7D1BC9; Fri, 20 Sep 2019 15:02:44 +0200 (CEST) Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 9J8vf4Rnaocs; Fri, 20 Sep 2019 15:02:41 +0200 (CEST) Received: from itzacchiuatl.CeBiTec.Uni-Bielefeld.DE (itzacchiuatl.CeBiTec.Uni-Bielefeld.DE [129.70.161.157]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 681471BC7; Fri, 20 Sep 2019 15:02:41 +0200 (CEST) Received: (from ro@localhost) by itzacchiuatl.CeBiTec.Uni-Bielefeld.DE (8.15.2+Sun/8.15.2/Submit) id x8KD2eag019424; Fri, 20 Sep 2019 15:02:40 +0200 (CEST) From: Rainer Orth To: Olivier Hainque Cc: Iain Sandoe , Pierre-Marie de Rodat , gcc-patches@gcc.gnu.org Subject: Re: [Ada] Fix 32/64bit mistake on SYSTEM_INFO component in s-win32 References: <20190918083944.GA145030@adacore.com> <54C6899E-E8CA-464E-93A9-F45E284E8B29@googlemail.com> <302E3795-445D-48F8-82A8-0A645D2D21E4@adacore.com> Date: Fri, 20 Sep 2019 13:02:00 -0000 In-Reply-To: (Olivier Hainque's message of "Fri, 20 Sep 2019 14:21:26 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (usg-unix-v) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-IsSubscribed: yes X-SW-Source: 2019-09/txt/msg01250.txt.bz2 --=-=-= Content-Type: text/plain Content-length: 1401 Hi Olivier, >> On 19 Sep 2019, at 18:40, Olivier Hainque wrote: > >>>> Given that the test cannot compile on anything but *-*-linux* and >>>> *-*-mingw*, I'd rather restrict the test to those two (or more targets >>>> that decide to implement the missing interface). > >> Works for me as well. > [...] >> We can take care of adding the required filter. > > I have just committed the attached patch to this effect. > Thanks again for the heads-up! thanks. > 2019-09-20 Olivier Hainque > > testsuite/ > > * gnat.dg/system_info1.adb: Restrict to *-*-linux* and *-*-mingw*. I'd keep the target list alphabetical. Can do so when the Solaris patch goes in. Here's what I've successfully tested last night on both i386-pc-solaris2.11 and sparc-sun-solaris2.11, shamelessly stolen from the Linux counterparts. If it is acceptable, I'd add *-*-solaris2.* to the target list when merging. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University 2019-09-19 Rainer Orth * libgnarl/s-osinte__solaris.ads (sysconf): Declare. (SC_NPROCESSORS_ONLN): Define. * libgnarl/s-tasinf__solaris.ads (Number_Of_Processors): Declare. * libgnarl/s-tasinf__solaris.adb (N_CPU): New variable. (Number_Of_Processors): New function. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=sol2-libgnat-n_o_p.patch Content-length: 1921 # HG changeset patch # Parent 48b6a952486ff0ee28ce4b9c1bd4f77a4078491d Provide Task_Info.Number_Of_Processors on Solaris diff --git a/gcc/ada/libgnarl/s-osinte__solaris.ads b/gcc/ada/libgnarl/s-osinte__solaris.ads --- a/gcc/ada/libgnarl/s-osinte__solaris.ads +++ b/gcc/ada/libgnarl/s-osinte__solaris.ads @@ -259,6 +259,11 @@ package System.OS_Interface is function To_Timespec (D : Duration) return timespec; pragma Inline (To_Timespec); + function sysconf (name : int) return long; + pragma Import (C, sysconf); + + SC_NPROCESSORS_ONLN : constant := 15; + ------------- -- Process -- ------------- diff --git a/gcc/ada/libgnarl/s-tasinf__solaris.adb b/gcc/ada/libgnarl/s-tasinf__solaris.adb --- a/gcc/ada/libgnarl/s-tasinf__solaris.adb +++ b/gcc/ada/libgnarl/s-tasinf__solaris.adb @@ -84,4 +84,23 @@ package body System.Task_Info is return (False, False); end Unbound_Thread_Attributes; + N_CPU : Natural := 0; + pragma Atomic (N_CPU); + -- Cache CPU number. Use pragma Atomic to avoid a race condition when + -- setting N_CPU in Number_Of_Processors below. + + -------------------------- + -- Number_Of_Processors -- + -------------------------- + + function Number_Of_Processors return Positive is + begin + if N_CPU = 0 then + N_CPU := Natural + (OS_Interface.sysconf (OS_Interface.SC_NPROCESSORS_ONLN)); + end if; + + return N_CPU; + end Number_Of_Processors; + end System.Task_Info; diff --git a/gcc/ada/libgnarl/s-tasinf__solaris.ads b/gcc/ada/libgnarl/s-tasinf__solaris.ads --- a/gcc/ada/libgnarl/s-tasinf__solaris.ads +++ b/gcc/ada/libgnarl/s-tasinf__solaris.ads @@ -139,4 +139,7 @@ package System.Task_Info is Unspecified_Task_Info : constant Task_Info_Type := null; + function Number_Of_Processors return Positive; + -- Returns the number of processors on the running host + end System.Task_Info; --=-=-=--