comp.lang.ada
 help / color / mirror / Atom feed
* gnade error
@ 2006-11-14  8:08 Brian May
  2006-11-14  9:20 ` Dmitry A. Kazakov
  2006-11-14 13:42 ` Stephen Leake
  0 siblings, 2 replies; 9+ messages in thread
From: Brian May @ 2006-11-14  8:08 UTC (permalink / raw)


Hello,

What does the following error mean:

make core-all >>build.log
gnatmake: "/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/linux-gnu-powerpc-libexec/prep" up to date.
gnatmake: "/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/linux-gnu-powerpc-libexec/cfgget" up to date.
gnatmake: "/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/linux-gnu-powerpc-libexec/cfgset" up to date.
gnatmake: "/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/linux-gnu-powerpc-libexec/prep" up to date.
gnatmake: "/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/linux-gnu-powerpc-libexec/cfgget" up to date.
gnatmake: "/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/linux-gnu-powerpc-libexec/cfgset" up to date.
gnatmake: "/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/linux-gnu-powerpc-libexec/prep" up to date.
gnatmake: "/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/linux-gnu-powerpc-libexec/cfgget" up to date.
gnatmake: "/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/linux-gnu-powerpc-libexec/cfgset" up to date.
completed 1 out of 6 (16%)...
completed 2 out of 6 (33%)...
completed 3 out of 6 (50%)...
completed 4 out of 6 (66%)...
completed 5 out of 6 (83%)...
completed 6 out of 6 (100%)...
gnatmake: objects up to date.
make odbc-all >>build.log
gcc-4.1 -c -g -gnatQ -I/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/linux-gnu-powerpc-include -g -O3 -gnatn -gnatf -gnatwa -gnatwL -gnaty3abefhiklM120prtn -I- -gnatA /home/bam/tmp/ada/gnade/gnade-src-1.5.3b/dbi/odbc/gnu-db-sqlcli-dispatch-a_array.adb
gnu-db-sqlcli.adb:134:42: cannot inline "To_Ada" (call returns unconstrained type)
gnatmake: "/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/dbi/odbc/gnu-db-sqlcli-dispatch-a_array.adb" compilation error
make[3]: *** [all] Error 4
make[2]: *** [odbc] Error 2
make[1]: *** [odbc-all] Error 2
make: *** [all] Error 2

The code in question is:

   function To_Ada (State : C_SQLSTATE) return SQLSTATE is
      use Ada.Strings.Fixed;
      S : constant String := Interfaces.C.To_Ada (State, False);
      R : SQLSTATE;
   begin
      Move (Source => S, Target => R);
      SQLFixNTS (R);
      return R;
   end To_Ada;

It looks OK to me...
-- 
Brian May <bam@snoopy.apana.org.au>



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

* Re: gnade error
  2006-11-14  8:08 gnade error Brian May
@ 2006-11-14  9:20 ` Dmitry A. Kazakov
  2006-11-14 13:42 ` Stephen Leake
  1 sibling, 0 replies; 9+ messages in thread
From: Dmitry A. Kazakov @ 2006-11-14  9:20 UTC (permalink / raw)


On Tue, 14 Nov 2006 19:08:28 +1100, Brian May wrote:

> What does the following error mean:
> 
> make core-all >>build.log
> gnatmake: "/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/linux-gnu-powerpc-libexec/prep" up to date.
> gnatmake: "/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/linux-gnu-powerpc-libexec/cfgget" up to date.
> gnatmake: "/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/linux-gnu-powerpc-libexec/cfgset" up to date.
> gnatmake: "/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/linux-gnu-powerpc-libexec/prep" up to date.
> gnatmake: "/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/linux-gnu-powerpc-libexec/cfgget" up to date.
> gnatmake: "/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/linux-gnu-powerpc-libexec/cfgset" up to date.
> gnatmake: "/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/linux-gnu-powerpc-libexec/prep" up to date.
> gnatmake: "/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/linux-gnu-powerpc-libexec/cfgget" up to date.
> gnatmake: "/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/linux-gnu-powerpc-libexec/cfgset" up to date.
> completed 1 out of 6 (16%)...
> completed 2 out of 6 (33%)...
> completed 3 out of 6 (50%)...
> completed 4 out of 6 (66%)...
> completed 5 out of 6 (83%)...
> completed 6 out of 6 (100%)...
> gnatmake: objects up to date.
> make odbc-all >>build.log
> gcc-4.1 -c -g -gnatQ -I/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/linux-gnu-powerpc-include -g -O3 -gnatn -gnatf -gnatwa -gnatwL -gnaty3abefhiklM120prtn -I- -gnatA /home/bam/tmp/ada/gnade/gnade-src-1.5.3b/dbi/odbc/gnu-db-sqlcli-dispatch-a_array.adb
> gnu-db-sqlcli.adb:134:42: cannot inline "To_Ada" (call returns unconstrained type)
> gnatmake: "/home/bam/tmp/ada/gnade/gnade-src-1.5.3b/dbi/odbc/gnu-db-sqlcli-dispatch-a_array.adb" compilation error
> make[3]: *** [all] Error 4
> make[2]: *** [odbc] Error 2
> make[1]: *** [odbc-all] Error 2
> make: *** [all] Error 2
> 
> The code in question is:
> 
>    function To_Ada (State : C_SQLSTATE) return SQLSTATE is
>       use Ada.Strings.Fixed;
>       S : constant String := Interfaces.C.To_Ada (State, False);
>       R : SQLSTATE;
>    begin
>       Move (Source => S, Target => R);
>       SQLFixNTS (R);
>       return R;
>    end To_Ada;
> 
> It looks OK to me...

