From patchwork Mon Jul 9 13:05:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 169817 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id B06DE2C0313 for ; Mon, 9 Jul 2012 23:05:55 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1342443956; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=uAUrL62c3JxEDU3D0f1F B4fHUUE=; b=vhrkeOdFSqJ2rU1P7Pb/F7DIKUCDnfBKxI0VzEW0C5uvFWjHWC8x AxTH0UU8HOCogVOjneL9SS+6Px9TZK7MZSTd6dOV0IxEIk7ve6CEPG3DmA/wmd1t dcrWoYMd+YaFEcG4bktOYHzHsBhCYqVW5JUewbZmB3AePtnkX2+rrxg= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=mnnI5MXgRxSFHisR1PcXFQSUPngdjFymSifyKbnXy0EVWDaAG1g4LyVyhupva+ FH2OZFGFuPVjQ9wFMo7NLPWE4EapbhIDaJcVIB2dXIM2s0ZIA22r52djTM+ezwNi smJMvwnTWzI67Woaf+4dKUTtOh2mJR/Px5eIdqqfj+6I8=; Received: (qmail 8358 invoked by alias); 9 Jul 2012 13:05:51 -0000 Received: (qmail 8186 invoked by uid 22791); 9 Jul 2012 13:05:49 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_NO X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 09 Jul 2012 13:05:35 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 7ED391C6816; Mon, 9 Jul 2012 09:05:34 -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 h0i4CI4dT+oh; Mon, 9 Jul 2012 09:05:34 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 638D11C680E; Mon, 9 Jul 2012 09:05:34 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id 5AC2092BF6; Mon, 9 Jul 2012 09:05:34 -0400 (EDT) Date: Mon, 9 Jul 2012 09:05:34 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Gary Dismukes Subject: [Ada] Ada.Streams.Stream_IO is preelaborated Message-ID: <20120709130534.GA16144@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 AI05-0283 requires Ada.Streams.Stream_IO to be declared with a pragma Preelaborate, so that it can be used by other preelaborated units as well as by Remote_Types and Remote_Call_Interface units. The pragma has been added to that package along with several other GNAT library units on which it depends. Other minor changes were made to avoid Preelaborate violations occurring in the body of System.File_IO. Tested on x86_64-pc-linux-gnu, committed on trunk 2012-07-09 Gary Dismukes * a-ststio.ads: Add pragma Preelaborate, per AI05-0283. * i-cstrea.ads (max_path_len): Change from variable to deferred constant to allow it to be used as a bound in string component in type System.File_IO.Temp_File_Record. * s-os_lib.ads, s-commun.ads, s-ficobl.ads, s-fileio.ads: Add pragma Preelaborate. * s-fileio.adb (Get_Case_Sensitive): Move function inside procedure Open. (File_Names_Case_Sensitive): Move variable inside procedure Open, to avoid violation of Preelaborate restriction (due to call to Get_Case_Sensitive). Index: i-cstrea.ads =================================================================== --- i-cstrea.ads (revision 189366) +++ i-cstrea.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1995-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 1995-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -228,9 +228,11 @@ -- pass an actual parameter for buffer that is big enough for any full -- path name. Use max_path_len given below as the size of buffer. - max_path_len : Integer; - -- Maximum length of an allowable full path name on the system, - -- including a terminating NUL character. + max_path_len : constant Integer; + -- max_path_len : Integer; + -- Maximum length of an allowable full path name on the system,including a + -- terminating NUL character. Declared as a constant to allow references + -- from other preelaborated GNAT library packages. private -- The following functions are specialized in the body depending on the Index: a-ststio.ads =================================================================== --- a-ststio.ads (revision 189366) +++ a-ststio.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -38,6 +38,8 @@ package Ada.Streams.Stream_IO is + pragma Preelaborate; + type Stream_Access is access all Root_Stream_Type'Class; type File_Type is limited private; Index: s-commun.ads =================================================================== --- s-commun.ads (revision 189366) +++ s-commun.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2001-2009, AdaCore -- +-- Copyright (C) 2001-2012, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -36,6 +36,8 @@ package System.Communication is + pragma Preelaborate; + function Last_Index (First : Ada.Streams.Stream_Element_Offset; Count : CRTL.size_t) return Ada.Streams.Stream_Element_Offset; Index: s-ficobl.ads =================================================================== --- s-ficobl.ads (revision 189366) +++ s-ficobl.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -41,6 +41,8 @@ package System.File_Control_Block is + pragma Preelaborate; + ---------------------------- -- Ada File Control Block -- ---------------------------- Index: s-os_lib.ads =================================================================== --- s-os_lib.ads (revision 189366) +++ s-os_lib.ads (working copy) @@ -56,6 +56,8 @@ package System.OS_Lib is pragma Elaborate_Body (OS_Lib); + pragma Preelaborate; + ----------------------- -- String Operations -- ----------------------- Index: s-fileio.adb =================================================================== --- s-fileio.adb (revision 189366) +++ s-fileio.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -98,14 +98,6 @@ (C, text_translation_required, "__gnat_text_translation_required"); -- If true, add appropriate suffix to control string for Open - function Get_Case_Sensitive return Integer; - pragma Import (C, Get_Case_Sensitive, - "__gnat_get_file_names_case_sensitive"); - File_Names_Case_Sensitive : constant Boolean := Get_Case_Sensitive /= 0; - -- Set to indicate whether the operating system convention is for file - -- names to be case sensitive (e.g., in Unix, set True), or non case - -- sensitive (e.g., in Windows, set False). - ----------------------- -- Local Subprograms -- ----------------------- @@ -757,6 +749,17 @@ pragma Import (C, Tmp_Name, "__gnat_tmp_name"); -- Set buffer (a String address) with a temporary filename + function Get_Case_Sensitive return Integer; + pragma Import (C, Get_Case_Sensitive, + "__gnat_get_file_names_case_sensitive"); + + File_Names_Case_Sensitive : constant Boolean := Get_Case_Sensitive /= 0; + -- Set to indicate whether the operating system convention is for file + -- names to be case sensitive (e.g., in Unix, set True), or not case + -- sensitive (e.g., in Windows, set False). Declared locally to avoid + -- breaking the Preelaborate rule that disallows function calls at the + -- library level. + Stream : FILEs := C_Stream; -- Stream which we open in response to this request Index: s-fileio.ads =================================================================== --- s-fileio.ads (revision 189366) +++ s-fileio.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -38,6 +38,8 @@ package System.File_IO is + pragma Preelaborate; + package FCB renames System.File_Control_Block; package ICS renames Interfaces.C_Streams;