(readonly_warning): Warn about assignment to iterator.

From-SVN: r3578
This commit is contained in:
Richard Stallman 1993-03-02 02:03:36 +00:00
parent f10fec92a8
commit 3791970daf
1 changed files with 8 additions and 0 deletions

View File

@ -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))))