[ I had submitted this to GNADE, it was confirmed as a bug, but I am not
sure if that isn't actually a GNAT bug. ]

I rewrote it without all that conversion stuff, and it worked fine. After
all it is all about a 5-character C array being converted to a string!
(:-))

See:

http://sourceforge.net/tracker/index.php?func=detail&aid=1559830&group_id=23045&atid=377331

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



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

* Re: gnade error
  2006-11-14  8:08 gnade error Brian May
  2006-11-14  9:20 ` Dmitry A. Kazakov
@ 2006-11-14 13:42 ` Stephen Leake
  2006-11-14 17:01   ` Jeffrey R. Carter
  2006-11-14 23:52   ` Brian May
  1 sibling, 2 replies; 9+ messages in thread
From: Stephen Leake @ 2006-11-14 13:42 UTC (permalink / raw)


Brian May <bam@snoopy.apana.org.au> writes:

> gnu-db-sqlcli.adb:134:42: cannot inline "To_Ada" (call returns
> unconstrained type) 

That seems clear to me.

> The code in question is:
>
>    function To_Ada (State : C_SQLSTATE) return SQLSTATE is
>       use Ada.Strings.Fixed;
>       S : constant String := Interfaces.C.To_Ada (State, False);
>       R : SQLSTATE;
>    begin
>       Move (Source => S, Target => R);
>       SQLFixNTS (R);
>       return R;
>    end To_Ada;
>
> It looks OK to me...

It's _legal_, but somewhere the code requests inlining of To_Ada,
which GNAT can't do, for the reason stated.

The fix is to remove the 'pragma Inline'.

-- 
-- Stephe



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

* Re: gnade error
  2006-11-14 13:42 ` Stephen Leake
@ 2006-11-14 17:01   ` Jeffrey R. Carter
  2006-11-14 17:52     ` Adam Beneschan
  2006-11-14 23:52   ` Brian May
  1 sibling, 1 reply; 9+ messages in thread
From: Jeffrey R. Carter @ 2006-11-14 17:01 UTC (permalink / raw)


Stephen Leake wrote:
> Brian May <bam@snoopy.apana.org.au> writes:
> 
>> gnu-db-sqlcli.adb:134:42: cannot inline "To_Ada" (call returns
>> unconstrained type) 
> 
> That seems clear to me.
> 
> It's _legal_, but somewhere the code requests inlining of To_Ada,
> which GNAT can't do, for the reason stated.
> 
> The fix is to remove the 'pragma Inline'.

A pragma Inline should not cause a compilation error. The presence or 
absence of a pragma should not change a legal program to an illegal 
program nor illegal to legal.

-- 
Jeff Carter
"Help! Help! I'm being repressed!"
Monty Python & the Holy Grail
67



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

* Re: gnade error
  2006-11-14 17:01   ` Jeffrey R. Carter
@ 2006-11-14 17:52     ` Adam Beneschan
  2006-11-15  1:23       ` Jeffrey R. Carter
  0 siblings, 1 reply; 9+ messages in thread
From: Adam Beneschan @ 2006-11-14 17:52 UTC (permalink / raw)


Jeffrey R. Carter wrote:
> Stephen Leake wrote:
> > Brian May <bam@snoopy.apana.org.au> writes:
> >
> >> gnu-db-sqlcli.adb:134:42: cannot inline "To_Ada" (call returns
> >> unconstrained type)
> >
> > That seems clear to me.
> >
> > It's _legal_, but somewhere the code requests inlining of To_Ada,
> > which GNAT can't do, for the reason stated.
> >
> > The fix is to remove the 'pragma Inline'.
>
> A pragma Inline should not cause a compilation error. The presence or
> absence of a pragma should not change a legal program to an illegal
> program nor illegal to legal.

This really isn't true.  First of all, many pragmas defined by the
language have legality rules, and using a pragma that violates the
legality rules makes your program illegal.  As for Inline, there's a
legality rule that the names listed need to be callable entities, plus
there are rules about where Inline pragmas can be placed.  Violating
those rules will make your program illegal.

  The RM says that Inline is a recommendation that an implementation is
free to ignore.  Using an Inline that will get ignored will not make
your program illegal according to the RM, but that is *not* the same as
saying that it shouldn't cause a compilation error; there are plenty of
reasons why users might want a compiler to reject a legal program, and
using an ignored Inline might be one reason, especially if a warning
message might get missed during a "make".  Maybe one of the GNAT flags
Brian used told it to reject pragmas it couldn't handle.  I don't know
GNAT very well so I can't say.

Finally, the statement "The presence or absence of a pragma should not
change a legal program to an illegal program nor illegal to legal"
isn't true even for implementation-defined pragmas.  2.8(17) does say
an implementation-defined pragma should not make an illegal program
legal, but it also lists a couple exceptions to this rule.  2.8 also
implies that a pragma that is not defined by the language nor by the
implementation is ignored, but syntax rules still apply.  However, if
you use an implementation-defined pragma but violate the
implementation-defined rules for that pragma, there's nothing I can see
in 2.8 that says your program is still legal.  That decision is left up
to the implementation.

                          -- Adam




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

* Re: gnade error
  2006-11-14 13:42 ` Stephen Leake
  2006-11-14 17:01   ` Jeffrey R. Carter
@ 2006-11-14 23:52   ` Brian May
  2006-11-15  0:07     ` Ludovic Brenta
  1 sibling, 1 reply; 9+ messages in thread
From: Brian May @ 2006-11-14 23:52 UTC (permalink / raw)


>>>>> "Stephen" == Stephen Leake <stephen_leake@stephe-leake.org> writes:

    Stephen> It's _legal_, but somewhere the code requests inlining of
    Stephen> To_Ada, which GNAT can't do, for the reason stated.

    Stephen> The fix is to remove the 'pragma Inline'.

I had a brief search but couldn't find any pragma Inline. Possibly I
missed something...
-- 
Brian May <bam@snoopy.apana.org.au>



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

* Re: gnade error
  2006-11-14 23:52   ` Brian May
