dos cvs had problem with .lnk file
[fw/sdcc] / src / SDCCmem.c
index fc043d4461443d57125022832767df22d3892fb9..e5f13fa4d19cea48d1fd65c84808ca5688377891 100644 (file)
@@ -420,7 +420,7 @@ allocParms (value * val)
     {
 
       /* check the declaration */
-      checkDecl (lval->sym);
+      checkDecl (lval->sym, 0);
 
       /* if this a register parm then allocate
          it as a local variable by adding it
@@ -476,11 +476,11 @@ allocParms (value * val)
          allocIntoSeg (lval->sym);
        }
       else
-       {                       /* allocate them in the automatic space */
+       { /* allocate them in the automatic space */
          /* generate a unique name  */
          sprintf (lval->sym->rname, "%s%s_PARM_%d", port->fun_prefix, currFunc->name, pNum);
          strcpy (lval->name, lval->sym->rname);
-
+         
          /* if declared in external storage */
          if (SPEC_SCLS (lval->etype) == S_XDATA)
            SPEC_OCLS (lval->etype) = SPEC_OCLS (lval->sym->etype) = xdata;
@@ -489,18 +489,17 @@ allocParms (value * val)
               note here that we put it into the overlay segment
               first, we will remove it from the overlay segment
               after the overlay determination has been done */
-         if (options.model == MODEL_SMALL)
-           {
-             SPEC_OCLS (lval->etype) = SPEC_OCLS (lval->sym->etype) =
-               (options.model == MODEL_SMALL ? port->mem.default_local_map :
-                (options.noOverlay ? port->mem.default_local_map
-                 : overlay));
-           }
-         else
-           {
-             SPEC_SCLS (lval->etype) = S_XDATA;
-             SPEC_OCLS (lval->etype) = SPEC_OCLS (lval->sym->etype) = xdata;
-           }
+           if (options.model == MODEL_SMALL)
+             {
+               SPEC_OCLS (lval->etype) = SPEC_OCLS (lval->sym->etype) =
+                 (options.noOverlay ? port->mem.default_local_map
+                  : overlay);
+             }
+           else
+             {
+               SPEC_SCLS (lval->etype) = S_XDATA;
+               SPEC_OCLS (lval->etype) = SPEC_OCLS (lval->sym->etype) = xdata;
+             }
          allocIntoSeg (lval->sym);
        }
     }
@@ -582,36 +581,35 @@ allocLocal (symbol * sym)
 
   /* this is automatic           */
 
-  /* if it to be placed on the stack */
-  if (options.stackAuto || reentrant)
-    {
+#ifdef JWK20010916
+  if (!IS_SPEC(sym->type) && SPEC_OCLS(sym->etype)) {
+    allocIntoSeg (sym);
+    return;
+  }
+#endif
 
-      sym->onStack = 1;
-      if (options.useXstack)
-       {
-         /* PENDING: stack direction for xstack */
-         SPEC_OCLS (sym->etype) = xstack;
-         SPEC_STAK (sym->etype) = sym->stack = (xstackPtr + 1);
-         xstackPtr += getSize (sym->type);
-       }
-      else
-       {
-         SPEC_OCLS (sym->etype) = istack;
-         if (port->stack.direction > 0)
-           {
-             SPEC_STAK (sym->etype) = sym->stack = (stackPtr + 1);
-             stackPtr += getSize (sym->type);
-           }
-         else
-           {
-             stackPtr -= getSize (sym->type);
-             SPEC_STAK (sym->etype) = sym->stack = stackPtr;
-           }
-       }
-      allocIntoSeg (sym);
-      return;
+  /* if it to be placed on the stack */
+  if (options.stackAuto || reentrant) {
+    sym->onStack = 1;
+    if (options.useXstack) {
+      /* PENDING: stack direction for xstack */
+      SPEC_OCLS (sym->etype) = xstack;
+      SPEC_STAK (sym->etype) = sym->stack = (xstackPtr + 1);
+      xstackPtr += getSize (sym->type);
+    } else {
+      SPEC_OCLS (sym->etype) = istack;
+      if (port->stack.direction > 0) {
+       SPEC_STAK (sym->etype) = sym->stack = (stackPtr + 1);
+       stackPtr += getSize (sym->type);
+      } else {
+       stackPtr -= getSize (sym->type);
+       SPEC_STAK (sym->etype) = sym->stack = stackPtr;
+      }
     }
-
+    allocIntoSeg (sym);
+    return;
+  }
+  
   /* else depending on the storage class specified */
   if (SPEC_SCLS (sym->etype) == S_XDATA)
     {
@@ -687,9 +685,13 @@ allocLocal (symbol * sym)
   /* again note that we have put it into the overlay segment
      will remove and put into the 'data' segment if required after 
      overlay  analysis has been done */
-  SPEC_OCLS (sym->etype) = (options.model == MODEL_SMALL ? port->mem.default_local_map :
-                           (options.noOverlay ? port->mem.default_local_map
-                            : overlay));
+  if (options.model == MODEL_SMALL) {
+    SPEC_OCLS (sym->etype) = 
+      (options.noOverlay ? port->mem.default_local_map
+       : overlay);
+  } else {
+    SPEC_OCLS (sym->etype) = port->mem.default_local_map;
+  }
   allocIntoSeg (sym);
 }
 
@@ -798,7 +800,7 @@ allocVariables (symbol * symChain)
        csym = sym;
 
       /* check the declaration */
-      checkDecl (csym);
+      checkDecl (csym,0);
 
       /* if this is a function or a pointer to function */
       /* then args  processing  */
@@ -935,7 +937,7 @@ redoStackOffsets (void)
 
   /* if the debug option is set then output the
      symbols to the map file */
-  if (options.debug && !options.nodebug)
+  if (options.debug)
     {
       for (sym = setFirstItem (istack->syms); sym;
           sym = setNextItem (istack->syms))