]> git.gag.com Git - fw/sdcc/commitdiff
storage class specifiers are allowed for static autos in reentrant functions
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 28 Jun 2001 11:24:12 +0000 (11:24 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 28 Jun 2001 11:24:12 +0000 (11:24 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@978 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCmain.c
src/SDCCmem.c
src/SDCCsymt.c
support/Util/SDCCerr.c

index 0f7b48751f492feeffe701034288b14614da45fc..31d5fdca5c64fdbebacdeb2d88839a3e49ab772e 100644 (file)
@@ -370,13 +370,13 @@ printUsage ()
 {
     int i;
     printVersionInfo();
-    fprintf (stderr,
+    fprintf (stdout,
              "Usage : sdcc [options] filename\n"
              "Options :-\n"
              );
     
     for (i = 0; i < LENGTH(optionsTable); i++) {
-        fprintf(stderr, "  %c%c  %-20s  %s\n", 
+        fprintf(stdout, "  %c%c  %-20s  %s\n", 
                 optionsTable[i].shortOpt !=0 ? '-' : ' ',
                 optionsTable[i].shortOpt !=0 ? optionsTable[i].shortOpt : ' ',
                 optionsTable[i].longOpt != NULL ? optionsTable[i].longOpt : "",
index a84bceffa89ce0b86145f8492f4894986bfaa057..5a447ccc2777dbb1d04d084dd1e94d68b64fe91a 100644 (file)
@@ -582,35 +582,27 @@ allocLocal (symbol * sym)
   /* this is automatic           */
 
   /* 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;
+  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)
     {
index ee4bfe42f54ee2ec0361913bcd50bb954871b694..98fd50febec73a622060274a4e75d3e0e6ec89b6 100644 (file)
@@ -1178,6 +1178,7 @@ checkSClass (symbol * sym)
       sym->ival = NULL;
     }
 
+#if 0
   /* if this is an automatic symbol then */
   /* storage class will be ignored and   */
   /* symbol will be allocated on stack/  */
@@ -1193,6 +1194,23 @@ checkSClass (symbol * sym)
       werror (E_AUTO_ASSUMED, sym->name);
       SPEC_SCLS (sym->etype) = S_AUTO;
     }
+#else
+  /* if this is an atomatic symbol */
+  if (sym->level && (options.stackAuto || reentrant)) {
+    if ((SPEC_SCLS (sym->etype) == S_AUTO ||
+        SPEC_SCLS (sym->etype) == S_FIXED ||
+        SPEC_SCLS (sym->etype) == S_REGISTER ||
+        SPEC_SCLS (sym->etype) == S_STACK ||
+        SPEC_SCLS (sym->etype) == S_XSTACK)) {
+      SPEC_SCLS (sym->etype) = S_AUTO;
+    } else {
+      /* storage class may only be specified for statics */
+      if (!IS_STATIC(sym->etype)) {
+       werror (E_AUTO_ASSUMED, sym->name);
+      }
+    }
+  }
+#endif
   
   /* automatic symbols cannot be given   */
   /* an absolute address ignore it      */
index 0933c145dbab720a763957693f11be718ea9f35f..617e7c3f8970cdedb108f8788fcf911d5cd577d5 100644 (file)
@@ -83,8 +83,8 @@ struct
    " a 'sfr','sbit' storage class, initial value ignored '%s'" },
 { E_INIT_IGNORED, ERROR_LEVEL_WARNING,
    "Variable in the storage class cannot be initialized.'%s'" },
-{ E_AUTO_ASSUMED, ERROR_LEVEL_WARNING,
-   "storage class not allowed for automatic variable '%s' in reentrant function" },
+{ E_AUTO_ASSUMED, ERROR_LEVEL_ERROR,
+   "storage class not allowed for automatic variable '%s' in reentrant function unless static" },
 { E_AUTO_ABSA, ERROR_LEVEL_ERROR,
    "absolute address not allowed for automatic var '%s' in reentrant function " },
 { E_INIT_WRONG, ERROR_LEVEL_WARNING,