git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@911
4a8a32a2-be11-0410-ad9d-
d568d2c75423
}
/* if code change to constant */
}
/* 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)
{
if (SPEC_SCLS (sym->etype) == S_XDATA)
{
- 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;
if (SPEC_SCLS (sym->etype) == S_IDATA)
{
SPEC_OCLS (sym->etype) = idata;
static void
checkSClass (symbol * sym)
{
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;
/* 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 */
/* if sfr or sbit then must also be */
/* volatile the initial value will be xlated */
/* to an absolute address */
/* if absolute address given then it mark it as
volatile */
if (IS_ABSOLUTE (sym->etype))
SPEC_VOLATILE (sym->etype) = 1;
/* 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 &&
/* 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;
/* 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 */
/* if bit variable then no storage class can be */
/* specified since bit is already a storage */
SPEC_SCLS (sym->etype) != S_FIXED &&
SPEC_SCLS (sym->etype) != S_REGISTER &&
SPEC_SCLS (sym->etype) != S_STACK &&
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;
}
{
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 &&
/* automatic symbols cannot be given */
/* an absolute address ignore it */
if (sym->level &&
S_FIXED = 0,
S_AUTO,
S_REGISTER,
S_FIXED = 0,
S_AUTO,
S_REGISTER,
#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 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_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
#define SPEC_SCLS(x) x->select.s.sclass
#define SPEC_ENUM(x) x->select.s._isenum
#define SPEC_OCLS(x) x->select.s.oclass
#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_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)
#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)