From patchwork Thu Sep 26 14:12:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 1167940 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-509637-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="QV/EQNqc"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46fH1q71QGz9sNk for ; Fri, 27 Sep 2019 00:12:31 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=KTQc4aVOB14VVVUedwQ5Shpyl98e10cteDS9LNIsR58KuhI3ERti5 G62hAp4HmFEg+hK32VJ/w316CK0S/MlungKKtWNhjLHpO1TCzVlRhm+goIy4SF+a 20pcUsPJqHnC98+9Q2VsR/CDyIRT4NHQXqxer0EWPU0z8qLd5Eiwz0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=fpqVMHYaCy95fqLeTXwseIg0PSs=; b=QV/EQNqcD5HQYDWqepmN IdtJP/q2Z1HJwDJdfWh0lbGf/XuEha0YPhqWcwMMJyV4kzbx7aO8gLky7iOTl19j YLqKEwMplYQRfOCW3Zh8X7qilMGI06vPN5SFqhpTHIuXkOFOodhF4egaiMUboJe+ s+v/hQbfowIecIwp1M+MdVw= Received: (qmail 5786 invoked by alias); 26 Sep 2019 14:12:25 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 5733 invoked by uid 89); 26 Sep 2019 14:12:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1516 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 26 Sep 2019 14:12:23 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id B29E6117ADC for ; Thu, 26 Sep 2019 10:12:21 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id gsswxgtgTObm for ; Thu, 26 Sep 2019 10:12:21 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [205.232.38.10]) by rock.gnat.com (Postfix) with ESMTP id A3331117ADB for ; Thu, 26 Sep 2019 10:12:21 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4192) id 9F6B762C; Thu, 26 Sep 2019 10:12:21 -0400 (EDT) Date: Thu, 26 Sep 2019 10:12:21 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Subject: [Ada] Remove dependency on To_C/To_Ada Message-ID: <20190926141221.GA41017@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) A recent change in osint.adb introduced a dependency on To_C/To_Ada subprograms which are (too) recent additions to System.OS_Lib, breaking builds of cross compilers with an older version of GNAT. Even though this is not guaranteed to work, this dependency is relatively easy to lift, so done. Tested on x86_64-pc-linux-gnu, committed on trunk * osint.adb (OS_Time_To_GNAT_Time): Remove dependency on To_C/To_Ada Index: osint.adb =================================================================== --- osint.adb (revision 276149) +++ osint.adb (working copy) @@ -2183,7 +2183,19 @@ function OS_Time_To_GNAT_Time (T : OS_Time) return Time_Stamp_Type is GNAT_Time : Time_Stamp_Type; - TI : Long_Integer := To_C (T); + type Underlying_OS_Time is + range -(2 ** (Standard'Address_Size - Integer'(1))) .. + +(2 ** (Standard'Address_Size - Integer'(1)) - 1); + -- Underlying_OS_Time is a redeclaration of OS_Time to allow integer + -- manipulation. Remove this in favor of To_Ada/To_C once newer + -- GNAT releases are available with these functions. + + function To_Int is + new Unchecked_Conversion (OS_Time, Underlying_OS_Time); + function From_Int is + new Unchecked_Conversion (Underlying_OS_Time, OS_Time); + + TI : Underlying_OS_Time := To_Int (T); Y : Year_Type; Mo : Month_Type; D : Day_Type; @@ -2205,7 +2217,7 @@ TI := TI + 1; end if; - GM_Split (To_Ada (TI), Y, Mo, D, H, Mn, S); + GM_Split (From_Int (TI), Y, Mo, D, H, Mn, S); Make_Time_Stamp (Year => Nat (Y),