aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/typeck.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2000-04-26 15:43:50 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2000-04-26 15:43:50 +0000
commitfc611ce0f5aa284bd88116eab9c781a9e95e0e79 (patch)
treee677c2a2cecce758e9be195b1143cdb72174210c /gcc/cp/typeck.c
parentd4047e241e8c3f88b53f8c14bd8dc77d82d8efbb (diff)
downloadgcc-fc611ce0f5aa284bd88116eab9c781a9e95e0e79.zip
gcc-fc611ce0f5aa284bd88116eab9c781a9e95e0e79.tar.gz
gcc-fc611ce0f5aa284bd88116eab9c781a9e95e0e79.tar.bz2
cp-tree.h (TREE_READONLY_DECL_P): Use DECL_P.
* cp-tree.h (TREE_READONLY_DECL_P): Use DECL_P. * init.c (decl_constant_value): Check TREE_READONLY_DECL_P. * call.c (convert_like_real): Don't test TREE_READONLY_DECL_P before calling decl_constant_value. * class.c (check_bitfield_decl): Likewise. * cvt.c (ocp_convert): Likewise. (convert): Likewise. * decl.c (compute_array_index_type): Likewise. (build_enumerator): Likewise. * decl2.c (check_cp_case_value): Likewise. * pt.c (convert_nontype_argument): Likewise. (tsubst): Likewise. * typeck.c (decay_conversion): Likewise. (build_compound_expr): Likewise. (build_reinterpret_cast): Likewise. (build_c_cast): Likewise. (convert_for_assignment): Likewise. From-SVN: r33446
Diffstat (limited to 'gcc/cp/typeck.c')
-rw-r--r--gcc/cp/typeck.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index da5e954..39b47a0 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1710,7 +1710,7 @@ decay_conversion (exp)
don't do this for arrays, though; we want the address of the
first element of the array, not the address of the first element
of its initializing constant. */
- else if (TREE_READONLY_DECL_P (exp) && code != ARRAY_TYPE)
+ else if (code != ARRAY_TYPE)
{
exp = decl_constant_value (exp);
type = TREE_TYPE (exp);
@@ -5084,8 +5084,7 @@ build_compound_expr (list)
register tree rest;
tree first;
- if (TREE_READONLY_DECL_P (TREE_VALUE (list)))
- TREE_VALUE (list) = decl_constant_value (TREE_VALUE (list));
+ TREE_VALUE (list) = decl_constant_value (TREE_VALUE (list));
if (TREE_CHAIN (list) == 0)
{
@@ -5272,8 +5271,7 @@ build_reinterpret_cast (type, expr)
else if ((TYPE_PTRFN_P (type) && TYPE_PTRFN_P (intype))
|| (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype)))
{
- if (TREE_READONLY_DECL_P (expr))
- expr = decl_constant_value (expr);
+ expr = decl_constant_value (expr);
return fold (build1 (NOP_EXPR, type, expr));
}
else if ((TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (intype))
@@ -5283,16 +5281,14 @@ build_reinterpret_cast (type, expr)
cp_pedwarn ("reinterpret_cast from `%T' to `%T' casts away const (or volatile)",
intype, type);
- if (TREE_READONLY_DECL_P (expr))
- expr = decl_constant_value (expr);
+ expr = decl_constant_value (expr);
return fold (build1 (NOP_EXPR, type, expr));
}
else if ((TYPE_PTRFN_P (type) && TYPE_PTROBV_P (intype))
|| (TYPE_PTRFN_P (intype) && TYPE_PTROBV_P (type)))
{
pedwarn ("ISO C++ forbids casting between pointer-to-function and pointer-to-object");
- if (TREE_READONLY_DECL_P (expr))
- expr = decl_constant_value (expr);
+ expr = decl_constant_value (expr);
return fold (build1 (NOP_EXPR, type, expr));
}
else
@@ -5498,8 +5494,7 @@ build_c_cast (type, expr)
{
tree ovalue;
- if (TREE_READONLY_DECL_P (value))
- value = decl_constant_value (value);
+ value = decl_constant_value (value);
ovalue = value;
value = convert_force (type, value, CONV_C_CAST);
@@ -6493,7 +6488,7 @@ convert_for_assignment (type, rhs, errtype, fndecl, parmnum)
/* Simplify the RHS if possible. */
if (TREE_CODE (rhs) == CONST_DECL)
rhs = DECL_INITIAL (rhs);
- else if (TREE_READONLY_DECL_P (rhs) && coder != ARRAY_TYPE)
+ else if (coder != ARRAY_TYPE)
rhs = decl_constant_value (rhs);
/* [expr.ass]