diff options
author | dj <dj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-09-21 00:27:59 +0000 |
---|---|---|
committer | dj <dj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-09-21 00:27:59 +0000 |
commit | 26877a3f246902e12d8405b7e5479181a31a3b56 (patch) | |
tree | 367fe25e25603ec8574df8960ea2e634f886da63 /gcc/doc/extend.texi | |
parent | 0fae567391bb61cefdbe26f7ff57d82ec007d14c (diff) | |
download | gcc-26877a3f246902e12d8405b7e5479181a31a3b56.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45714 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/doc/extend.texi')
-rw-r--r-- | gcc/doc/extend.texi | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 05a2e5854e6..08344960b52 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 |