mirror of git://gcc.gnu.org/git/gcc.git
c-typeck.c (readonly_error): Delete.
gcc/ * c-typeck.c (readonly_error): Delete. gcc/c-family/ * c-common.h (readonly_error): Declare. * c-common.c (readonly_error): Define. gcc/cp/ * cp-tree.h (readonly_error_kind): Delete. (readonly_error): Rename to... (cxx_readonly_error): ...this. Change second argument to be an enum lvalue_use. * semantics.c (finish_asm_stmt): Call cxx_readonly_error. * typeck.c (cp_build_unary_op): Likewise. (cp_build_modify_expr): Likewise. * typeck2.c (readonly_error): Rename to... (cxx_readonly_error): ...this. Delegate to readonly_error for most cases. gcc/testsuite/ * gcc.dg/dfp/struct-union.c: Adjust. * gcc.dg/lvalue-2.c: Adjust. * gcc.dg/pr21419.c: Adjust. * gcc.dg/qual-component-1.c: Adjust. * g++.dg/other/const1.C: Adjust. From-SVN: r167687
This commit is contained in:
parent
fee457233e
commit
4816c5938d
|
@ -1,3 +1,7 @@
|
||||||
|
2010-12-10 Nathan Froyd <froydnj@codesourcery.com>
|
||||||
|
|
||||||
|
* c-typeck.c (readonly_error): Delete.
|
||||||
|
|
||||||
2010-12-10 Jakub Jelinek <jakub@redhat.com>
|
2010-12-10 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
PR rtl-optimization/46865
|
PR rtl-optimization/46865
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2010-12-10 Nathan Froyd <froydnj@codesourcery.com>
|
||||||
|
|
||||||
|
* c-common.h (readonly_error): Declare.
|
||||||
|
* c-common.c (readonly_error): Define.
|
||||||
|
|
||||||
2010-12-09 Nathan Froyd <froydnj@codesourcery.com>
|
2010-12-09 Nathan Froyd <froydnj@codesourcery.com>
|
||||||
|
|
||||||
* c-common.h (invalid_indirection_error): Declare.
|
* c-common.h (invalid_indirection_error): Declare.
|
||||||
|
|
|
@ -8558,6 +8558,78 @@ warn_for_omitted_condop (location_t location, tree cond)
|
||||||
"suggest explicit middle operand");
|
"suggest explicit middle operand");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Give an error for storing into ARG, which is 'const'. USE indicates
|
||||||
|
how ARG was being used. */
|
||||||
|
|
||||||
|
void
|
||||||
|
readonly_error (tree arg, enum lvalue_use use)
|
||||||
|
{
|
||||||
|
gcc_assert (use == lv_assign || use == lv_increment || use == lv_decrement
|
||||||
|
|| use == lv_asm);
|
||||||
|
/* Using this macro rather than (for example) arrays of messages
|
||||||
|
ensures that all the format strings are checked at compile
|
||||||
|
time. */
|
||||||
|
#define READONLY_MSG(A, I, D, AS) (use == lv_assign ? (A) \
|
||||||
|
: (use == lv_increment ? (I) \
|
||||||
|
: (use == lv_decrement ? (D) : (AS))))
|
||||||
|
if (TREE_CODE (arg) == COMPONENT_REF)
|
||||||
|
{
|
||||||
|
if (TYPE_READONLY (TREE_TYPE (TREE_OPERAND (arg, 0))))
|
||||||
|
error (READONLY_MSG (G_("assignment of member "
|
||||||
|
"%qD in read-only object"),
|
||||||
|
G_("increment of member "
|
||||||
|
"%qD in read-only object"),
|
||||||
|
G_("decrement of member "
|
||||||
|
"%qD in read-only object"),
|
||||||
|
G_("member %qD in read-only object "
|
||||||
|
"used as %<asm%> output")),
|
||||||
|
TREE_OPERAND (arg, 1));
|
||||||
|
else
|
||||||
|
error (READONLY_MSG (G_("assignment of read-only member %qD"),
|
||||||
|
G_("increment of read-only member %qD"),
|
||||||
|
G_("decrement of read-only member %qD"),
|
||||||
|
G_("read-only member %qD used as %<asm%> output")),
|
||||||
|
TREE_OPERAND (arg, 1));
|
||||||
|
}
|
||||||
|
else if (TREE_CODE (arg) == VAR_DECL)
|
||||||
|
error (READONLY_MSG (G_("assignment of read-only variable %qD"),
|
||||||
|
G_("increment of read-only variable %qD"),
|
||||||
|
G_("decrement of read-only variable %qD"),
|
||||||
|
G_("read-only variable %qD used as %<asm%> output")),
|
||||||
|
arg);
|
||||||
|
else if (TREE_CODE (arg) == PARM_DECL)
|
||||||
|
error (READONLY_MSG (G_("assignment of read-only parameter %qD"),
|
||||||
|
G_("increment of read-only parameter %qD"),
|
||||||
|
G_("decrement of read-only parameter %qD"),
|
||||||
|
G_("read-only parameter %qD use as %<asm%> output")),
|
||||||
|
arg);
|
||||||
|
else if (TREE_CODE (arg) == RESULT_DECL)
|
||||||
|
{
|
||||||
|
gcc_assert (c_dialect_cxx ());
|
||||||
|
error (READONLY_MSG (G_("assignment of "
|
||||||
|
"read-only named return value %qD"),
|
||||||
|
G_("increment of "
|
||||||
|
"read-only named return value %qD"),
|
||||||
|
G_("decrement of "
|
||||||
|
"read-only named return value %qD"),
|
||||||
|
G_("read-only named return value %qD "
|
||||||
|
"used as %<asm%>output")),
|
||||||
|
arg);
|
||||||
|
}
|
||||||
|
else if (TREE_CODE (arg) == FUNCTION_DECL)
|
||||||
|
error (READONLY_MSG (G_("assignment of function %qD"),
|
||||||
|
G_("increment of function %qD"),
|
||||||
|
G_("decrement of function %qD"),
|
||||||
|
G_("function %qD used as %<asm%> output")),
|
||||||
|
arg);
|
||||||
|
else
|
||||||
|
error (READONLY_MSG (G_("assignment of read-only location %qE"),
|
||||||
|
G_("increment of read-only location %qE"),
|
||||||
|
G_("decrement of read-only location %qE"),
|
||||||
|
G_("read-only location %qE used as %<asm%> output")),
|
||||||
|
arg);
|
||||||
|
}
|
||||||
|
|
||||||
/* Print an error message for an invalid lvalue. USE says
|
/* Print an error message for an invalid lvalue. USE says
|
||||||
how the lvalue is being used and so selects the error message. */
|
how the lvalue is being used and so selects the error message. */
|
||||||
|
|
||||||
|
|
|
@ -928,6 +928,7 @@ enum lvalue_use {
|
||||||
lv_asm
|
lv_asm
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern void readonly_error (tree, enum lvalue_use);
|
||||||
extern void lvalue_error (enum lvalue_use);
|
extern void lvalue_error (enum lvalue_use);
|
||||||
extern void invalid_indirection_error (location_t, tree, ref_operator);
|
extern void invalid_indirection_error (location_t, tree, ref_operator);
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,6 @@ static void add_pending_init (tree, tree, tree, bool, struct obstack *);
|
||||||
static void set_nonincremental_init (struct obstack *);
|
static void set_nonincremental_init (struct obstack *);
|
||||||
static void set_nonincremental_init_from_string (tree, struct obstack *);
|
static void set_nonincremental_init_from_string (tree, struct obstack *);
|
||||||
static tree find_init_member (tree, struct obstack *);
|
static tree find_init_member (tree, struct obstack *);
|
||||||
static void readonly_error (tree, enum lvalue_use);
|
|
||||||
static void readonly_warning (tree, enum lvalue_use);
|
static void readonly_warning (tree, enum lvalue_use);
|
||||||
static int lvalue_or_else (const_tree, enum lvalue_use);
|
static int lvalue_or_else (const_tree, enum lvalue_use);
|
||||||
static void record_maybe_used_decl (tree);
|
static void record_maybe_used_decl (tree);
|
||||||
|
@ -3880,44 +3879,6 @@ lvalue_p (const_tree ref)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Give an error for storing in something that is 'const'. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
readonly_error (tree arg, enum lvalue_use use)
|
|
||||||
{
|
|
||||||
gcc_assert (use == lv_assign || use == lv_increment || use == lv_decrement
|
|
||||||
|| use == lv_asm);
|
|
||||||
/* Using this macro rather than (for example) arrays of messages
|
|
||||||
ensures that all the format strings are checked at compile
|
|
||||||
time. */
|
|
||||||
#define READONLY_MSG(A, I, D, AS) (use == lv_assign ? (A) \
|
|
||||||
: (use == lv_increment ? (I) \
|
|
||||||
: (use == lv_decrement ? (D) : (AS))))
|
|
||||||
if (TREE_CODE (arg) == COMPONENT_REF)
|
|
||||||
{
|
|
||||||
if (TYPE_READONLY (TREE_TYPE (TREE_OPERAND (arg, 0))))
|
|
||||||
readonly_error (TREE_OPERAND (arg, 0), use);
|
|
||||||
else
|
|
||||||
error (READONLY_MSG (G_("assignment of read-only member %qD"),
|
|
||||||
G_("increment of read-only member %qD"),
|
|
||||||
G_("decrement of read-only member %qD"),
|
|
||||||
G_("read-only member %qD used as %<asm%> output")),
|
|
||||||
TREE_OPERAND (arg, 1));
|
|
||||||
}
|
|
||||||
else if (TREE_CODE (arg) == VAR_DECL)
|
|
||||||
error (READONLY_MSG (G_("assignment of read-only variable %qD"),
|
|
||||||
G_("increment of read-only variable %qD"),
|
|
||||||
G_("decrement of read-only variable %qD"),
|
|
||||||
G_("read-only variable %qD used as %<asm%> output")),
|
|
||||||
arg);
|
|
||||||
else
|
|
||||||
error (READONLY_MSG (G_("assignment of read-only location %qE"),
|
|
||||||
G_("increment of read-only location %qE"),
|
|
||||||
G_("decrement of read-only location %qE"),
|
|
||||||
G_("read-only location %qE used as %<asm%> output")),
|
|
||||||
arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Give a warning for storing in something that is read-only in GCC
|
/* Give a warning for storing in something that is read-only in GCC
|
||||||
terms but not const in ISO C terms. */
|
terms but not const in ISO C terms. */
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,16 @@
|
||||||
|
2010-12-10 Nathan Froyd <froydnj@codesourcery.com>
|
||||||
|
|
||||||
|
* cp-tree.h (readonly_error_kind): Delete.
|
||||||
|
(readonly_error): Rename to...
|
||||||
|
(cxx_readonly_error): ...this. Change second argument to be an
|
||||||
|
enum lvalue_use.
|
||||||
|
* semantics.c (finish_asm_stmt): Call cxx_readonly_error.
|
||||||
|
* typeck.c (cp_build_unary_op): Likewise.
|
||||||
|
(cp_build_modify_expr): Likewise.
|
||||||
|
* typeck2.c (readonly_error): Rename to...
|
||||||
|
(cxx_readonly_error): ...this. Delegate to readonly_error for
|
||||||
|
most cases.
|
||||||
|
|
||||||
2010-12-10 Nicola Pero <nicola.pero@meta-innovation.com>
|
2010-12-10 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||||
|
|
||||||
* parser.c (cp_parser_objc_superclass_or_category): Recognize
|
* parser.c (cp_parser_objc_superclass_or_category): Recognize
|
||||||
|
|
|
@ -406,19 +406,6 @@ typedef enum composite_pointer_operation
|
||||||
CPO_CONDITIONAL_EXPR
|
CPO_CONDITIONAL_EXPR
|
||||||
} composite_pointer_operation;
|
} composite_pointer_operation;
|
||||||
|
|
||||||
/* The various readonly error string used by readonly_error. */
|
|
||||||
typedef enum readonly_error_kind
|
|
||||||
{
|
|
||||||
/* assignment */
|
|
||||||
REK_ASSIGNMENT,
|
|
||||||
/* assignment (via 'asm' output) */
|
|
||||||
REK_ASSIGNMENT_ASM,
|
|
||||||
/* increment */
|
|
||||||
REK_INCREMENT,
|
|
||||||
/* decrement */
|
|
||||||
REK_DECREMENT
|
|
||||||
} readonly_error_kind;
|
|
||||||
|
|
||||||
/* Possible cases of expression list used by build_x_compound_expr_from_list. */
|
/* Possible cases of expression list used by build_x_compound_expr_from_list. */
|
||||||
typedef enum expr_list_kind {
|
typedef enum expr_list_kind {
|
||||||
ELK_INIT, /* initializer */
|
ELK_INIT, /* initializer */
|
||||||
|
@ -5589,7 +5576,7 @@ extern void cxx_incomplete_type_error (const_tree, const_tree);
|
||||||
(cxx_incomplete_type_diagnostic ((V), (T), DK_ERROR))
|
(cxx_incomplete_type_diagnostic ((V), (T), DK_ERROR))
|
||||||
extern tree error_not_base_type (tree, tree);
|
extern tree error_not_base_type (tree, tree);
|
||||||
extern tree binfo_or_else (tree, tree);
|
extern tree binfo_or_else (tree, tree);
|
||||||
extern void readonly_error (tree, readonly_error_kind);
|
extern void cxx_readonly_error (tree, enum lvalue_use);
|
||||||
extern void complete_type_check_abstract (tree);
|
extern void complete_type_check_abstract (tree);
|
||||||
extern int abstract_virtuals_error (tree, tree);
|
extern int abstract_virtuals_error (tree, tree);
|
||||||
|
|
||||||
|
|
|
@ -1317,7 +1317,7 @@ finish_asm_stmt (int volatile_p, tree string, tree output_operands,
|
||||||
effectively const. */
|
effectively const. */
|
||||||
|| (CLASS_TYPE_P (TREE_TYPE (operand))
|
|| (CLASS_TYPE_P (TREE_TYPE (operand))
|
||||||
&& C_TYPE_FIELDS_READONLY (TREE_TYPE (operand)))))
|
&& C_TYPE_FIELDS_READONLY (TREE_TYPE (operand)))))
|
||||||
readonly_error (operand, REK_ASSIGNMENT_ASM);
|
cxx_readonly_error (operand, lv_asm);
|
||||||
|
|
||||||
constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t)));
|
constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (t)));
|
||||||
oconstraints[i] = constraint;
|
oconstraints[i] = constraint;
|
||||||
|
|
|
@ -5115,9 +5115,9 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
|
||||||
|| TREE_READONLY (arg))
|
|| TREE_READONLY (arg))
|
||||||
{
|
{
|
||||||
if (complain & tf_error)
|
if (complain & tf_error)
|
||||||
readonly_error (arg, ((code == PREINCREMENT_EXPR
|
cxx_readonly_error (arg, ((code == PREINCREMENT_EXPR
|
||||||
|| code == POSTINCREMENT_EXPR)
|
|| code == POSTINCREMENT_EXPR)
|
||||||
? REK_INCREMENT : REK_DECREMENT));
|
? lv_increment : lv_decrement));
|
||||||
else
|
else
|
||||||
return error_mark_node;
|
return error_mark_node;
|
||||||
}
|
}
|
||||||
|
@ -6660,7 +6660,7 @@ cp_build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs,
|
||||||
&& C_TYPE_FIELDS_READONLY (lhstype))))
|
&& C_TYPE_FIELDS_READONLY (lhstype))))
|
||||||
{
|
{
|
||||||
if (complain & tf_error)
|
if (complain & tf_error)
|
||||||
readonly_error (lhs, REK_ASSIGNMENT);
|
cxx_readonly_error (lhs, lv_assign);
|
||||||
else
|
else
|
||||||
return error_mark_node;
|
return error_mark_node;
|
||||||
}
|
}
|
||||||
|
|
114
gcc/cp/typeck2.c
114
gcc/cp/typeck2.c
|
@ -70,7 +70,7 @@ binfo_or_else (tree base, tree type)
|
||||||
value may not be changed thereafter. */
|
value may not be changed thereafter. */
|
||||||
|
|
||||||
void
|
void
|
||||||
readonly_error (tree arg, readonly_error_kind errstring)
|
cxx_readonly_error (tree arg, enum lvalue_use errstring)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* This macro is used to emit diagnostics to ensure that all format
|
/* This macro is used to emit diagnostics to ensure that all format
|
||||||
|
@ -81,16 +81,16 @@ readonly_error (tree arg, readonly_error_kind errstring)
|
||||||
do { \
|
do { \
|
||||||
switch (errstring) \
|
switch (errstring) \
|
||||||
{ \
|
{ \
|
||||||
case REK_ASSIGNMENT: \
|
case lv_assign: \
|
||||||
error(AS, ARG); \
|
error(AS, ARG); \
|
||||||
break; \
|
break; \
|
||||||
case REK_ASSIGNMENT_ASM: \
|
case lv_asm: \
|
||||||
error(ASM, ARG); \
|
error(ASM, ARG); \
|
||||||
break; \
|
break; \
|
||||||
case REK_INCREMENT: \
|
case lv_increment: \
|
||||||
error (IN, ARG); \
|
error (IN, ARG); \
|
||||||
break; \
|
break; \
|
||||||
case REK_DECREMENT: \
|
case lv_decrement: \
|
||||||
error (DE, ARG); \
|
error (DE, ARG); \
|
||||||
break; \
|
break; \
|
||||||
default: \
|
default: \
|
||||||
|
@ -98,108 +98,36 @@ readonly_error (tree arg, readonly_error_kind errstring)
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
if (TREE_CODE (arg) == COMPONENT_REF)
|
/* Handle C++-specific things first. */
|
||||||
{
|
|
||||||
if (TYPE_READONLY (TREE_TYPE (TREE_OPERAND (arg, 0))))
|
|
||||||
ERROR_FOR_ASSIGNMENT (G_("assignment of "
|
|
||||||
"data-member %qD in read-only structure"),
|
|
||||||
G_("assignment (via 'asm' output) of "
|
|
||||||
"data-member %qD in read-only structure"),
|
|
||||||
G_("increment of "
|
|
||||||
"data-member %qD in read-only structure"),
|
|
||||||
G_("decrement of "
|
|
||||||
"data-member %qD in read-only structure"),
|
|
||||||
TREE_OPERAND (arg, 1));
|
|
||||||
else
|
|
||||||
ERROR_FOR_ASSIGNMENT (G_("assignment of "
|
|
||||||
"read-only data-member %qD"),
|
|
||||||
G_("assignment (via 'asm' output) of "
|
|
||||||
"read-only data-member %qD"),
|
|
||||||
G_("increment of "
|
|
||||||
"read-only data-member %qD"),
|
|
||||||
G_("decrement of "
|
|
||||||
"read-only data-member %qD"),
|
|
||||||
TREE_OPERAND (arg, 1));
|
|
||||||
}
|
|
||||||
else if (TREE_CODE (arg) == VAR_DECL)
|
|
||||||
{
|
|
||||||
if (DECL_LANG_SPECIFIC (arg)
|
|
||||||
&& DECL_IN_AGGR_P (arg)
|
|
||||||
&& !TREE_STATIC (arg))
|
|
||||||
ERROR_FOR_ASSIGNMENT (G_("assignment of "
|
|
||||||
"constant field %qD"),
|
|
||||||
G_("assignment (via 'asm' output) of "
|
|
||||||
"constant field %qD"),
|
|
||||||
G_("increment of "
|
|
||||||
"constant field %qD"),
|
|
||||||
G_("decrement of "
|
|
||||||
"constant field %qD"),
|
|
||||||
arg);
|
|
||||||
else
|
|
||||||
ERROR_FOR_ASSIGNMENT (G_("assignment of "
|
|
||||||
"read-only variable %qD"),
|
|
||||||
G_("assignment (via 'asm' output) of "
|
|
||||||
"read-only variable %qD"),
|
|
||||||
G_("increment of "
|
|
||||||
"read-only variable %qD"),
|
|
||||||
G_("decrement of "
|
|
||||||
"read-only variable %qD"),
|
|
||||||
arg);
|
|
||||||
|
|
||||||
}
|
if (TREE_CODE (arg) == VAR_DECL
|
||||||
else if (TREE_CODE (arg) == PARM_DECL)
|
&& DECL_LANG_SPECIFIC (arg)
|
||||||
|
&& DECL_IN_AGGR_P (arg)
|
||||||
|
&& !TREE_STATIC (arg))
|
||||||
ERROR_FOR_ASSIGNMENT (G_("assignment of "
|
ERROR_FOR_ASSIGNMENT (G_("assignment of "
|
||||||
"read-only parameter %qD"),
|
"constant field %qD"),
|
||||||
G_("assignment (via 'asm' output) of "
|
G_("constant field %qD "
|
||||||
"read-only parameter %qD"),
|
"used as %<asm%> output"),
|
||||||
G_("increment of "
|
G_("increment of "
|
||||||
"read-only parameter %qD"),
|
"constant field %qD"),
|
||||||
G_("decrement of "
|
G_("decrement of "
|
||||||
"read-only parameter %qD"),
|
"constant field %qD"),
|
||||||
arg);
|
arg);
|
||||||
else if (TREE_CODE (arg) == INDIRECT_REF
|
else if (TREE_CODE (arg) == INDIRECT_REF
|
||||||
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (arg, 0))) == REFERENCE_TYPE
|
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (arg, 0))) == REFERENCE_TYPE
|
||||||
&& (TREE_CODE (TREE_OPERAND (arg, 0)) == VAR_DECL
|
&& (TREE_CODE (TREE_OPERAND (arg, 0)) == VAR_DECL
|
||||||
|| TREE_CODE (TREE_OPERAND (arg, 0)) == PARM_DECL))
|
|| TREE_CODE (TREE_OPERAND (arg, 0)) == PARM_DECL))
|
||||||
ERROR_FOR_ASSIGNMENT (G_("assignment of "
|
ERROR_FOR_ASSIGNMENT (G_("assignment of "
|
||||||
"read-only reference %qD"),
|
"read-only reference %qD"),
|
||||||
G_("assignment (via 'asm' output) of "
|
G_("read-only reference %qD "
|
||||||
"read-only reference %qD"),
|
"used as %<asm%> output"),
|
||||||
G_("increment of "
|
G_("increment of "
|
||||||
"read-only reference %qD"),
|
"read-only reference %qD"),
|
||||||
G_("decrement of "
|
G_("decrement of "
|
||||||
"read-only reference %qD"),
|
"read-only reference %qD"),
|
||||||
TREE_OPERAND (arg, 0));
|
TREE_OPERAND (arg, 0));
|
||||||
else if (TREE_CODE (arg) == RESULT_DECL)
|
|
||||||
ERROR_FOR_ASSIGNMENT (G_("assignment of "
|
|
||||||
"read-only named return value %qD"),
|
|
||||||
G_("assignment (via 'asm' output) of "
|
|
||||||
"read-only named return value %qD"),
|
|
||||||
G_("increment of "
|
|
||||||
"read-only named return value %qD"),
|
|
||||||
G_("decrement of "
|
|
||||||
"read-only named return value %qD"),
|
|
||||||
arg);
|
|
||||||
else if (TREE_CODE (arg) == FUNCTION_DECL)
|
|
||||||
ERROR_FOR_ASSIGNMENT (G_("assignment of "
|
|
||||||
"function %qD"),
|
|
||||||
G_("assignment (via 'asm' output) of "
|
|
||||||
"function %qD"),
|
|
||||||
G_("increment of "
|
|
||||||
"function %qD"),
|
|
||||||
G_("decrement of "
|
|
||||||
"function %qD"),
|
|
||||||
arg);
|
|
||||||
else
|
else
|
||||||
ERROR_FOR_ASSIGNMENT (G_("assignment of "
|
readonly_error (arg, errstring);
|
||||||
"read-only location %qE"),
|
|
||||||
G_("assignment (via 'asm' output) of "
|
|
||||||
"read-only location %qE"),
|
|
||||||
G_("increment of "
|
|
||||||
"read-only location %qE"),
|
|
||||||
G_("decrement of "
|
|
||||||
"read-only location %qE"),
|
|
||||||
arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
2010-12-10 Nathan Froyd <froydnj@codesourcery.com>
|
||||||
|
|
||||||
|
* gcc.dg/dfp/struct-union.c: Adjust.
|
||||||
|
* gcc.dg/lvalue-2.c: Adjust.
|
||||||
|
* gcc.dg/pr21419.c: Adjust.
|
||||||
|
* gcc.dg/qual-component-1.c: Adjust.
|
||||||
|
* g++.dg/other/const1.C: Adjust.
|
||||||
|
|
||||||
2010-12-10 Jakub Jelinek <jakub@redhat.com>
|
2010-12-10 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
PR rtl-optimization/46865
|
PR rtl-optimization/46865
|
||||||
|
|
|
@ -13,5 +13,5 @@ struct Foo
|
||||||
|
|
||||||
void Foo::Modify(unsigned j) const
|
void Foo::Modify(unsigned j) const
|
||||||
{
|
{
|
||||||
Foo::i = j; // { dg-error "assignment of data-member" "" }
|
Foo::i = j; // { dg-error "assignment of member" "" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,22 +33,22 @@ union u h (union u u)
|
||||||
|
|
||||||
void f()
|
void f()
|
||||||
{
|
{
|
||||||
cs.d32 = 1.23dd; /* { dg-error "assignment of read-only variable" } */
|
cs.d32 = 1.23dd; /* { dg-error "assignment of member 'd32' in read-only object" } */
|
||||||
cs.d64 = 1.23df; /* { dg-error "assignment of read-only variable" } */
|
cs.d64 = 1.23df; /* { dg-error "assignment of member 'd64' in read-only object" } */
|
||||||
s.d64 = 1.23df; /* { dg-error "assignment of read-only member" } */
|
s.d64 = 1.23df; /* { dg-error "assignment of read-only member" } */
|
||||||
|
|
||||||
s.d32 = 1.23dd;
|
s.d32 = 1.23dd;
|
||||||
u.d32 = 1.23dd;
|
u.d32 = 1.23dd;
|
||||||
|
|
||||||
u.d64 = 1.23df; /* { dg-error "assignment of read-only member" } */
|
u.d64 = 1.23df; /* { dg-error "assignment of read-only member" } */
|
||||||
u.cs.d32 = 1.23dd; /* { dg-error "assignment of read-only member" } */
|
u.cs.d32 = 1.23dd; /* { dg-error "assignment of member 'd32' in read-only object" } */
|
||||||
u.cs.d64 = 1.23df; /* { dg-error "assignment of read-only member" } */
|
u.cs.d64 = 1.23df; /* { dg-error "assignment of member 'd64' in read-only object" } */
|
||||||
|
|
||||||
cu.d32 = 1.23dd; /* { dg-error "assignment of read-only variable" } */
|
cu.d32 = 1.23dd; /* { dg-error "assignment of member 'd32' in read-only object" } */
|
||||||
|
|
||||||
cu.d64 = 1.23df; /* { dg-error "assignment of read-only variable" } */
|
cu.d64 = 1.23df; /* { dg-error "assignment of member 'd64' in read-only object" } */
|
||||||
cu.cs.d32 = 1.23dd; /* { dg-error "assignment of read-only variable" } */
|
cu.cs.d32 = 1.23dd; /* { dg-error "assignment of member 'd32' in read-only object" } */
|
||||||
cu.cs.d64 = 1.23df; /* { dg-error "assignment of read-only variable" } */
|
cu.cs.d64 = 1.23df; /* { dg-error "assignment of member 'd64' in read-only object" } */
|
||||||
|
|
||||||
/* f().x is a valid postfix expression but is not an lvalue if
|
/* f().x is a valid postfix expression but is not an lvalue if
|
||||||
function f() returning a structure or union. */
|
function f() returning a structure or union. */
|
||||||
|
|
|
@ -26,23 +26,23 @@ void
|
||||||
f1 (void)
|
f1 (void)
|
||||||
{
|
{
|
||||||
c = 1; /* { dg-error "assignment of read-only variable 'c'" } */
|
c = 1; /* { dg-error "assignment of read-only variable 'c'" } */
|
||||||
d.x = 1; /* { dg-error "assignment of read-only variable 'd'" } */
|
d.x = 1; /* { dg-error "assignment of member 'x' in read-only object" } */
|
||||||
e.x = 1; /* { dg-error "assignment of read-only member 'x'" } */
|
e.x = 1; /* { dg-error "assignment of read-only member 'x'" } */
|
||||||
*f = 1; /* { dg-error "assignment of read-only location" } */
|
*f = 1; /* { dg-error "assignment of read-only location" } */
|
||||||
c++; /* { dg-error "increment of read-only variable 'c'" } */
|
c++; /* { dg-error "increment of read-only variable 'c'" } */
|
||||||
d.x++; /* { dg-error "increment of read-only variable 'd'" } */
|
d.x++; /* { dg-error "increment of member 'x' in read-only object" } */
|
||||||
e.x++; /* { dg-error "increment of read-only member 'x'" } */
|
e.x++; /* { dg-error "increment of read-only member 'x'" } */
|
||||||
(*f)++; /* { dg-error "increment of read-only location" } */
|
(*f)++; /* { dg-error "increment of read-only location" } */
|
||||||
++c; /* { dg-error "increment of read-only variable 'c'" } */
|
++c; /* { dg-error "increment of read-only variable 'c'" } */
|
||||||
++d.x; /* { dg-error "increment of read-only variable 'd'" } */
|
++d.x; /* { dg-error "increment of member 'x' in read-only object" } */
|
||||||
++e.x; /* { dg-error "increment of read-only member 'x'" } */
|
++e.x; /* { dg-error "increment of read-only member 'x'" } */
|
||||||
++(*f); /* { dg-error "increment of read-only location" } */
|
++(*f); /* { dg-error "increment of read-only location" } */
|
||||||
c--; /* { dg-error "decrement of read-only variable 'c'" } */
|
c--; /* { dg-error "decrement of read-only variable 'c'" } */
|
||||||
d.x--; /* { dg-error "decrement of read-only variable 'd'" } */
|
d.x--; /* { dg-error "decrement of member 'x' in read-only object" } */
|
||||||
e.x--; /* { dg-error "decrement of read-only member 'x'" } */
|
e.x--; /* { dg-error "decrement of read-only member 'x'" } */
|
||||||
(*f)--; /* { dg-error "decrement of read-only location" } */
|
(*f)--; /* { dg-error "decrement of read-only location" } */
|
||||||
--c; /* { dg-error "decrement of read-only variable 'c'" } */
|
--c; /* { dg-error "decrement of read-only variable 'c'" } */
|
||||||
--d.x; /* { dg-error "decrement of read-only variable 'd'" } */
|
--d.x; /* { dg-error "decrement of member 'x' in read-only object" } */
|
||||||
--e.x; /* { dg-error "decrement of read-only member 'x'" } */
|
--e.x; /* { dg-error "decrement of read-only member 'x'" } */
|
||||||
--(*f); /* { dg-error "decrement of read-only location" } */
|
--(*f); /* { dg-error "decrement of read-only location" } */
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ void f(void)
|
||||||
|
|
||||||
void g(const int set)
|
void g(const int set)
|
||||||
{
|
{
|
||||||
__asm__ __volatile__ ("" : "=r" (set)); /* { dg-error "read-only location" } */
|
__asm__ __volatile__ ("" : "=r" (set)); /* { dg-error "read-only parameter" } */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -62,39 +62,39 @@ f (void)
|
||||||
*v2->f[0] = 0; /* { dg-error "assignment of read-only" } */
|
*v2->f[0] = 0; /* { dg-error "assignment of read-only" } */
|
||||||
**v2->f = 0; /* { dg-error "assignment of read-only" } */
|
**v2->f = 0; /* { dg-error "assignment of read-only" } */
|
||||||
|
|
||||||
v3->a = 0; /* { dg-error "assignment of read-only" } */
|
v3->a = 0; /* { dg-error "assignment of member" } */
|
||||||
v3->b[0] = 0; /* { dg-error "assignment of read-only" } */
|
v3->b[0] = 0; /* { dg-error "assignment of read-only" } */
|
||||||
*v3->b = 0; /* { dg-error "assignment of read-only" } */
|
*v3->b = 0; /* { dg-error "assignment of read-only" } */
|
||||||
v3->c[0][0] = 0; /* { dg-error "assignment of read-only" } */
|
v3->c[0][0] = 0; /* { dg-error "assignment of read-only" } */
|
||||||
*v3->c[0] = 0; /* { dg-error "assignment of read-only" } */
|
*v3->c[0] = 0; /* { dg-error "assignment of read-only" } */
|
||||||
**v3->c = 0; /* { dg-error "assignment of read-only" } */
|
**v3->c = 0; /* { dg-error "assignment of read-only" } */
|
||||||
v3->d = 0; /* { dg-error "assignment of read-only" } */
|
v3->d = 0; /* { dg-error "assignment of member" } */
|
||||||
v3->e[0] = 0; /* { dg-error "assignment of read-only" } */
|
v3->e[0] = 0; /* { dg-error "assignment of read-only" } */
|
||||||
*v3->e = 0; /* { dg-error "assignment of read-only" } */
|
*v3->e = 0; /* { dg-error "assignment of read-only" } */
|
||||||
v3->f[0][0] = 0; /* { dg-error "assignment of read-only" } */
|
v3->f[0][0] = 0; /* { dg-error "assignment of read-only" } */
|
||||||
*v3->f[0] = 0; /* { dg-error "assignment of read-only" } */
|
*v3->f[0] = 0; /* { dg-error "assignment of read-only" } */
|
||||||
**v3->f = 0; /* { dg-error "assignment of read-only" } */
|
**v3->f = 0; /* { dg-error "assignment of read-only" } */
|
||||||
|
|
||||||
v4.a = 0; /* { dg-error "assignment of read-only" } */
|
v4.a = 0; /* { dg-error "assignment of member" } */
|
||||||
v4.b[0] = 0; /* { dg-error "assignment of read-only" } */
|
v4.b[0] = 0; /* { dg-error "assignment of read-only" } */
|
||||||
*v4.b = 0; /* { dg-error "assignment of read-only" } */
|
*v4.b = 0; /* { dg-error "assignment of read-only" } */
|
||||||
v4.c[0][0] = 0; /* { dg-error "assignment of read-only" } */
|
v4.c[0][0] = 0; /* { dg-error "assignment of read-only" } */
|
||||||
*v4.c[0] = 0; /* { dg-error "assignment of read-only" } */
|
*v4.c[0] = 0; /* { dg-error "assignment of read-only" } */
|
||||||
**v4.c = 0; /* { dg-error "assignment of read-only" } */
|
**v4.c = 0; /* { dg-error "assignment of read-only" } */
|
||||||
v4.d = 0; /* { dg-error "assignment of read-only" } */
|
v4.d = 0; /* { dg-error "assignment of member" } */
|
||||||
v4.e[0] = 0; /* { dg-error "assignment of read-only" } */
|
v4.e[0] = 0; /* { dg-error "assignment of read-only" } */
|
||||||
*v4.e = 0; /* { dg-error "assignment of read-only" } */
|
*v4.e = 0; /* { dg-error "assignment of read-only" } */
|
||||||
v4.f[0][0] = 0; /* { dg-error "assignment of read-only" } */
|
v4.f[0][0] = 0; /* { dg-error "assignment of read-only" } */
|
||||||
*v4.f[0] = 0; /* { dg-error "assignment of read-only" } */
|
*v4.f[0] = 0; /* { dg-error "assignment of read-only" } */
|
||||||
**v4.f = 0; /* { dg-error "assignment of read-only" } */
|
**v4.f = 0; /* { dg-error "assignment of read-only" } */
|
||||||
|
|
||||||
v5.x.a = 0; /* { dg-error "assignment of read-only" } */
|
v5.x.a = 0; /* { dg-error "assignment of member" } */
|
||||||
v5.x.b[0] = 0; /* { dg-error "assignment of read-only" } */
|
v5.x.b[0] = 0; /* { dg-error "assignment of read-only" } */
|
||||||
*v5.x.b = 0; /* { dg-error "assignment of read-only" } */
|
*v5.x.b = 0; /* { dg-error "assignment of read-only" } */
|
||||||
v5.x.c[0][0] = 0; /* { dg-error "assignment of read-only" } */
|
v5.x.c[0][0] = 0; /* { dg-error "assignment of read-only" } */
|
||||||
*v5.x.c[0] = 0; /* { dg-error "assignment of read-only" } */
|
*v5.x.c[0] = 0; /* { dg-error "assignment of read-only" } */
|
||||||
**v5.x.c = 0; /* { dg-error "assignment of read-only" } */
|
**v5.x.c = 0; /* { dg-error "assignment of read-only" } */
|
||||||
v5.x.d = 0; /* { dg-error "assignment of read-only" } */
|
v5.x.d = 0; /* { dg-error "assignment of member" } */
|
||||||
v5.x.e[0] = 0; /* { dg-error "assignment of read-only" } */
|
v5.x.e[0] = 0; /* { dg-error "assignment of read-only" } */
|
||||||
*v5.x.e = 0; /* { dg-error "assignment of read-only" } */
|
*v5.x.e = 0; /* { dg-error "assignment of read-only" } */
|
||||||
v5.x.f[0][0] = 0; /* { dg-error "assignment of read-only" } */
|
v5.x.f[0][0] = 0; /* { dg-error "assignment of read-only" } */
|
||||||
|
|
Loading…
Reference in New Issue