From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.0 required=3.0 tests=BAYES_20 autolearn=ham autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: gnoga build fails on Mac Date: Wed, 1 Jul 2020 10:52:03 +0200 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <4bbbd09e-e14f-46f5-a510-bdf0c17eba8fo@googlegroups.com> <57adcbd8-4583-4c0f-8bdf-1ac8bd6c6913o@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 1 Jul 2020 08:52:03 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="b9279e03283a38acb88d14b2fca9feb8"; logging-data="17583"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+jmEw4Evc3qJq2Y6a5LuKEtjdhLbVNi3Q=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 Cancel-Lock: sha1:9wz9KishtfJct+K9lJ+x7dGkqw4= In-Reply-To: Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:59285 List-Id: On 7/1/20 3:09 AM, Randy Brukardt wrote: > > I suppose there could be a compiler bug if Movie_Info is prematurely frozen, > but I suspect it is much more likely that the code is illegal. GNAT didn't > enforce this rule until recently (it has recently been catching up with > newer ACATS tests for newer incompatible rules), so I find it likely that > the code is wrong. It's certainly possible that the code is wrong, but if so, I'd like to understand why. This is a small demo program for Gnoga, and as Gnoga uses Ada 12 I wrote it with Ada 12 features. I normally use the previous version of the language, so my understanding of the changes in this area may be lacking. As the code is only 115 lines total, I include it here (long lines may wrap): -- Demo for DB_Maker: Catalog your extensive collection of BetaMax videotape cassettes! -- -- Copyright (C) 2017 by Jeffrey R. Carter -- with DB_Maker; with PragmARC.B_Strings; procedure Movies is subtype Strng is PragmARC.B_Strings.B_String (Max_Length => 100); use type Strng; type Movie_Info is record Title : Strng; Year : Strng; Director : Strng; Writer : Strng; Male_Lead : Strng; Female_Lead : Strng; end record; function "=" (Left : Movie_Info; Right : Movie_Info) return Boolean is (Left.Title = Right.Title and Left.Year = Right.Year and Left.Director = Right.Director); function "<" (Left : Movie_Info; Right : Movie_Info) return Boolean is -- Empty begin -- "<" if Left.Title /= Right.Title then return Left.Title < Right.Title; end if; if Left.Year /= Right.Year then return Left.Year < Right.Year; end if; return Left.Director < Right.Director; end "<"; subtype Field_Number is Integer range 1 .. 6; function Field_Name (Field : in Field_Number) return String is -- Empty begin -- Field_Name case Field is when 1 => return "Title"; when 2 => return "Year"; when 3 => return "Director"; when 4 => return "Screenplay"; when 5 => return "Male Lead"; when 6 => return "Female Lead"; end case; end Field_Name; function Value (Item : in Movie_Info; Field : in Field_Number) return String is -- Empty begin -- Value case Field is when 1 => return +Item.Title; when 2 => return +Item.Year; when 3 => return +Item.Director; when 4 => return +Item.Writer; when 5 => return +Item.Male_Lead; when 6 => return +Item.Female_Lead; end case; end Value; procedure Put (Item : in out Movie_Info; Field : in Field_Number; Value : in String) is -- Empty begin -- Put case Field is when 1 => Item.Title.Assign (From => Value); when 2 => Item.Year.Assign (From => Value); when 3 => Item.Director.Assign (From => Value); when 4 => Item.Writer.Assign (From => Value); when 5 => Item.Male_Lead.Assign (From => Value); when 6 => Item.Female_Lead.Assign (From => Value); end case; end Put; package Movie_DB is new DB_Maker (Max_Field_Length => 100, File_Name => "Movies", Field_Number => Field_Number, Field_Name => Field_Name, Element => Movie_Info, Value => Value, Put => Put); begin -- Movies null; end Movies; -- -- This is free software; you can redistribute it and/or modify it under -- terms of the GNU General Public License as published by the Free Software -- Foundation; either version 2, or (at your option) any later version. -- This software is distributed in the hope that it will be useful, but WITH -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- for more details. Free Software Foundation, 59 Temple Place - Suite -- 330, Boston, MA 02111-1307, USA. Thanks for any insight you or others can provide. -- Jeff Carter "Propose to an Englishman any principle, or any instrument, however admirable, and you will observe that the whole effort of the English mind is directed to find a difficulty, a defect, or an impossibility in it. If you speak to him of a machine for peeling a potato, he will pronounce it impossible: if you peel a potato with it before his eyes, he will declare it useless, because it will not slice a pineapple." Charles Babbage 92