www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - DMDFE - where retStyle() is defined ?

reply "Carlos Smith" <carlos-smith sympatico.ca> writes:
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.
Mar 24 2007
parent reply Walter Bright <newshound digitalmars.com> writes:
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;
 }

Mar 24 2007
next sibling parent reply "Carlos Smith" <carlos-smith sympatico.ca> writes:
"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 ?
Mar 24 2007
parent Walter Bright <newshound digitalmars.com> writes:
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.
Mar 24 2007
prev sibling parent reply Ary Manzana <ary esperanto.org.ar> writes:
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
Mar 24 2007
parent reply Walter Bright <newshound digitalmars.com> writes:
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.
Mar 24 2007
parent Ary Manzana <ary esperanto.org.ar> writes:
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
Mar 24 2007