In gcc/:
* c-typeck.c (build_array_ref): Don't complain about non-lvalue arrays in C99. Don't try to look at DECL_REGISTER of a COMPONENT_REF. Don't complain twice about the same error. In gcc/testsuite/: * gcc.dg/c99-array-lval-1.c: The test on line 14 now passes. From-SVN: r35666
This commit is contained in:
parent
acffa7c4f8
commit
05273f087b
|
@ -1,5 +1,9 @@
|
||||||
2000-08-13 Geoff Keating <geoffk@cygnus.com>
|
2000-08-13 Geoff Keating <geoffk@cygnus.com>
|
||||||
|
|
||||||
|
* c-typeck.c (build_array_ref): Don't complain about non-lvalue
|
||||||
|
arrays in C99. Don't try to look at DECL_REGISTER of a
|
||||||
|
COMPONENT_REF. Don't complain twice about the same error.
|
||||||
|
|
||||||
* fixinc/inclhack.def (aix_pthread): New fix.
|
* fixinc/inclhack.def (aix_pthread): New fix.
|
||||||
(aix_sysmachine): New fix.
|
(aix_sysmachine): New fix.
|
||||||
* fixinc/fixincl.x: Regenerate.
|
* fixinc/fixincl.x: Regenerate.
|
||||||
|
|
|
@ -1315,20 +1315,14 @@ build_array_ref (array, index)
|
||||||
return error_mark_node;
|
return error_mark_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pedantic && !lvalue_p (array))
|
|
||||||
{
|
|
||||||
if (DECL_REGISTER (array))
|
|
||||||
pedwarn ("ISO C forbids subscripting `register' array");
|
|
||||||
else
|
|
||||||
pedwarn ("ISO C89 forbids subscripting non-lvalue array");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pedantic)
|
if (pedantic)
|
||||||
{
|
{
|
||||||
tree foo = array;
|
tree foo = array;
|
||||||
while (TREE_CODE (foo) == COMPONENT_REF)
|
while (TREE_CODE (foo) == COMPONENT_REF)
|
||||||
foo = TREE_OPERAND (foo, 0);
|
foo = TREE_OPERAND (foo, 0);
|
||||||
if (TREE_CODE (foo) == VAR_DECL && DECL_REGISTER (foo))
|
if (TREE_CODE (foo) == VAR_DECL && DECL_REGISTER (foo))
|
||||||
|
pedwarn ("ISO C forbids subscripting `register' array");
|
||||||
|
else if (! flag_isoc99 && ! lvalue_p (foo))
|
||||||
pedwarn ("ISO C89 forbids subscripting non-lvalue array");
|
pedwarn ("ISO C89 forbids subscripting non-lvalue array");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2000-08-13 Geoff Keating <geoffk@cygnus.com>
|
||||||
|
|
||||||
|
* gcc.dg/c99-array-lval-1.c: The test on line 14 now passes.
|
||||||
|
|
||||||
2000-08-11 Nathan Sidwell <nathan@codesourcery.com>
|
2000-08-11 Nathan Sidwell <nathan@codesourcery.com>
|
||||||
|
|
||||||
* g++.old-deja/g++.pt/explicit81.C: New test.
|
* g++.old-deja/g++.pt/explicit81.C: New test.
|
||||||
|
|
|
@ -11,7 +11,7 @@ void
|
||||||
bar (void)
|
bar (void)
|
||||||
{
|
{
|
||||||
char *t;
|
char *t;
|
||||||
(foo ()).c[0]; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" { xfail *-*-* } } */
|
(foo ()).c[0]; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" } */
|
||||||
t = (foo ()).c; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" { xfail *-*-* } } */
|
t = (foo ()).c; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" { xfail *-*-* } } */
|
||||||
(foo ()).c + 1; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" { xfail *-*-* } } */
|
(foo ()).c + 1; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" { xfail *-*-* } } */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue