cp-tree.h (CP_TYPE_READONLY): New macro to handle arrays.
authorJason Merrill <jason@yorick.cygnus.com>
Fri, 23 Oct 1998 02:26:32 +0000 (02:26 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 23 Oct 1998 02:26:32 +0000 (22:26 -0400)
* cp-tree.h (CP_TYPE_READONLY): New macro to handle arrays.
(CP_TYPE_VOLATILE): Likewise.
* decl.c (grokdeclarator): Use them.
* tree.c (canonical_type_variant): Likewise.

From-SVN: r23244

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/tree.c

index e614e723c25596e9531d089a77d29a359cd4b269..da9cad2437053ed01993be5fe6367e106c8d2854 100644 (file)
@@ -1,3 +1,10 @@
+1998-10-23  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * cp-tree.h (CP_TYPE_READONLY): New macro to handle arrays.
+       (CP_TYPE_VOLATILE): Likewise.
+       * decl.c (grokdeclarator): Use them.
+       * tree.c (canonical_type_variant): Likewise.
+
 1998-10-22  Martin von Löwis  <loewis@informatik.hu-berlin.de>
 
        * parse.y (named_class_head): Push into class while parsing the
index 51c531bb558e8722946b55a965f8757df36c9b08..ad874a12b1880586c04f9e624a208f255d18035a 100644 (file)
@@ -514,6 +514,15 @@ enum languages { lang_c, lang_cplusplus, lang_java };
 /* The _DECL for this _TYPE.  */
 #define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
 
+#define CP_TYPE_READONLY(NODE)                 \
+  (TREE_CODE (NODE) == ARRAY_TYPE              \
+   ? TYPE_READONLY (TREE_TYPE (NODE))          \
+   : TYPE_READONLY (NODE))
+#define CP_TYPE_VOLATILE(NODE)                 \
+  (TREE_CODE (NODE) == ARRAY_TYPE              \
+   ? TYPE_VOLATILE (TREE_TYPE (NODE))          \
+   : TYPE_VOLATILE (NODE))
+
 /* Nonzero if T is a class (or struct or union) type.  Also nonzero
    for template type parameters and typename types.  Despite its name,
    this macro has nothing to do with the definition of aggregate given
index 39b8b7d5ab1aef067c92193e50fc867293b59fe2..c98db982014d0f6fb002855df13907bdbf36d36a 100644 (file)
@@ -9196,8 +9196,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
      explicit specification or via a typedef.
      Likewise for VOLATILEP.  */
 
-  constp = !! RIDBIT_SETP (RID_CONST, specbits) + TYPE_READONLY (type);
-  volatilep = !! RIDBIT_SETP (RID_VOLATILE, specbits) + TYPE_VOLATILE (type);
+  constp = !!RIDBIT_SETP (RID_CONST, specbits) + CP_TYPE_READONLY (type);
+  volatilep = !!RIDBIT_SETP (RID_VOLATILE, specbits) + CP_TYPE_VOLATILE (type);
   type = cp_build_type_variant (type, constp, volatilep);
   staticp = 0;
   inlinep = !! RIDBIT_SETP (RID_INLINE, specbits);
index b943b834f4a89653849f9ff4ee08ab73d23ea62e..15be5d798d2c8e00253f48c415b86a114b265814 100644 (file)
@@ -501,18 +501,8 @@ tree
 canonical_type_variant (t)
      tree t;
 {
-  int constp, volatilep;
-  if (TREE_CODE (t) == ARRAY_TYPE)
-    {
-      constp = TYPE_READONLY (TREE_TYPE (t));
-      volatilep = TYPE_VOLATILE (TREE_TYPE (t));
-    }
-  else
-    {
-      constp = TYPE_READONLY (t);
-      volatilep = TYPE_VOLATILE (t);
-    }
-  return cp_build_type_variant (TYPE_MAIN_VARIANT (t), constp, volatilep);
+  return cp_build_type_variant (TYPE_MAIN_VARIANT (t), CP_TYPE_READONLY (t),
+                               CP_TYPE_VOLATILE (t));
 }
 \f
 /* Add OFFSET to all base types of T.