comp.lang.ada
 help / color / mirror / Atom feed
* Problem porting VADS to GNAT
@ 2000-09-03 12:06 Andrew Lynch
       [not found] ` <8ovhhh$bsfe6$2@ID-25716.news.cis.dfn.de>
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Lynch @ 2000-09-03 12:06 UTC (permalink / raw)



One of the guys I am working with at a client complained that "the
compilers on your CD-ROM are crap!" (he was referring to the CCI
Ada-Tour, which contains (old) versions of GNAT and Object-Ada).
This started off a discussion about how portable Ada is etc...

For the project we are using the VADS Ada Compiler Version 6.2.3(c)
for SPARC Solaris 2.3 together with some in-house tools that generate
Ada code from various templates and data definitions. My colleague's
task is to write another code generator with different inputs, but
this uses packages generated by the old tools. He would like to be
able to syntax check the code generated by his tool at home using GNAT
before making new versions of his generator available.

Problem 1:

The existing packages contain hundreds of types and representation
clauses as in the following example:

----------
package foo is

  type numbers is (one, two, three);

  type bummer(bar : numbers := one) is
    record
      case bar is
        when one =>
          eins : integer;
        when two =>
          zwei : integer;
        when three =>
          drei : integer;
      end case;
    end record;

    -- loads of other types

private

  for numbers'Size use 32;
  for numbers use (
    one   => 0,
    two   => 1,
    three => 2);

  -- similiar clauses for bummer and all the other types...
  -- (in the same order as the public declarations)

end foo;
----------

GNAT has these complaints about the code, always regarding the
discriminants of variant record types:

foo.ads:5:08: warning: no more representation items for type "numbers"
defined at line 3
foo.ads:19:03: representation item appears too late
foo.ads:20:03: representation item appears too late

My colleague is using GNAT 3.10p, I tried this example using GNAT 3.13a
with the same results. VADS compiles it just fine.

Is this an Ada83 - Ada95 issue, or is GNAT being too strict or VADS
too lenient? I've tried comparing the relevant sections of the 83 and
95 LRMs but haven't come up with anything obvious.

Also, what effect (if any) is achieved by moving the representation
clauses into the private part? The only thing I can think of is as
documentation for the user: "The representations are none of your
business".

Andrew.

-- 
Andrew Lynch
CCI GmbH
49716 Meppen
lynch@cci.de




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

* Re: Problem porting VADS to GNAT
       [not found] ` <8ovhhh$bsfe6$2@ID-25716.news.cis.dfn.de>
@ 2000-09-06 19:36   ` Andrew Lynch
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Lynch @ 2000-09-06 19:36 UTC (permalink / raw)


Nick Roberts (nickroberts@callnetuk.com) wrote:
: My interpretation of the ARM 83 (13.1) is that the VADS compiler (an Ada 83
: compiler) is entitled to allow the representation clauses where they are
: (but another Ada 83 compiler would be within its rights to reject them).


Ok, thanks for the info. I've now had the time for a closer look at the '83 RM
and 13.1(6) makes me wonder if VADS is indeed entitled to do this:

"In the case of a type, certain occurences of its name imply that the
representation of the type must already have been determined. [...]
In any case, an occurrence within an expression is always forcing."

I think that the discriminant and its default expression would fit the above.
Or does the occurence of the _type_ only mean things such as Numbers'First?

Either way this code is not exactly portable, which is one of the reasons
we are still farting around with VADS. :-(

Andrew.




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

end of thread, other threads:[~2000-09-06 19:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-03 12:06 Problem porting VADS to GNAT Andrew Lynch
     [not found] ` <8ovhhh$bsfe6$2@ID-25716.news.cis.dfn.de>
2000-09-06 19:36   ` Andrew Lynch

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