Cecil and code generation problem.

4 messages Options
Embed this post
Permalink
Phil Malin-3

Cecil and code generation problem.

Reply Threaded More More options
Print post
Permalink
Hi all.

I think there might be a problem with SmartEiffel's code generation for
a particular case of using cecil.  In essence the generated C-code is
trying to get a void* to access an 'id' element, as if it was a structure.

In my application I've written a set of signal handlers, all of which are
classes inheriting from a top-level abstract one, ABSTRACT_SIGNAL_HANDLER,
and hence sharing the routine 'callback'.  My C glue code accesses this
function and I've defined the cecil file as

   eiffel.h
   signal_callback        ABSTRACT_SIGNAL_HANDLER       callback

The generated C-code causing the issue is (I've formatted it a bit):

void
signal_callback(void *C,T8 a1)
{
    ....

   if((((/*no_dispatch.e*/C)->id))!=(INT16_C(246)))
   {
      error1("Bad target type. The expected type is SIGNAL_HANDLER_SIMPLE.",
              0xFFF80007/*l3c0 egl_cecil.se*/);
   }

   ....
}

Am I correct in thinking this is badly generated code?  I actually modified
the C code (not shown above) and cast the above C to T0* (probably not the
correct type but I figured since the first element was 'id' it was ok) and
the program ran as expected.

Cheers,
Phil.

Jörgen Tegnér

Re: Cecil and code generation problem.

Reply Threaded More More options
Print post
Permalink
On Sun, 2009-03-29 at 15:46 +1100, Phil Malin wrote:
> Hi all.
>
> I think there might be a problem with SmartEiffel's code generation
> for
> a particular case of using cecil.  In essence the generated C-code is
> trying to get a void* to access an 'id' element, as if it was a
> structure.
>

I got bitten of this one too. A simple workaround is in
http://websympa.loria.fr/wwsympa/arc/smarteiffel/2009-02/msg00014.html

/Jörgen

>
> Cheers,
> Phil.
>

Phil Malin-3

Re: Cecil and code generation problem.

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Hi Jörgen,

Thanks for that, worked like a treat.  :-)

Cheers,
Phil.

Jörgen Tegnér wrote:
On Sun, 2009-03-29 at 15:46 +1100, Phil Malin wrote:
  
Hi all.

I think there might be a problem with SmartEiffel's code generation
for
a particular case of using cecil.  In essence the generated C-code is
trying to get a void* to access an 'id' element, as if it was a
structure.

    

I got bitten of this one too. A simple workaround is in
http://websympa.loria.fr/wwsympa/arc/smarteiffel/2009-02/msg00014.html

/Jörgen

  
Cheers,
Phil.

    


  

Cyril ADRIAN

Re: Cecil and code generation problem.

Reply Threaded More More options
Print post
Permalink
Hi,

On Mon, Mar 30, 2009 at 12:56 AM, Phil Malin <[hidden email]> wrote:
Jörgen Tegnér wrote:
I got bitten of this one too. A simple workaround is in
http://websympa.loria.fr/wwsympa/arc/smarteiffel/2009-02/msg00014.html

I committed Jörgen's fix this morning.

Best regards,
--
Cyril ADRIAN

http://www.cadrian.net/~cyril