From: johanknol Date: Thu, 21 Jun 2001 16:10:09 +0000 (+0000) Subject: Now global consts are in CSEG again with the proper cast X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=49974e6371ce30581a87139d4c1e830e08153b0e;p=fw%2Fsdcc Now global consts are in CSEG again with the proper cast git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@911 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/SDCCmem.c b/src/SDCCmem.c index 95417b90..fc043d44 100644 --- a/src/SDCCmem.c +++ b/src/SDCCmem.c @@ -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; diff --git a/src/SDCCsymt.c b/src/SDCCsymt.c index 34fe08a3..6c199ee4 100644 --- a/src/SDCCsymt.c +++ b/src/SDCCsymt.c @@ -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 && diff --git a/src/SDCCsymt.h b/src/SDCCsymt.h index 6836371c..32907da6 100644 --- a/src/SDCCsymt.h +++ b/src/SDCCsymt.h @@ -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)