Now global consts are in CSEG again with the proper cast
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 21 Jun 2001 16:10:09 +0000 (16:10 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 21 Jun 2001 16:10:09 +0000 (16:10 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@911 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCmem.c
src/SDCCsymt.c
src/SDCCsymt.h

index 95417b90223d0ed26de766a3cf809b616dc6f922..fc043d4461443d57125022832767df22d3892fb9 100644 (file)
@@ -376,13 +376,11 @@ allocGlobal (symbol * sym)
     }
 
   /* if code change to constant */
-  if (SPEC_SCLS (sym->etype) == S_CODE ||
-      SPEC_SCLS (sym->etype) == S_CONSTANT)
-    {
-      SPEC_OCLS (sym->etype) = statsg;
-      allocIntoSeg (sym);
-      return;
-    }
+  if (SPEC_SCLS (sym->etype) == S_CODE) {
+    SPEC_OCLS (sym->etype) = statsg;
+    allocIntoSeg (sym);
+    return;
+  }
 
   if (SPEC_SCLS (sym->etype) == S_XDATA)
     {
@@ -622,15 +620,12 @@ allocLocal (symbol * sym)
       return;
     }
 
-  if ((SPEC_SCLS (sym->etype) == S_CODE ||
-       SPEC_SCLS (sym->etype) == S_CONSTANT) &&
-      !sym->_isparm)
-    {
-      SPEC_OCLS (sym->etype) = statsg;
-      allocIntoSeg (sym);
-      return;
-    }
-
+  if (SPEC_SCLS (sym->etype) == S_CODE && !sym->_isparm) {
+    SPEC_OCLS (sym->etype) = statsg;
+    allocIntoSeg (sym);
+    return;
+  }
+  
   if (SPEC_SCLS (sym->etype) == S_IDATA)
     {
       SPEC_OCLS (sym->etype) = idata;
index 34fe08a3fd65e5471b60814d8cc7cc0661d46887..6c199ee414895c94bf96c738e06d645b5554a4e4 100644 (file)
@@ -1108,11 +1108,18 @@ compStructSize (int su, structdef * sdef)
 static void 
 checkSClass (symbol * sym)
 {
+  if (getenv("DEBUG_SANITY")) {
+    fprintf (stderr, "checkSClass: %s \n", sym->name);
+  }
+  if (strcmp(sym->name, "_testsGlobal")==0) {
+    printf ("oach\n");
+  }
+  
   /* type is literal can happen foe enums change
      to auto */
   if (SPEC_SCLS (sym->etype) == S_LITERAL && !SPEC_ENUM (sym->etype))
     SPEC_SCLS (sym->etype) = S_AUTO;
-
+  
   /* if sfr or sbit then must also be */
   /* volatile the initial value will be xlated */
   /* to an absolute address */
@@ -1129,26 +1136,24 @@ checkSClass (symbol * sym)
          sym->ival = NULL;
        }
     }
-
+  
   /* if absolute address given then it mark it as
      volatile */
   if (IS_ABSOLUTE (sym->etype))
     SPEC_VOLATILE (sym->etype) = 1;
-
+  
   /* global variables declared const put into code */
   if (sym->level == 0 &&
-      SPEC_SCLS (sym->etype) == S_CONSTANT)
-    {
-      SPEC_SCLS (sym->etype) = S_CODE;
-      SPEC_CONST (sym->etype) = 1;
-    }
-
+      SPEC_CONST (sym->etype)) {
+    SPEC_SCLS (sym->etype) = S_CODE;
+  }
+  
   /* global variable in code space is a constant */
   if (sym->level == 0 &&
       SPEC_SCLS (sym->etype) == S_CODE &&
       port->mem.code_ro)
     SPEC_CONST (sym->etype) = 1;
-
+  
 
   /* if bit variable then no storage class can be */
   /* specified since bit is already a storage */
@@ -1179,13 +1184,12 @@ checkSClass (symbol * sym)
        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_CONSTANT))
+       SPEC_SCLS (sym->etype) != S_XSTACK))
     {
       werror (E_AUTO_ASSUMED, sym->name);
       SPEC_SCLS (sym->etype) = S_AUTO;
     }
-
+  
   /* automatic symbols cannot be given   */
   /* an absolute address ignore it      */
   if (sym->level &&
index 6836371c022f0e85e1434d19e14f8dc7d7da1612..32907da6785b82a67ae8c2eb228066b062f0f2c8 100644 (file)
@@ -73,7 +73,6 @@ typedef enum
     S_FIXED = 0,
     S_AUTO,
     S_REGISTER,
-    S_CONSTANT,
     S_SFR,
     S_SBIT,
     S_CODE,
@@ -279,9 +278,7 @@ symbol;
 #define DCL_TSPEC(l) l->select.d.tspec
 #define SPEC_NOUN(x) x->select.s.noun
 #define SPEC_LONG(x) x->select.s._long
-//#define SPEC_SHORT(x) x->select.s._short // only for type checking
 #define SPEC_USIGN(x) x->select.s._unsigned
-//#define SPEC_SIGNED(x) x->select.s._signed // only for type checking
 #define SPEC_SCLS(x) x->select.s.sclass
 #define SPEC_ENUM(x) x->select.s._isenum
 #define SPEC_OCLS(x) x->select.s.oclass
@@ -334,7 +331,6 @@ symbol;
 #define IS_GENPTR(x) (IS_DECL(x) && DCL_TYPE(x) == GPOINTER)
 #define IS_FUNC(x)   (IS_DECL(x) && DCL_TYPE(x) == FUNCTION)
 #define IS_LONG(x)   (IS_SPEC(x) && x->select.s._long)
-//#define IS_SHORT(x)   (IS_SPEC(x) && x->select.s._short)
 #define IS_TYPEDEF(x)(IS_SPEC(x) && x->select.s._typedef)
 #define IS_CONSTANT(x)  (IS_SPEC(x) && ( x->select.s._const == 1))
 #define IS_STRUCT(x) (IS_SPEC(x) && x->select.s.noun == V_STRUCT)