hack up const and volatile modifiers in type chains a bit
[fw/sdcc] / src / SDCCicode.c
index 9c37fe0a2d5f22cdc4197ffc06ea11eb134f0c4f..32f913aec7f0a10e33a7ac3013399320ebd9f20a 100644 (file)
@@ -845,14 +845,7 @@ isOperandVolatile (operand * op, bool chkTemp)
   if (IS_ITEMP (op) && !chkTemp)
     return 0;
 
-  opetype = getSpec (optype = operandType (op));
-
-  if (IS_PTR (optype) && DCL_PTR_VOLATILE (optype))
-    return 1;
-
-  if (IS_VOLATILE (opetype))
-    return 1;
-  return 0;
+  return IS_VOLATILE(operandType(op));
 }
 
 /*-----------------------------------------------------------------*/
@@ -2128,7 +2121,9 @@ aggrToPtr (sym_link * type, bool force)
   ptype = newLink ();
 
   ptype->next = type;
-  /* if the output class is generic */
+
+#ifdef JWK
+  /* if the output class is code */
   if ((DCL_TYPE (ptype) = PTR_TYPE (SPEC_OCLS (etype))) == CPOINTER)
     DCL_PTR_CONST (ptype) = port->mem.code_ro;
 
@@ -2140,6 +2135,10 @@ aggrToPtr (sym_link * type, bool force)
   /* the variable was volatile then pointer to volatile */
   if (IS_VOLATILE (etype))
     DCL_PTR_VOLATILE (ptype) = 1;
+#else
+  DCL_TYPE (ptype) = PTR_TYPE (SPEC_OCLS (etype));
+#endif
+
   return ptype;
 }
 
@@ -2152,11 +2151,11 @@ geniCodeArray2Ptr (operand * op)
   sym_link *optype = operandType (op);
   sym_link *opetype = getSpec (optype);
 
+#ifdef JWK
   /* set the pointer depending on the storage class */
   if ((DCL_TYPE (optype) = PTR_TYPE (SPEC_OCLS (opetype))) == CPOINTER)
     DCL_PTR_CONST (optype) = port->mem.code_ro;
 
-
   /* if the variable was declared a constant */
   /* then the pointer points to a constant */
   if (IS_CONSTANT (opetype))
@@ -2165,6 +2164,10 @@ geniCodeArray2Ptr (operand * op)
   /* the variable was volatile then pointer to volatile */
   if (IS_VOLATILE (opetype))
     DCL_PTR_VOLATILE (optype) = 1;
+#else
+  DCL_TYPE (optype) = PTR_TYPE (SPEC_OCLS (opetype));
+#endif
+
   op->isaddr = 0;
   return op;
 }
@@ -2451,6 +2454,7 @@ geniCodeAddressOf (operand * op)
   p = newLink ();
   p->class = DECLARATOR;
 
+#ifdef JWK
   /* set the pointer depending on the storage class */
   if ((DCL_TYPE (p) = PTR_TYPE (SPEC_OCLS (opetype))) == CPOINTER)
     DCL_PTR_CONST (p) = port->mem.code_ro;
@@ -2461,6 +2465,10 @@ geniCodeAddressOf (operand * op)
 
   if (IS_VOLATILE (opetype))
     DCL_PTR_VOLATILE (p) = 1;
+#else
+  DCL_TYPE (p) = PTR_TYPE (SPEC_OCLS (opetype));
+#endif
+
 
   p->next = copyLinkChain (optype);