From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9e3c4ec10bb00bb8 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!p77g2000hsh.googlegroups.com!not-for-mail From: Martin Dowie Newsgroups: comp.lang.ada Subject: Re: Ada 2005 core packages under GNAT-GPL-2007 Date: 14 May 2007 13:20:42 -0700 Organization: http://groups.google.com Message-ID: <1179174042.304958.299200@p77g2000hsh.googlegroups.com> References: <1179165457.315362.25970@e65g2000hsc.googlegroups.com> NNTP-Posting-Host: 81.158.224.158 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1179174042 30372 127.0.0.1 (14 May 2007 20:20:42 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 14 May 2007 20:20:42 +0000 (UTC) In-Reply-To: <1179165457.315362.25970@e65g2000hsc.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: p77g2000hsh.googlegroups.com; posting-host=81.158.224.158; posting-account=SUPfBg0AAAD2c27sxTjOFS-ntqB08gQH Xref: g2news1.google.com comp.lang.ada:15797 Date: 2007-05-14T13:20:42-07:00 List-Id: On 14 May, 18:57, Anh Vo wrote: > Ada.Assertions package (AI-286 implemented by Martin Dowie) is part of > Ada 2005 core packages as indicated by 14.4.2(12/2). However, when > compiling codes having "with Ada.Assertions" in the with clause, GNAT > displays ..."Ada.Assertions" is not a predefined library unit. GNAT > does not seem to recognize it. Should a bug report be in order? GNAT GPL 2007 doesn't include an implementation of this package but you can add one yourself. The original one on my web page was provided to allow Ada95 compilers to provide something as close as possible to Ada2005 as possible. For instance, Ada.Assertions could not be "Pure" as it had to rely on Ada.Exceptions for the implementation. This isn't true now we have an Ada2005 compiler! So here's a version you can compile up yourself. Again once compiled you can move the source/.ali/.o files into the appropriate locations. You may wish to change the compilation options too. NB: the file a-assert.adb needs to suppress the GNAT RM-style checks. File a-assert.ads -- (c) 2007 Martin Dowie pragma License (Unrestricted); package Ada.Assertions is pragma Pure (Ada.Assertions); Assertion_Error : exception; procedure Assert (Check : in Boolean); procedure Assert (Check : in Boolean; Message : in String); end Ada.Assertions; File a-assert.adb -- (c) 2007 Martin Dowie package body Ada.Assertions is procedure Assert (Check : in Boolean) is begin if not Check then raise Assertion_Error; end if; end Assert; procedure Assert (Check : in Boolean; Message : in String) is begin if not Check then raise Assertion_Error with Message; end if; end Assert; end Ada.Assertions; GPS project file (test_assertion.gpr): project Test_Assertion is for Object_Dir use "lib"; for Source_Dirs use ("src"); for Main use ("test_assertion.adb"); package Linker is for Default_Switches ("ada") use ("-g"); end Linker; package Binder is for Default_Switches ("ada") use ("-E"); end Binder; package Compiler is for Default_Switches ("ada") use ("-gnato", "-fstack-check", "- gnatE", "-g", "-gnata", "-gnat05"); for Switches ("a-assert.adb") use ("-gnato", "-fstack-check", "- gnatE", "-g", "-gnata", "-gnat05", "-gnatyN"); end Compiler; package Builder is for Default_Switches ("ada") use ("-s", "-g", "-a", "-x"); end Builder; end Test_Assertion; File test_assertion.adb with Ada.Assertions; procedure Test_Assertion is begin Ada.Assertions.Assert (True); Ada.Assertions.Assert (False); end Test_Assertion; The folder structure used was: C:\Ada\test_assertion - test_assertion.gpr C:\Ada\test_assertion\src - a-assert.ads a-assert.adb test_assertion.adb C:\Ada\test_assertion\lib - build files Cheers -- Martin