comp.lang.ada
 help / color / mirror / Atom feed
* Ada 2005 core packages under GNAT-GPL-2007
@ 2007-05-14 17:57 Anh Vo
  2007-05-14 20:14 ` Ludovic Brenta
  2007-05-14 20:20 ` Martin Dowie
  0 siblings, 2 replies; 7+ messages in thread
From: Anh Vo @ 2007-05-14 17:57 UTC (permalink / raw)


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?
Thanks.

AV




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Ada 2005 core packages under GNAT-GPL-2007
  2007-05-14 17:57 Ada 2005 core packages under GNAT-GPL-2007 Anh Vo
@ 2007-05-14 20:14 ` Ludovic Brenta
  2007-05-14 20:20 ` Martin Dowie
  1 sibling, 0 replies; 7+ messages in thread
From: Ludovic Brenta @ 2007-05-14 20:14 UTC (permalink / raw)


Anh Vo writes:
> 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?
> Thanks.

Yes, I suppose so.  AdaCore claim that GNAT GPL 2007 "includes all the
core features of the Ada 2005 language revision", and I was wondering
what was the difference between a "core feature" and a "feature".  It
could be that Ada.Assertions is in the latter category :)

-- 
Ludovic Brenta.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Ada 2005 core packages under GNAT-GPL-2007
  2007-05-14 17:57 Ada 2005 core packages under GNAT-GPL-2007 Anh Vo
  2007-05-14 20:14 ` Ludovic Brenta
@ 2007-05-14 20:20 ` Martin Dowie
  2007-05-14 21:11   ` Anh Vo
  1 sibling, 1 reply; 7+ messages in thread
From: Martin Dowie @ 2007-05-14 20:20 UTC (permalink / raw)


On 14 May, 18:57, Anh Vo <anhvofrc...@gmail.com> 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




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Ada 2005 core packages under GNAT-GPL-2007
  2007-05-14 20:20 ` Martin Dowie
@ 2007-05-14 21:11   ` Anh Vo
  2007-05-16  3:00     ` Randy Brukardt
  0 siblings, 1 reply; 7+ messages in thread
From: Anh Vo @ 2007-05-14 21:11 UTC (permalink / raw)


On May 14, 1:20 pm, Martin Dowie <martin.do...@btopenworld.com> wrote:
> On 14 May, 18:57, Anh Vo <anhvofrc...@gmail.com> 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.

Martin,

Thank you very much for your work. I will do just that for now while
learning if this package is required or optional.

According to Ada 2005 LRM, Ada.Assertions is a core package which is
implementation required.

AV




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Ada 2005 core packages under GNAT-GPL-2007
  2007-05-14 21:11   ` Anh Vo
@ 2007-05-16  3:00     ` Randy Brukardt
  2007-05-22 14:41       ` Anh Vo
  2007-05-22 14:50       ` Anh Vo
  0 siblings, 2 replies; 7+ messages in thread
From: Randy Brukardt @ 2007-05-16  3:00 UTC (permalink / raw)


"Anh Vo" <anhvofrcaus@gmail.com> wrote in message
news:1179177085.116978.75190@w5g2000hsg.googlegroups.com...
...
> > GNAT GPL 2007 doesn't include an implementation of this package but
> > you can add one yourself.
...
> According to Ada 2005 LRM, Ada.Assertions is a core package which is
> implementation required.

I agree. 11.4.2(11/2) says "The following language-defined package exists:"
followed by the definition of Ada.Assertions. It doesn't say that it might
exist if you compile it yourself...I think that's pretty much always true!
;-)

                         Randy.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Ada 2005 core packages under GNAT-GPL-2007
  2007-05-16  3:00     ` Randy Brukardt
@ 2007-05-22 14:41       ` Anh Vo
  2007-05-22 14:50       ` Anh Vo
  1 sibling, 0 replies; 7+ messages in thread
From: Anh Vo @ 2007-05-22 14:41 UTC (permalink / raw)


On May 15, 8:00 pm, "Randy Brukardt" <r...@rrsoftware.com> wrote:
> "Anh Vo" <anhvofrc...@gmail.com> wrote in message
>
> news:1179177085.116978.75190@w5g2000hsg.googlegroups.com...
> ...
>
> > > GNAT GPL 2007 doesn't include an implementation of this package but
> > > you can add one yourself.
> ...
> > According to Ada 2005 LRM, Ada.Assertions is a core package which is
> > implementation required.
>
> I agree. 11.4.2(11/2) says "The following language-defined package exists:"
> followed by the definition of Ada.Assertions. It doesn't say that it might
> exist if you compile it yourself...I think that's pretty much always true!

I reported it. Actually, the issue had been logged prior to my report
according to Robert.

AV




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Ada 2005 core packages under GNAT-GPL-2007
  2007-05-16  3:00     ` Randy Brukardt
  2007-05-22 14:41       ` Anh Vo
@ 2007-05-22 14:50       ` Anh Vo
  1 sibling, 0 replies; 7+ messages in thread
From: Anh Vo @ 2007-05-22 14:50 UTC (permalink / raw)


On May 15, 8:00 pm, "Randy Brukardt" <r...@rrsoftware.com> wrote:
> "Anh Vo" <anhvofrc...@gmail.com> wrote in message
>
> news:1179177085.116978.75190@w5g2000hsg.googlegroups.com...
> ...
>
> > > GNAT GPL 2007 doesn't include an implementation of this package but
> > > you can add one yourself.
> ...
> > According to Ada 2005 LRM, Ada.Assertions is a core package which is
> > implementation required.
>
> I agree. 11.4.2(11/2) says "The following language-defined package exists:"
> followed by the definition of Ada.Assertions. It doesn't say that it might
> exist if you compile it yourself...I think that's pretty much always true!

I reported it. Actually, the issue had been logged prior to my report
according to Robert.

AV




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-05-22 14:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-14 17:57 Ada 2005 core packages under GNAT-GPL-2007 Anh Vo
2007-05-14 20:14 ` Ludovic Brenta
2007-05-14 20:20 ` Martin Dowie
2007-05-14 21:11   ` Anh Vo
2007-05-16  3:00     ` Randy Brukardt
2007-05-22 14:41       ` Anh Vo
2007-05-22 14:50       ` Anh Vo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox