comp.lang.ada
 help / color / mirror / Atom feed
* Compiling with Gnat
@ 1999-01-20  0:00 Roger Hoyle
  1999-01-20  0:00 ` David C. Hoos, Sr.
  1999-01-21  0:00 ` dewar
  0 siblings, 2 replies; 7+ messages in thread
From: Roger Hoyle @ 1999-01-20  0:00 UTC (permalink / raw)



I'm compiling a large (0.7 M lines) application on a sparc using
GNATMAKE 3.10p

The application was originally written on an AIX system so I was expecting
a few problems. The problem I have at the moment is that one of the
specification files won't compile - it gives the following error:

use clause not allowed in predefined spec

The line in the code is :

use Interfaces.C;

and it makes no difference where I put it.

Is this constraint unique to Gnat, and is it permanent, or is there a switch
or equivalent which will allow the use of 'use'. 

Are there any workarounds better than putting appropriate references before
every variable. Would that work?

Any help greatly appreciated.

cheers

Roger.

---------------------------------------------------------------------------
Roger Hoyle                                           rh@signal.dera.gov.uk
Parallel and Distributed Simulation                 Tel: +44 (0)1684 896696
E211, DERA Malvern, WR14 3PS, England               Fax: +44 (0)1684 894389




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

* Re: Compiling with Gnat
  1999-01-20  0:00 Compiling with Gnat Roger Hoyle
@ 1999-01-20  0:00 ` David C. Hoos, Sr.
  1999-01-21  0:00   ` Roger Hoyle
  1999-01-21  0:00 ` dewar
  1 sibling, 1 reply; 7+ messages in thread
From: David C. Hoos, Sr. @ 1999-01-20  0:00 UTC (permalink / raw)



Roger Hoyle wrote in message ...
>
>I'm compiling a large (0.7 M lines) application on a sparc using
>GNATMAKE 3.10p
>
>The application was originally written on an AIX system so I was expecting
>a few problems. The problem I have at the moment is that one of the
>specification files won't compile - it gives the following error:
>
>use clause not allowed in predefined spec


Frequently, the key to understanding what the compiler is saying is to
carefully note every word of the message.  In this case, I suspect the key
word to be "predefined."

What is the name of the file and the name of the unit in which you're
placing this "use" clause?
Does it have the name of one of the langage- or gnat- predefined units?
>
>The line in the code is :
>
>use Interfaces.C;
>
>and it makes no difference where I put it.

Well, if it's not in a predefined spec it should work just fine.
>
>Is this constraint unique to Gnat, and is it permanent, or is there a
switch
>or equivalent which will allow the use of 'use'.
>
>Are there any workarounds better than putting appropriate references before
>every variable. Would that work?
>
Personally, I avoid the use of the "use" clause like the plague, except in
very small scopes, and then usually only for making infix operators visible.

In Ada95, "use" clauses can be replaced by "use type" clauses for primitive
operation visibility.








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

* Re: Compiling with Gnat
  1999-01-21  0:00   ` Roger Hoyle