@ 2006-11-15  0:07     ` Ludovic Brenta
  0 siblings, 0 replies; 9+ messages in thread
From: Ludovic Brenta @ 2006-11-15  0:07 UTC (permalink / raw)


Brian May <bam@snoopy.apana.org.au> writes:

>>>>>> "Stephen" == Stephen Leake <stephen_leake@stephe-leake.org> writes:
>
>     Stephen> It's _legal_, but somewhere the code requests inlining of
>     Stephen> To_Ada, which GNAT can't do, for the reason stated.
>
>     Stephen> The fix is to remove the 'pragma Inline'.
>
> I had a brief search but couldn't find any pragma Inline. Possibly I
> missed something...

Are you using gnade 1.6.1-1 in Debian?  I've fixed this problem with a
patch.  Look in the source package (apt-get source gnade) for the file
patches/inline_functions_returning_unconstrained_types.patch

:)

-- 
Ludovic Brenta.



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

* Re: gnade error
  2006-11-14 17:52     ` Adam Beneschan
@ 2006-11-15  1:23       ` Jeffrey R. Carter
  2006-11-15 14:28         ` Robert A Duff
  0 siblings, 1 reply; 9+ messages in thread
From: Jeffrey R. Carter @ 2006-11-15  1:23 UTC (permalink / raw)


Adam Beneschan wrote:
> 
> This really isn't true.  First of all, many pragmas defined by the
> language have legality rules, and using a pragma that violates the
> legality rules makes your program illegal.  As for Inline, there's a
> legality rule that the names listed need to be callable entities, plus
> there are rules about where Inline pragmas can be placed.  Violating
> those rules will make your program illegal.

OK, a *legal* pragma should not ...

-- 
Jeff Carter
"Help! Help! I'm being repressed!"
Monty Python & the Holy Grail
67



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

* Re: gnade error
  2006-11-15  1:23       ` Jeffrey R. Carter
@ 2006-11-15 14:28         ` Robert A Duff
  0 siblings, 0 replies; 9+ messages in thread
From: Robert A Duff @ 2006-11-15 14:28 UTC (permalink / raw)


"Jeffrey R. Carter" <spam.not.jrcarter@acm.not.spam.org> writes:

> OK, a *legal* pragma should not ...

There are many pragmas that cause other parts of the program to be
illegal.  Pragma Restrictions, for example, has that as its main
purpose.  A pragma that goes the other direction (causes an otherwise
illegal program to be legal) is in rather poor taste, but there are some
cases of that, too -- rather obscure cases.

But you're right about pragma Inline -- a pragma Inline cannot affect
the legality of the program (so long as the pragma itself obeys the
rules, such as the names have to denote subprograms).

However, many compilers have switches that invoke nonstandard modes.
In GNAT, you can tell it to warn about pragmas Inline that are not
obeyed, and you can also tell it to treat warnings as errors (-gnatwe
switch).  In this nonstandard mode, a pragma Inline that does not inline
makes the program illegal.

- Bob



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

end of thread, other threads:[~2006-11-15 14:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-14  8:08 gnade error Brian May
2006-11-14  9:20 ` Dmitry A. Kazakov
2006-11-14 13:42 ` Stephen Leake
2006-11-14 17:01   ` Jeffrey R. Carter
2006-11-14 17:52     ` Adam Beneschan
2006-11-15  1:23       ` Jeffrey R. Carter
2006-11-15 14:28         ` Robert A Duff
2006-11-14 23:52   ` Brian May
2006-11-15  0:07     ` Ludovic Brenta

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