Thread overview
DMDFE - where retStyle() is defined ?
Mar 25, 2007
Carlos Smith
Mar 25, 2007
Walter Bright
Mar 25, 2007
Carlos Smith
Mar 25, 2007
Walter Bright
Mar 25, 2007
Ary Manzana
Mar 25, 2007
Walter Bright
Mar 25, 2007
Ary Manzana
March 25, 2007
Hi,

I am trying to bring DMDFE 0.173 to the 1.009 level.

The last thing missing to allow the production
of an exe is an undefined reference to a function
retStyle().

That function is declared in mtype.h
within the struct TypeFunction, but
is not defined anywhere.

The declaration is also present in the version 0.173 but is not used anywhere.

It is used by func.c in version 1.009.

Where is defined that function ?

I grepped every thing in the distribution and
i did not found it.




March 25, 2007
Carlos Smith wrote:
> Hi,
> 
> I am trying to bring DMDFE 0.173 to the 1.009 level.
> 
> The last thing missing to allow the production
> of an exe is an undefined reference to a function retStyle().
-------------------------------------------------------------

> /***************************
>  * Determine return style of function.
>  */
> 
> enum RET TypeFunction::retStyle()
> {
>     /* For C++ and Pascal, structs and reals are on the stack.
>        For C, reals and 1,2,4 byte structs are return in registers,
>        others are returned in a static.
>      */
>     //printf("TypeFunction::retStyle() %s\n", toChars());
>     Type *tn = next->toBasetype();
> 
>     if (tn->ty == Tstruct)
>     {
>         if (global.params.isLinux && linkage != LINKd)
>             ;
>         else
>         {
>             switch ((int)tn->size())
>             {   case 1:
>                 case 2:
>                 case 4:
>                 case 8:
>                     return RETregs;     // return small structs in regs
>                                         // (not 3 byte structs!)
>                 default:
>                     break;
>             }
>         }
>         return RETstack;
>     }
>     else if (global.params.isLinux &&
>              linkage == LINKc &&
>              tn->iscomplex())
>     {
>         if (tn->ty == Tcomplex32)
>             return RETregs;     // in EDX:EAX, not ST1:ST0
>         else
>             return RETstack;
>     }
>     else
>         return RETregs;
> }
March 25, 2007
"Walter Bright" <newshound@digitalmars.com> wrote

> enum RET TypeFunction::retStyle() { ... }

Hey Walter,

Many thanks for the fast response.
Just updated mtype.c with this code, and
every think linked Ok !

So dmdfe.exe now display V 1.009.

Now, may i politely ask why the dmd-1.009 source
code did not have it ?




March 25, 2007
Walter Bright escribió:
> Carlos Smith wrote:
>> Hi,
>>
>> I am trying to bring DMDFE 0.173 to the 1.009 level.
>>
>> The last thing missing to allow the production
>> of an exe is an undefined reference to a function retStyle().
> -------------------------------------------------------------
> 
>> /***************************
>>  * Determine return style of function.
>>  */
>>
>> enum RET TypeFunction::retStyle()
>> {
>>     /* For C++ and Pascal, structs and reals are on the stack.
>>        For C, reals and 1,2,4 byte structs are return in registers,
>>        others are returned in a static.
>>      */
>>     //printf("TypeFunction::retStyle() %s\n", toChars());
>>     Type *tn = next->toBasetype();
>>
>>     if (tn->ty == Tstruct)
>>     {
>>         if (global.params.isLinux && linkage != LINKd)
>>             ;
>>         else
>>         {
>>             switch ((int)tn->size())
>>             {   case 1:
>>                 case 2:
>>                 case 4:
>>                 case 8:
>>                     return RETregs;     // return small structs in regs
>>                                         // (not 3 byte structs!)
>>                 default:
>>                     break;
>>             }
>>         }
>>         return RETstack;
>>     }
>>     else if (global.params.isLinux &&
>>              linkage == LINKc &&
>>              tn->iscomplex())
>>     {
>>         if (tn->ty == Tcomplex32)
>>             return RETregs;     // in EDX:EAX, not ST1:ST0
>>         else
>>             return RETstack;
>>     }
>>     else
>>         return RETregs;
>> }

Thanks, I need that for Descent (for the moment I used a stub function and thought I didn't search well). May I also ask why is this code missing? Maybe it's part of the backend?

I'd also like to know what a Symbol (not Dsymbol) is, and wether I'll need it to point out semantic errors.

Thanks,
Ary
March 25, 2007
Carlos Smith wrote:
> "Walter Bright" <newshound@digitalmars.com> wrote
> 
>> enum RET TypeFunction::retStyle() { ... }
> 
> Hey Walter,
> 
> Many thanks for the fast response.
> Just updated mtype.c with this code, and
> every think linked Ok !
> 
> So dmdfe.exe now display V 1.009.
> 
> Now, may i politely ask why the dmd-1.009 source
> code did not have it ?

It's part of the back end, not the front end.
March 25, 2007
Ary Manzana wrote:
> I'd also like to know what a Symbol (not Dsymbol) is, and wether I'll need it to point out semantic errors.

It's a backend symbol.
March 25, 2007
Walter Bright escribió:
> Ary Manzana wrote:
>> I'd also like to know what a Symbol (not Dsymbol) is, and wether I'll need it to point out semantic errors.
> 
> It's a backend symbol.

Will I do find without it to point out semantic errors?

Thanks,
Ary