@ 1999-01-21  0:00     ` rdt
  1999-01-21  0:00     ` David C. Hoos, Sr.
  1999-01-21  0:00     ` robert_dewar
  2 siblings, 0 replies; 7+ messages in thread
From: rdt @ 1999-01-21  0:00 UTC (permalink / raw)


In article <yoxu2xl3q4w.fsf@dymock.dra.hmg.gb>,
  rh@signal.dera.gov.uk (Roger Hoyle) wrote:
> David C. Hoos, Sr. writes:
>
> > Roger Hoyle wrote ...
> > >
> > >use clause not allowed in predefined spec
> >
> > What is the name of the file and the name of the unit in which you're
> > placing this "use" clause?
> > Does it have the name of one of the langage- or gnat- predefined units?
>
> The file is i-cpoerr.ads and the use clause happens in...
>
> package Interfaces.C.POSIX_Error is
>
> > >The line in the code is :
> > >
> > >use Interfaces.C;
> >
> > >Are there any workarounds better than putting appropriate references before
> > >every variable. Would that work?
> >
> > In Ada95, "use" clauses can be replaced by "use type" clauses for primitive
> > operation visibility.
>
> Forgive my ignorance, but could you please explain the "use type" clause, I
> can't find a reference to it an any of my Ada95 texts.

What texts are you using ??

The Ada95 LRM (ISO/IEC 8652:1995(E) - RM95;6.0) refers to use_type_clause in
the index and it is fully explained in section 8.4(4).

Regards
Richard Toy

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




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

* Re: Compiling with Gnat
  1999-01-21  0:00   ` Roger Hoyle
  1999-01-21  0:00     ` rdt
@ 1999-01-21  0:00     ` David C. Hoos, Sr.
  1999-01-21  0:00     ` robert_dewar
  2 siblings, 0 replies; 7+ messages in thread
From: David C. Hoos, Sr. @ 1999-01-21  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3965 bytes --]


Roger Hoyle wrote in message ...
>David C. Hoos, Sr. writes:
>
>> Roger Hoyle wrote ...
>> >
>> >use clause not allowed in predefined spec
>>
>> What is the name of the file and the name of the unit in which you're
>> placing this "use" clause?
>> Does it have the name of one of the langage- or gnat- predefined units?
>
>The file is i-cpoerr.ads and the use clause happens in...
>
>package Interfaces.C.POSIX_Error is
>
>> >The line in the code is :
>> >
>> >use Interfaces.C;
>>
Aha, this looks like a package out of Florist (or perhaps its predecessor
Forest).

These points need to be made, viz:

    1.  This is apredefined package (at least in the GNAT usage of the
term),
        because it is a child of a predefined unit.

    2.  Because it is a child of Interfaces.C, the clause "use Interfaces.C"
is
        meaningless, because a parent is always visible to its children.

    3.  To compile predefined units, gnat requires the use of the -gnatg
switch.

>> >Are there any workarounds better than putting appropriate references
before
>> >every variable. Would that work?
>>
>> In Ada95, "use" clauses can be replaced by "use type" clauses for
primitive
>> operation visibility.
>
>Forgive my ignorance, but could you please explain the "use type" clause, I
>can't find a reference to it an any of my Ada95 texts.
>
I'm curious which Ada95 texts would not discuss this topic.

Here's what the RM95 has to say about it:

8.4 Use Clauses

1 A use_package_clause achieves direct visibility of declarations that
appear in the visible part of a package; a use_type_clause achieves direct
visibility of the primitive operators of a type.

Syntax

2 use_clause ::= use_package_clause | use_type_clause
3 use_package_clause ::= use package_name {, package_name};
4 use_type_clause ::= use type subtype_mark {, subtype_mark};

Legality Rules

5 A package_name of a use_package_clause shall denote a package.

Static Semantics

6 For each use_clause, there is a certain region of text called the scope of
the use_clause. For a use_clause within a context_clause of a
library_unit_declaration or library_unit_renaming_declaration, the scope is
the entire declarative region of the declaration. For a use_clause within a
context_clause of a body, the scope is the entire body and any subunits
(including multiply nested subunits). The scope does not include
context_clauses themselves.

7 For a use_clause immediately within a declarative region, the scope is the
portion of the declarative region starting just after the use_clause and
extending to the end of the declarative region. However, the scope of a
use_clause in the private part of a library unit does not include the
visible part of any public descendant of that library unit.
8 For each package denoted by a package_name of a use_package_clause whose
scope encloses a place, each declaration that occurs immediately within the
declarative region of the package is potentially use-visible at this place
if the declaration is visible at this place. For each type T or T�Class
determined by a subtype_mark of a use_type_clause whose scope encloses a
place, the declaration of each primitive operator of type T is potentially
use-visible at this place if its declaration is visible at this place.

9 A declaration is use-visible if it is potentially use-visible, except in
these naming-conflict cases:

10 � A potentially use-visible declaration is not use-visible if the place
considered is within the immediate scope of a homograph of the declaration.
11 � Potentially use-visible declarations that have the same identifier are
not use-visible unless each of them is an overloadable declaration.

Dynamic Semantics

12 The elaboration of a use_clause has no effect.

Examples

13 Example of a use clause in a context clause:

14 with Ada.Calendar; use Ada;

15 Example of a use type clause:

16 use type Rational_Numbers.Rational; -- see 7.1
Two_Thirds : Rational_Numbers.Rational := 2/3;







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

* Re: Compiling with Gnat
  1999-01-20  0:00 Compiling with Gnat Roger Hoyle
  1999-01-20  0:00 ` David C. Hoos, Sr.
@ 1999-01-21  0:00 ` dewar
  1 sibling, 0 replies; 7+ messages in thread
From: dewar @ 1999-01-21  0:00 UTC (permalink / raw)


In article <yoxww2i3u9l.fsf@dymock.dra.hmg.gb>,
  rh@signal.dera.gov.uk (Roger Hoyle) wrote:

> it gives the following error:

>    use clause not allowed in predefined spec

This is almost certainly an error in your code, but it is
impossible for anyone to guess what without seeing the
specific code.

Robert Dewar
Ada Core Technologies

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




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

* Re: Compiling with Gnat
  1999-01-21  0:00   ` Roger Hoyle
  1999-01-21  0:00     ` rdt
  1999-01-21  0:00     ` David C. Hoos, Sr.
@ 1999-01-21  0:00     ` robert_dewar
  2 siblings, 0 replies; 7+ messages in thread
From: robert_dewar @ 1999-01-21  0:00 UTC (permalink / raw)


In article <yoxu2xl3q4w.fsf@dymock.dra.hmg.gb>,
  rh@signal.dera.gov.uk (Roger Hoyle) wrote:

> The file is i-cpoerr.ads and the use clause happens in...

Either you have misintalled the system, or you are
modifying i-cpoerr.ads (which of course you should not do!)

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




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

* Re: Compiling with Gnat
  1999-01-20  0:00 ` David C. Hoos, Sr.
@ 1999-01-21  0:00   ` Roger Hoyle
  1999-01-21  0:00     ` rdt
                       ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Roger Hoyle @ 1999-01-21  0:00 UTC (permalink / raw)


David C. Hoos, Sr. writes:

> Roger Hoyle wrote ...
> >
> >use clause not allowed in predefined spec
>
> What is the name of the file and the name of the unit in which you're
> placing this "use" clause?
> Does it have the name of one of the langage- or gnat- predefined units?

The file is i-cpoerr.ads and the use clause happens in...

package Interfaces.C.POSIX_Error is

> >The line in the code is :
> >
> >use Interfaces.C;
>
> >Are there any workarounds better than putting appropriate references before
> >every variable. Would that work?
>
> In Ada95, "use" clauses can be replaced by "use type" clauses for primitive
> operation visibility.

Forgive my ignorance, but could you please explain the "use type" clause, I
can't find a reference to it an any of my Ada95 texts.

Thanks

Roger.

---------------------------------------------------------------------------
Roger Hoyle                                           rh@signal.dera.gov.uk
Parallel and Distributed Simulation                 Tel: +44 (0)1684 896696
E211, DERA Malvern, WR14 3PS, England               Fax: +44 (0)1684 894389







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

end of thread, other threads:[~1999-01-21  0:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-01-20  0:00 Compiling with Gnat Roger Hoyle
1999-01-20  0:00 ` David C. Hoos, Sr.
1999-01-21  0:00   ` Roger Hoyle
1999-01-21  0:00     ` rdt
1999-01-21  0:00     ` David C. Hoos, Sr.
1999-01-21  0:00     ` robert_dewar
1999-01-21  0:00 ` dewar

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