aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2001-09-20 20:27:59 -0400
committerDJ Delorie <dj@gcc.gnu.org>2001-09-20 20:27:59 -0400
commite7b6a0ee34197334228ed9185ebaf84d5b975110 (patch)
tree367fe25e25603ec8574df8960ea2e634f886da63 /gcc/doc
parentf5aee6316d591598ac8574b47b79fa35e10bca2c (diff)
downloadgcc-e7b6a0ee34197334228ed9185ebaf84d5b975110.zip
gcc-e7b6a0ee34197334228ed9185ebaf84d5b975110.tar.gz
gcc-e7b6a0ee34197334228ed9185ebaf84d5b975110.tar.bz2
c-typeck.c (really_start_incremental_init): Discriminate between zero-length arrays and flexible arrays.
* c-typeck.c (really_start_incremental_init): Discriminate between zero-length arrays and flexible arrays. (push_init_level): Detect zero-length arrays and handle them like fixed-sized arrays. * expr.c (store_constructor): Handle zero-length arrays and flexible arrays correctly. * doc/extend.texi: Update zero-length array notes. * gcc.dg/20000926-1.c: Update expected warning messages. * gcc.dg/array-2.c: Likewise, and test for warnings too. * gcc.dg/array-4.c: Likewise, and don't verify the zero-length array. From-SVN: r45714
Diffstat (limited to 'gcc/doc')
-rw-r--r--gcc/doc/extend.texi16
1 files changed, 8 insertions, 8 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 05a2e58..0834496 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -1303,17 +1303,17 @@ of zero-length arrays, @code{sizeof} evaluates to zero.
@item
Flexible array members may only appear as the last member of a
-@code{struct} that is otherwise non-empty. GCC currently allows
-zero-length arrays anywhere. You may encounter problems, however,
-defining structures containing only a zero-length array. Such usage
-is deprecated, and we recommend using zero-length arrays only in
-places in which flexible array members would be allowed.
+@code{struct} that is otherwise non-empty.
@end itemize
GCC versions before 3.0 allowed zero-length arrays to be statically
-initialized. In addition to those cases that were useful, it also
-allowed initializations in situations that would corrupt later data.
-Non-empty initialization of zero-length arrays is now deprecated.
+initialized, as if they were flexible arrays. In addition to those
+cases that were useful, it also allowed initializations in situations
+that would corrupt later data. Non-empty initialization of zero-length
+arrays is now treated like any case where there are more initializer
+elements than the array holds, in that a suitable warning about "excess
+elements in array" is given, and the excess elements (all of them, in
+this case) are ignored.
Instead GCC allows static initialization of flexible array members.
This is equivalent to defining a new structure containing the original