Commit 3791970d by Richard Stallman

(readonly_warning): Warn about assignment to iterator.

From-SVN: r3578
parent f10fec92
......@@ -3356,6 +3356,14 @@ readonly_warning (arg, string)
char buf[80];
strcpy (buf, string);
/* Forbid assignments to iterators. */
if (TREE_CODE (TREE_OPERAND (arg, 0)) == VAR_DECL
&& ITERATOR_P (TREE_OPERAND (arg, 0)))
{
strcat (buf, " of iterator `%s'");
pedwarn (buf, IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (arg, 1))));
}
if (TREE_CODE (arg) == COMPONENT_REF)
{
if (TYPE_READONLY (TREE_TYPE (TREE_OPERAND (arg, 0))))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment