aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorGeoff Keating <geoffk@cygnus.com>2000-08-13 21:31:09 +0000
committerGeoffrey Keating <geoffk@gcc.gnu.org>2000-08-13 21:31:09 +0000
commit05273f087b13b503b5f951f689e37ed47fb3f8fe (patch)
treea558c4ca3292086cf4eb00df34bcdc9b773ca5fa /gcc
parentacffa7c4f866e1bd59e0483c8bd88fb3843ffcc8 (diff)
downloadgcc-05273f087b13b503b5f951f689e37ed47fb3f8fe.zip
gcc-05273f087b13b503b5f951f689e37ed47fb3f8fe.tar.gz
gcc-05273f087b13b503b5f951f689e37ed47fb3f8fe.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/c-typeck.c10
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/c99-array-lval-1.c2
4 files changed, 11 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3fc6eb0..7ab6a19 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
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.
(aix_sysmachine): New fix.
* fixinc/fixincl.x: Regenerate.
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 66ec40e..8459f47 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -1315,20 +1315,14 @@ build_array_ref (array, index)
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)
{
tree foo = array;
while (TREE_CODE (foo) == COMPONENT_REF)
foo = TREE_OPERAND (foo, 0);
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");
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d2d1d7f..907875a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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>
* g++.old-deja/g++.pt/explicit81.C: New test.
diff --git a/gcc/testsuite/gcc.dg/c99-array-lval-1.c b/gcc/testsuite/gcc.dg/c99-array-lval-1.c
index 831fb54..616ddb9 100644
--- a/gcc/testsuite/gcc.dg/c99-array-lval-1.c
+++ b/gcc/testsuite/gcc.dg/c99-array-lval-1.c
@@ -11,7 +11,7 @@ void
bar (void)
{
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 *-*-* } } */
(foo ()).c + 1; /* { dg-bogus "non-lvalue" "array not decaying to lvalue" { xfail *-*-* } } */
}